Skip to content

Commit

Permalink
fixed and improved autotests
Browse files Browse the repository at this point in the history
  • Loading branch information
hubert-de-lalye committed Aug 19, 2024
1 parent 1a09aba commit 67b762a
Show file tree
Hide file tree
Showing 16 changed files with 372 additions and 195 deletions.
2 changes: 2 additions & 0 deletions autotests/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PlaywrightTestConfig } from "@playwright/test";
import { resolve } from "path";

const config: PlaywrightTestConfig = {
timeout: process.env.PW_TIMEOUT ? Number(process.env.PW_TIMEOUT) : 60_000,
Expand All @@ -7,6 +8,7 @@ const config: PlaywrightTestConfig = {
workers: process.env.PW_WORKERS ? Number(process.env.PW_WORKERS) : 1,
use: {
viewport: { width: 1600, height: 1200 },
storageState: resolve(__dirname, "./.storage.json"),
},
};

Expand Down
8 changes: 8 additions & 0 deletions autotests/src/elements/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ export class BasePage {
return this.wrapLocatorWithRoot(locator, locatorSelector);
}

async allowSpentTokens() {
const popup = await this.wallet.page.context().waitForEvent("page");
await popup.waitForSelector('[data-testid="page-container-footer-next"]');
await popup.click('[data-testid="page-container-footer-next"]');
await popup.waitForSelector('[data-testid="page-container-footer-next"]:has-text("Approve")');
await popup.click('[data-testid="page-container-footer-next"]:has-text("Approve")');
}

async has(locator: string | Locator, timeout = 5000) {
const selector = typeof locator === "string" ? this.locator(locator).selector : locator.selector;

Expand Down
6 changes: 4 additions & 2 deletions autotests/src/elements/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export class Tabs<T extends string> extends BasePage {
return window.getComputedStyle(el).pointerEvents;
});

if (style !== "none") {
await tab.click();
if (style === "none") {
return;
}

await tab.click();
}
}

Expand Down
Loading

0 comments on commit 67b762a

Please sign in to comment.