Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): new test for toggling tokens #4248

Open
wants to merge 145 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
c26f0ce
new test for toggling tokens
inc-man Jan 14, 2025
9382de0
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 14, 2025
6440a56
🤖 Apply formatting changes
github-actions[bot] Jan 14, 2025
6c9cc5a
fix lint issues in code
inc-man Jan 14, 2025
7a4e16d
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 14, 2025
ec1c592
🤖 Apply formatting changes
github-actions[bot] Jan 14, 2025
75086da
fix lint issue
inc-man Jan 14, 2025
8fd4bf1
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 14, 2025
e18e967
fixed test code issues
inc-man Jan 14, 2025
3e9d4f4
🤖 Apply formatting changes
github-actions[bot] Jan 14, 2025
6dfb8de
Update e2e/utils/pages/homepage.page.ts
inc-man Jan 14, 2025
ae71644
Update e2e/utils/pages/homepage.page.ts
inc-man Jan 14, 2025
22fb6d1
fix addressed issues
inc-man Jan 14, 2025
3ba2520
fix token card issue
inc-man Jan 14, 2025
4b2aa73
🤖 Apply formatting changes
github-actions[bot] Jan 14, 2025
2aa6a3d
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 15, 2025
4b6cde7
🤖 Apply formatting changes
github-actions[bot] Jan 15, 2025
2dff75a
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 15, 2025
95ba7fd
revert previous changes
inc-man Jan 15, 2025
ab5133c
🤖 Apply formatting changes
github-actions[bot] Jan 15, 2025
ec90e9e
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 15, 2025
120b109
fix network symbol issue
inc-man Jan 15, 2025
650ca4d
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 15, 2025
ad9ef6b
🤖 Apply formatting changes
github-actions[bot] Jan 15, 2025
d326579
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 15, 2025
b8ab32d
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
374e8b6
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
f52deed
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
2d2ff6f
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
590c5ac
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
6e98b84
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
759426e
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
309b973
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
172ee41
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
c86a6bd
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
9915fd3
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
6d409f8
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
b12e10c
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
2a6d7b6
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
6aa16da
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
6dc1345
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
c82b0b8
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
4c5e2a8
🤖 Update E2E snapshots
github-actions[bot] Jan 15, 2025
c9fda31
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
6529980
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
7e0ba7f
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
1055747
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
69f0a9d
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
9a2ca99
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
cb9b2fe
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
9862cf8
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
7d1dcf9
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
c9d8981
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
565d2d0
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
70c46ef
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
3be74a1
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
c71377e
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
4837741
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
084334a
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
1f2edb9
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
d1ea21d
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
ba8801d
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
95f6466
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
8d1e07d
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
0eaa956
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
d9acef7
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
9df9c6e
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
34e8466
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
d1472f0
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
b844c75
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
6456ce3
🤖 Update E2E snapshots
github-actions[bot] Jan 16, 2025
7a73f99
Update src/frontend/src/lib/components/networks/Network.svelte
inc-man Jan 17, 2025
247c22b
Update src/frontend/src/lib/constants/test-ids.constants.ts
inc-man Jan 17, 2025
7fd8361
Update src/frontend/src/lib/constants/test-ids.constants.ts
inc-man Jan 17, 2025
c7c6cfb
Update src/frontend/src/lib/constants/test-ids.constants.ts
inc-man Jan 17, 2025
fb28d87
Update src/frontend/src/lib/constants/test-ids.constants.ts
inc-man Jan 17, 2025
b83d0a4
Update src/frontend/src/lib/constants/test-ids.constants.ts
inc-man Jan 17, 2025
b155bbc
Update src/frontend/src/icp/components/tokens/IcManageTokenToggle.svelte
inc-man Jan 17, 2025
5eac618
fix test scenario
inc-man Jan 17, 2025
99d50c0
🤖 Apply formatting changes
github-actions[bot] Jan 17, 2025
8bb2311
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 17, 2025
971b75d
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
764c91d
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
e8c68a1
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
4d3d7ff
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
28491ab
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
4886ae1
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
788cc6b
further test adjustments
inc-man Jan 17, 2025
a0e8443
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 17, 2025
30245c9
🤖 Apply formatting changes
github-actions[bot] Jan 17, 2025
0dcea0b
fix lint errors
inc-man Jan 17, 2025
6cb7896
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 17, 2025
a86dd02
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
d8e6489
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
a877ee9
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
bc2d905
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
0fcdc8c
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
dd1e079
fix screen size issue
inc-man Jan 17, 2025
2d264d1
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 17, 2025
c143c16
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
2f60ae1
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
7783eaf
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
f80f8b2
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
6b21b4f
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
0aefd40
🤖 Update E2E snapshots
github-actions[bot] Jan 17, 2025
0636adf
adjust device screen and viewport
inc-man Jan 20, 2025
cf89963
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
0dbcef1
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
a555243
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
c662087
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
ac0ab18
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
58c74cb
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
d67df52
new fixes for test
inc-man Jan 20, 2025
c8a6497
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
2c72c1a
🤖 Apply formatting changes
github-actions[bot] Jan 20, 2025
651253c
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
63d998b
further adjustments
inc-man Jan 20, 2025
1086eff
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
f7285e8
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 20, 2025
f0b3e36
Merge branch 'test(e2e)/manage-tokens-test' of github.com:dfinity/ois…
inc-man Jan 20, 2025
4336d45
further config adjustments
inc-man Jan 20, 2025
9c221a2
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
392246d
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
3c3262d
fix iPhone SE viewport
inc-man Jan 20, 2025
e517deb
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
95b008f
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
9ba97aa
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
21931ba
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
c7d2d90
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
2610b2f
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
3aad6f2
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
40ec9b9
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
376a512
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
ba48a32
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
a6bbf79
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
9836554
Merge branch 'main' into test(e2e)/manage-tokens-test
inc-man Jan 20, 2025
41063fd
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
5e370f3
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
53fdb6e
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
01c46f4
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
1d7809e
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
e591e27
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
c4c555c
Merge branch 'main' into test(e2e)/manage-tokens-test
bitdivine Jan 20, 2025
c1ab9fe
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
b391219
🤖 Update E2E snapshots
github-actions[bot] Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions e2e/manage-tokens.spec.ts
inc-man marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { testWithII } from '@dfinity/internet-identity-playwright';
import { expect } from '@playwright/test';
import { HomepageLoggedIn } from './utils/pages/homepage.page';

