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

bring branch up-to-date #901

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading