Skip to content

Commit

Permalink
chore: addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Mar 6, 2024
1 parent aee18bf commit 0cff640
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion commands/keplr.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const keplr = {
}

await playwright.waitAndClickByText(notificationPageElements.copyAddress);
await playwright.waitAndClick(notificationPageElements.walletSelectors[chainName])
await playwright.waitAndClick(notificationPageElements.walletSelectors(chainName))

walletAddress = clipboardy.readSync();
await playwright.switchToCypressWindow();
Expand Down
5 changes: 3 additions & 2 deletions commands/playwright-keplr.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ module.exports = {
throw new Error(`Failed to click element after ${maxRetries} attempts`);
},
async waitAndClickWithDelay(selector, options, delay) {
await new Promise(resolve => setTimeout(resolve, delay));
await module.exports.waitAndClick(selector, module.exports.keplrWindow(), options);
const page = module.exports.keplrWindow()
await page.waitForTimeout(delay)
await module.exports.waitAndClick(selector, page, options);
},
async switchToKeplrNotification() {
const keplrExtensionData = (await module.exports.getExtensionsData()).keplr;
Expand Down
8 changes: 1 addition & 7 deletions pages/keplr/notification-page.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
const approveButton = `button`;
const copyAddress = 'Copy Address';
const copyWalletAddressSelector =
'div.sc-dkzDqf div.sc-hKMtZM.sc-kDDrLX.cyoEAq.dkJSBQ';
const walletSelectors = {
AGORIC: 'img[alt="Agoric local"]',
COSMOS: 'img[alt="Cosmos Hub"]',
};
const walletSelectors = chainName => `img[alt="${chainName}"]`;

module.exports.notificationPageElements = {
approveButton,
copyAddress,
copyWalletAddressSelector,
walletSelectors
};
8 changes: 4 additions & 4 deletions tests/e2e/specs/keplr/keplr-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ describe('Keplr', () => {
});

it(`should get wallet address while running addNewTokensFound flow`, () => {
cy.getWalletAddress('AGORIC').then(walletAddress => {
cy.getWalletAddress('Agoric local').then(walletAddress => {
expect(walletAddress.length).to.be.equal(45);
});

cy.getWalletAddress('COSMOS').then(walletAddress => {
cy.getWalletAddress('Cosmos Hub').then(walletAddress => {
expect(walletAddress.length).to.be.equal(45);
});
});
Expand Down Expand Up @@ -113,11 +113,11 @@ describe('Keplr', () => {
});

it(`should get wallet address without running addNewTokensFound flow`, () => {
cy.getWalletAddress('AGORIC').then(walletAddress => {
cy.getWalletAddress('Agoric local').then(walletAddress => {
expect(walletAddress.length).to.be.equal(45);
});

cy.getWalletAddress('COSMOS').then(walletAddress => {
cy.getWalletAddress('Cosmos Hub').then(walletAddress => {
expect(walletAddress.length).to.be.equal(45);
});
});
Expand Down

0 comments on commit 0cff640

Please sign in to comment.