let homepageLoggedIn: HomepageLoggedIn;

testWithII.beforeEach(async ({ page, iiPage }) => {
homepageLoggedIn = new HomepageLoggedIn({
page,
iiPage
});

await homepageLoggedIn.waitForReady();
});

testWithII('enable ICRC token', async () => {
// enable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'ckSepoliaETH',
networkName: 'Internet Computer'
});
await expect(homepageLoggedIn.getTokenCardLocator('ckSepoliaETH')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.setCarouselFirstSlide();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this PR, but isn't it better to include

	await homepageLoggedIn.waitForLoadState();
	await homepageLoggedIn.setCarouselFirstSlide();

inside await homepageLoggedIn.takeScreenshot(); ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summarized comment instead of multiple short ones

  • Snapshots: Totally agree, I remembered that you told me you want snapshots in every test so I made it for disable too. But me personally I would leave it out aswell. Expect already tests if it is disabled.

  • Naming Suggestions: Agree with all of them, makes sense.

  • adjust takeScreenshot method: Not suggested, setCarouselFirstSlide is only relevant on homepage. Otherwise it could return errors when carousel is not visible.

await homepageLoggedIn.takeScreenshot();
});

testWithII('disable ICRC token', async () => {
//disable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'ckSepoliaETH',
networkName: 'Internet Computer'
});
await expect(homepageLoggedIn.getTokenCardLocator('ckSepoliaETH')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'ckSepoliaETH',
networkName: 'Internet Computer'
});
await expect(homepageLoggedIn.getTokenCardLocator('ckSepoliaETH')).not.toBeVisible();
await homepageLoggedIn.setCarouselFirstSlide();
await homepageLoggedIn.takeScreenshot();
});

testWithII('enable ERC20 token', async () => {
// enable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'SHIB',
networkName: 'Ethereum'
});
await expect(homepageLoggedIn.getTokenCardLocator('SHIB')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.setCarouselFirstSlide();
await homepageLoggedIn.takeScreenshot();
});

testWithII('disable ERC20 token', async () => {
//disable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'SHIB',
networkName: 'Ethereum'
});
await expect(homepageLoggedIn.getTokenCardLocator('SHIB')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'SHIB',
networkName: 'Ethereum'
});
await expect(homepageLoggedIn.getTokenCardLocator('SHIB')).not.toBeVisible();
await homepageLoggedIn.setCarouselFirstSlide();
await homepageLoggedIn.takeScreenshot();
});

testWithII('enable SepoliaERC20 token', async () => {
// enable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'USDC',
networkName: 'Sepolia'
});
await expect(homepageLoggedIn.getTokenCardLocator('USDC')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.setCarouselFirstSlide();
await homepageLoggedIn.takeScreenshot();
});

