Skip to content

Commit

Permalink
fix: Flaky add-hide-token.spec file by programatically closing flashi…
Browse files Browse the repository at this point in the history
…ng modal
  • Loading branch information
gambinish committed Nov 21, 2024
1 parent 9f8d61b commit abcc3c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/e2e/tests/tokens/add-hide-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ describe('Add existing token using search', function () {
}),
];
}
it('renders the balance for the chosen token', async function () {

it.only('renders the balance for the chosen token', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder({ inputChainId: CHAIN_IDS.BSC })
Expand All @@ -129,6 +130,19 @@ describe('Add existing token using search', function () {
async ({ driver }) => {
await unlockWallet(driver);

// there is a race condition where "You are now using" new network modal temporarily flashes
// this modal obscures the elements beneath it, including the import tokens button
// this check mitigates this flakiness. However, the modal itself maybe isn't super useful to have at all
const closeButton = await driver.findElement(
'[data-testid="new-network-info-popup-close-button"]',
);

if (closeButton) {
await driver.clickElement(
'[data-testid="new-network-info-popup-close-button"]',
);
}

await driver.clickElement(`[data-testid="import-token-button"]`);
await driver.clickElement(`[data-testid="importTokens"]`);
await driver.fill('input[placeholder="Search tokens"]', 'BAT');
Expand Down
1 change: 1 addition & 0 deletions ui/components/ui/new-network-info/new-network-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default function NewNetworkInfo() {
</Text>
</Button>
<Button
data-testid="new-network-info-popup-close-button"
variant="primary"
onClick={onCloseClick}
size={ButtonPrimarySize.Md}
Expand Down

0 comments on commit abcc3c0

Please sign in to comment.