Skip to content

Commit

Permalink
Add clickOnSpecificToken function
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine-Pinto authored and teebszet committed May 31, 2024
1 parent 76e6efe commit 5543023
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions tests/pages/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@ export default class Wallet {
return numericValue;
}

async clickOnSpecificToken(tokenname) {
const specificToken = this.page
.getByRole('button')
.filter({ has: this.labelTokenSubtitle.getByText(tokenname, { exact: true }) });
await specificToken.last().click();
}

async checkNetworkSettingVisuals() {
await expect(this.buttonSave).toBeVisible();
await expect(this.buttonBack).toBeVisible();
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/transactionBTC.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe('Transaction BTC', () => {

await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
// Send BTC
await wallet.divTokenRow.nth(2).click();
await wallet.clickOnSpecificToken('Bitcoin');
await expect(page.url()).toContain('send-btc');
await expect(wallet.buttonNext).toBeVisible();
await expect(wallet.buttonNext).toBeDisabled();
Expand Down Expand Up @@ -87,7 +87,7 @@ test.describe('Transaction BTC', () => {
await wallet.allupperButtons.nth(0).click();

await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
await wallet.divTokenRow.nth(2).click();
await wallet.clickOnSpecificToken('Bitcoin');
await expect(page.url()).toContain('send-btc');
await expect(wallet.buttonNext).toBeVisible();
await expect(wallet.buttonNext).toBeDisabled();
Expand Down Expand Up @@ -151,7 +151,7 @@ test.describe('Transaction BTC', () => {
await wallet.allupperButtons.nth(0).click();

await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
await wallet.divTokenRow.nth(2).click();
await wallet.clickOnSpecificToken('Bitcoin');
await expect(page.url()).toContain('send-btc');
await expect(wallet.buttonNext).toBeVisible();
await expect(wallet.buttonNext).toBeDisabled();
Expand Down
9 changes: 5 additions & 4 deletions tests/specs/transactionSTX.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ test.describe('Transaction STX', () => {

await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
// Send STX
await wallet.divTokenRow.nth(3).click();

await wallet.clickOnSpecificToken('Stacks');
await wallet.checkVisualsSendSTXPage();

// Recipient address invalid check
Expand Down Expand Up @@ -80,7 +81,7 @@ test.describe('Transaction STX', () => {
await wallet.allupperButtons.nth(0).click();

await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
await wallet.divTokenRow.nth(3).click();
await wallet.clickOnSpecificToken('Stacks');
await wallet.checkVisualsSendSTXPage();

// Fill in Receiver Address
Expand Down Expand Up @@ -140,7 +141,7 @@ test.describe('Transaction STX', () => {

// Needed to add this to avoid loading issues with the token list to be displayed
await expect(await wallet.divTokenRow.count()).toBeGreaterThanOrEqual(2);
await wallet.divTokenRow.nth(3).click();
await wallet.clickOnSpecificToken('Stacks');

// Check visuals of sending page
await wallet.checkVisualsSendSTXPage();
Expand Down Expand Up @@ -187,7 +188,7 @@ test.describe('Transaction STX', () => {
await wallet.navigationDashboard.click();
// Check if switch to testnet was successfull and all visuals are correct
await wallet.checkVisualsStartpage('testnet');
await wallet.divTokenRow.nth(2).click();
await wallet.clickOnSpecificToken('Stacks');
await expect(page.url()).toContain('STX');
// Check token detail page for token image and coin title
await expect(wallet.imageToken).toBeVisible();
Expand Down

0 comments on commit 5543023

Please sign in to comment.