testWithII('disable SepoliaERC20 token', async () => {
//disable the Token in the list
await homepageLoggedIn.activateTestnetSettings();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'USDC',
networkName: 'Sepolia'
});
await expect(homepageLoggedIn.getTokenCardLocator('USDC')).toBeVisible();
await homepageLoggedIn.waitForLoadState();
await homepageLoggedIn.toggleTokenInList({
tokenSymbol: 'USDC',
networkName: 'Sepolia'
});
await expect(homepageLoggedIn.getTokenCardLocator('USDC')).not.toBeVisible();
await homepageLoggedIn.setCarouselFirstSlide();
await homepageLoggedIn.takeScreenshot();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions e2e/utils/pages/homepage.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import {
LOADER_MODAL,
LOGIN_BUTTON,
LOGOUT_BUTTON,
MANAGE_TOKEN_LIST_SAVE,
NAVIGATION_ITEM_HOMEPAGE,
NAVIGATION_ITEM_MANAGE_LIST,
NAVIGATION_ITEM_SETTINGS,
NAVIGATION_MENU,
NAVIGATION_MENU_BUTTON,
NAVIGATION_MENU_NETWORKS,
RECEIVE_TOKENS_MODAL,
RECEIVE_TOKENS_MODAL_OPEN_BUTTON,
RECEIVE_TOKENS_MODAL_QR_CODE_OUTPUT,
Expand Down Expand Up @@ -241,6 +244,24 @@ abstract class Homepage {
await this.clickByTestId(NAVIGATION_ITEM_HOMEPAGE);
}

async toggleTokenInList({
tokenSymbol,
networkName
}: {
tokenSymbol: string;
networkName: string;
}): Promise<void> {
await this.clickByTestId(NAVIGATION_MENU_NETWORKS);
await this.#page.click(`[data-tid^="network-${networkName}"]`);
inc-man marked this conversation as resolved.
Show resolved Hide resolved
await this.clickByTestId(NAVIGATION_ITEM_MANAGE_LIST);
await this.#page.click(`[data-tid^="token-toggle-${tokenSymbol}"]`);
inc-man marked this conversation as resolved.
Show resolved Hide resolved
await this.clickByTestId(MANAGE_TOKEN_LIST_SAVE);
}

getTokenCardLocator(tokenSymbol: string): Locator {
return this.#page.locator(`[data-tid="token-card-${tokenSymbol}"]`);
inc-man marked this conversation as resolved.
Show resolved Hide resolved
}

async takeScreenshot(): Promise<void> {
await expect(this.#page).toHaveScreenshot({
// creates a snapshot as a fullPage and not just certain parts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { isIcrcTokenToggleDisabled } from '$lib/utils/token-toggle.utils';

export let token: IcrcCustomToken;
export let testIdPrefix = 'token-toggle';
inc-man marked this conversation as resolved.
Show resolved Hide resolved

let disabled = false;
$: disabled = isIcrcTokenToggleDisabled(token);
Expand All @@ -31,6 +32,7 @@

<Toggle
ariaLabel={checked ? $i18n.tokens.text.hide_token : $i18n.tokens.text.show_token}
testId={`${testIdPrefix}-${token.symbol}-${token.network.id.description}`}
{disabled}
bind:checked
on:nnsToggle={toggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import ButtonGroup from '$lib/components/ui/ButtonGroup.svelte';
import Card from '$lib/components/ui/Card.svelte';
import InputSearch from '$lib/components/ui/InputSearch.svelte';
import { MANAGE_TOKEN_LIST_SAVE } from '$lib/constants/test-ids.constants';
import { allTokens } from '$lib/derived/all-tokens.derived';
import { exchanges } from '$lib/derived/exchange.derived';
import { pseudoNetworkChainFusion, selectedNetwork } from '$lib/derived/network.derived';
Expand Down Expand Up @@ -193,7 +194,7 @@

<ButtonGroup>
<ButtonCancel on:click={() => dispatch('icClose')} />
<Button disabled={saveDisabled} on:click={save}>
<Button testId={MANAGE_TOKEN_LIST_SAVE} disabled={saveDisabled} on:click={save}>
{$i18n.core.text.save}
</Button>
</ButtonGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/lib/components/networks/Network.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
$: ({ id, name, iconBW: icon } = network);
</script>

<NetworkButton {id} {name} {usdBalance} {icon} on:icSelected />
<NetworkButton {id} {name} {usdBalance} {icon} testId={`network-${name}`} on:icSelected />
inc-man marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let name: string;
export let icon: string | undefined;
export let usdBalance: number | undefined = undefined;
export let testId: string | undefined = undefined;

const dispatch = createEventDispatcher();

Expand All @@ -29,7 +30,7 @@
};
</script>

<button class="flex w-full items-start justify-between" on:click={onClick}>
<button data-tid={testId} class="flex w-full items-start justify-between" on:click={onClick}>
<TextWithLogo
{name}
{icon}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Network from '$lib/components/networks/Network.svelte';
import NetworkButton from '$lib/components/networks/NetworkButton.svelte';
import Dropdown from '$lib/components/ui/Dropdown.svelte';
import { NAVIGATION_MENU_NETWORKS } from '$lib/constants/test-ids.constants';
import { SLIDE_EASING } from '$lib/constants/transition.constants';
import { selectedNetwork } from '$lib/derived/network.derived';
import { networksMainnets, networksTestnets } from '$lib/derived/networks.derived';
Expand All @@ -24,7 +25,12 @@
);
</script>

<Dropdown bind:this={dropdown} ariaLabel={$i18n.networks.title} {disabled}>
<Dropdown
bind:this={dropdown}
ariaLabel={$i18n.networks.title}
testId={NAVIGATION_MENU_NETWORKS}
{disabled}
>
{$selectedNetwork?.name ?? $i18n.networks.chain_fusion}

<div slot="items">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { isEthereumTokenToggleDisabled } from '$lib/utils/token-toggle.utils';

export let token: EthereumUserToken;
export let testIdPrefix = 'token-toggle';

let disabled = false;
$: disabled = isEthereumTokenToggleDisabled(token);
Expand Down Expand Up @@ -36,6 +37,7 @@
<div role="button" on:click={onClick}>
<Toggle
ariaLabel={checked ? $i18n.tokens.text.hide_token : $i18n.tokens.text.show_token}
testId={`${testIdPrefix}-${token.symbol}-${token.network.id.description}`}
{disabled}
bind:checked
on:nnsToggle={toggle}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { erc20UserTokensNotInitialized } from '$eth/derived/erc20.derived';
import IconManage from '$lib/components/icons/lucide/IconManage.svelte';
import { NAVIGATION_ITEM_MANAGE_LIST } from '$lib/constants/test-ids.constants';
import { authNotSignedIn } from '$lib/derived/auth.derived';
import { i18n } from '$lib/stores/i18n.store';
import { modalStore } from '$lib/stores/modal.store';
Expand All @@ -9,7 +10,12 @@
$: disabled = $erc20UserTokensNotInitialized || $authNotSignedIn;
</script>

<button class="tertiary" on:click={modalStore.openManageTokens} {disabled}>
<button
class="tertiary"
data-tid={NAVIGATION_ITEM_MANAGE_LIST}
on:click={modalStore.openManageTokens}
{disabled}
>
<IconManage />
{$i18n.tokens.manage.text.manage_list}
</button>
2 changes: 2 additions & 0 deletions src/frontend/src/lib/components/ui/Dropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

export let disabled = false;
export let ariaLabel: string;
export let testId: string | undefined = undefined;

let visible = false;
let button: HTMLButtonElement | undefined;
Expand All @@ -15,6 +16,7 @@
bind:button
on:click={() => (visible = true)}
{ariaLabel}
{testId}
{disabled}
opened={visible}
>
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/lib/components/ui/DropdownButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
export let button: HTMLButtonElement | undefined = undefined;
export let ariaLabel: string;
export let opened = false;
export let testId: string | undefined = undefined;
</script>

<button
class="min-w-72 justify-between gap-2 rounded-xl border border-tertiary bg-white px-4 py-3 text-left font-medium leading-5 text-black text-inherit hover:border-brand-primary"
bind:this={button}
on:click
aria-label={ariaLabel}
data-tid={testId}
{disabled}
class:opacity-50={disabled}
class:border-brand-primary={opened}
Expand Down
5 changes: 5 additions & 0 deletions src/frontend/src/lib/constants/test-ids.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const NAVIGATION_ITEM_ACTIVITY = 'navigation-item-activity';
export const NAVIGATION_ITEM_EXPLORER = 'navigation-item-explore';
export const NAVIGATION_ITEM_SETTINGS = 'navigation-item-settings';
export const NAVIGATION_ITEM_HOMEPAGE = 'navigation-item-homepage';
export const NAVIGATION_ITEM_MANAGE_LIST = 'navigation-item-manage-list';
inc-man marked this conversation as resolved.
Show resolved Hide resolved

export const BTC_TESTNET_TOGGLE = 'btc-testnet-toggle';

Expand All @@ -69,3 +70,7 @@ export const VIP_QR_CODE_COPY_BUTTON = 'vip-qr-code-copy-button';
export const VIP_CODE_REGENERATE_BUTTON = 'vip-code-regenerate-button';

export const SOL_TRANSACTION_SKELETON_PREFIX = 'sol-txn';

export const TOKEN_TOGGLE = 'token-toggle';
export const MANAGE_TOKEN_LIST_SAVE = 'manage-token-list-save';
inc-man marked this conversation as resolved.
Show resolved Hide resolved
export const NAVIGATION_MENU_NETWORKS = 'navigation-menu-networks';
Loading