Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrasinskis committed Oct 11, 2024
1 parent 69ddc68 commit 734e1f7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<form on:submit|preventDefault={() => dispatch("nnsSubmit")}>
{#if addIndexCanisterMode}
<ImportTokenCanisterId
testId="ledger-canister-id"
testId="ledger-canister-id-view"
label={$i18n.import_token.ledger_label}
canisterId={ledgerCanisterId}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,18 @@ describe("ImportTokenForm", () => {
});

it("should display addIndexCanister mode ", async () => {
const ledgerCanisterId = principal(0);
const { po } = renderComponent({
ledgerCanisterId: principal(0),
ledgerCanisterId,
indexCanisterId: undefined,
addIndexCanisterMode: true,
});

expect(await po.getLedgerCanisterInputPo().isDisabled()).toEqual(true);
expect(await po.getLedgerCanisterInputPo().isPresent()).toEqual(false);
expect(await po.getLedgerCanisterIdPo().isPresent()).toEqual(true);
expect(await po.getLedgerCanisterIdPo().getCanisterIdText()).toEqual(
ledgerCanisterId.toText()
);
expect(await po.getIndexCanisterInputPo().isRequired()).toEqual(true);
expect((await po.getIndexCanisterInputPo().getText()).trim()).toEqual(
"Index Canister ID"
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/tests/lib/pages/IcrcWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,12 @@ describe("IcrcWallet", () => {
expect(spyOnSetImportedTokens).toBeCalledTimes(0);
expect(await addIndexCanisterModalPo.isPresent()).toBe(true);
expect(get(busyStore)).toEqual([]);
expect(
await addIndexCanisterModalPo
.getImportTokenFormPo()
.getLedgerCanisterIdPo()
.getCanisterIdText()
).toEqual(ledgerCanisterId.toText());

await addIndexCanisterModalPo.typeIndexCanisterId(
indexCanisterId.toText()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ButtonPo } from "$tests/page-objects/Button.page-object";
import { CalloutWarningPo } from "$tests/page-objects/CalloutWarning.page-object";
import { ImportTokenCanisterIdPo } from "$tests/page-objects/ImportTokenCanisterId.page-object";
import { InputWithErrorPo } from "$tests/page-objects/InputWithError.page-object";
import { BasePageObject } from "$tests/page-objects/base.page-object";
import type { PageObjectElement } from "$tests/types/page-object.types";
Expand All @@ -18,6 +19,13 @@ export class ImportTokenFormPo extends BasePageObject {
});
}

getLedgerCanisterIdPo(): ImportTokenCanisterIdPo {
return ImportTokenCanisterIdPo.under({
element: this.root,
testId: "ledger-canister-id-view",
});
}

getIndexCanisterInputPo(): InputWithErrorPo {
return InputWithErrorPo.under({
element: this.root,
Expand Down

0 comments on commit 734e1f7

Please sign in to comment.