Skip to content

Commit

Permalink
test: updated clickDisclaimerButton function for the new disclaimer m…
Browse files Browse the repository at this point in the history
…odal (#897)

* test: updated clickDisclaimerButton function

* fix dappstaking register (#898)

* Fix/test disclaimer (#899)

* fix dappstaking register

* more disclaimers

---------

Co-authored-by: Gregory Luneau <[email protected]>
  • Loading branch information
impelcrypto and gluneau authored Aug 15, 2023
1 parent 9c707f1 commit 40932af
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/modules/playwright/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export const checkInjectedWeb3 = async (page: Page): Promise<JSHandle<boolean>>
};

export const clickDisclaimerButton = async (page: Page): Promise<void> => {
const acceptPolicy = page.locator('.wrapper--modal-disclaimer > button:has-text("Agree")');
await acceptPolicy.click();
await page.getByRole('button', { name: 'Agree' }).click();
};
5 changes: 3 additions & 2 deletions tests/test_specs/dappstaking-register.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { clickDisclaimerButton } from 'src/modules/playwright';
import { BrowserContext, Page, expect } from '@playwright/test';
import { test } from '../fixtures';
import {
Expand All @@ -23,8 +24,8 @@ test.afterAll(async () => {
test.beforeEach(async ({ page, context }: { page: Page; context: BrowserContext }) => {
await page.goto('/astar/dapp-staking/discover');

// Close cookies popup
await page.getByRole('button', { name: 'Accept' }).click();
// Close disclaimer popup
await clickDisclaimerButton(page);

const polkadotButton = page.getByText('Polkadot.js');
await polkadotButton.click();
Expand Down
5 changes: 3 additions & 2 deletions tests/test_specs/dappstaking-transactions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { clickDisclaimerButton } from 'src/modules/playwright';
import { BrowserContext, Page, expect } from '@playwright/test';
import {
ALICE_ACCOUNT_NAME,
Expand Down Expand Up @@ -42,8 +43,8 @@ const stake = async (page: Page, context: BrowserContext, amount: bigint): Promi
test.beforeEach(async ({ page, context }) => {
await page.goto('/astar/dapp-staking/discover');

// Close cookies popup
await page.getByRole('button', { name: 'Accept' }).click();
// Close disclaimer popup
await clickDisclaimerButton(page);

const closeButton = page.getByText('Polkadot.js');
await closeButton.click();
Expand Down
6 changes: 5 additions & 1 deletion tests/test_specs/dappstaking.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { checkPolicyInLocalStorage, checkInjectedWeb3 } from 'src/modules/playwright';
import { clickDisclaimerButton, checkInjectedWeb3 } from 'src/modules/playwright';

test.beforeEach(async ({ page }) => {
await page.goto('/astar/dapp-staking/discover');
Expand Down Expand Up @@ -39,6 +39,7 @@ test.describe('on dapp staking screen', () => {
});

test('should clickable the banner after loading is complete', async ({ page }) => {
await clickDisclaimerButton(page);
const closeButton = page.locator('.modal-close');
await closeButton.click();
const bannerCard = page.locator('.wrapper--banners .card:first-child');
Expand All @@ -48,6 +49,7 @@ test.describe('on dapp staking screen', () => {
});

test('should redirect to dapp page when click the dapp card', async ({ page }) => {
await clickDisclaimerButton(page);
const closeButton = page.locator('.modal-close');
await closeButton.click();
await page.waitForSelector('.loader', { state: 'hidden' });
Expand All @@ -58,6 +60,7 @@ test.describe('on dapp staking screen', () => {
});

test('should display staking button when over the dapp card', async ({ page }) => {
await clickDisclaimerButton(page);
const closeButton = page.locator('.modal-close');
await closeButton.click();
await page.waitForSelector('.loader', { state: 'hidden' });
Expand All @@ -69,6 +72,7 @@ test.describe('on dapp staking screen', () => {
});

test('should clickable item on the on chain data after loading is complete', async ({ page }) => {
await clickDisclaimerButton(page);
const closeButton = page.locator('.modal-close');
await closeButton.click();
await page.waitForSelector('.loader', { state: 'hidden' });
Expand Down

0 comments on commit 40932af

Please sign in to comment.