Skip to content

Commit

Permalink
feat: wait for loadingspinner to be gone (+ load states)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com>
  • Loading branch information
drptbl committed Oct 30, 2022
1 parent 5780d84 commit a3ed516
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions commands/playwright.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const fetch = require('node-fetch');
const { chromium } = require('@playwright/test');
const {
notificationPageElements,
} = require('../pages/metamask/notification-page');
const sleep = require('util').promisify(setTimeout);

let browser;
Expand Down Expand Up @@ -113,7 +116,17 @@ module.exports = {
for (const page of pages) {
if (page.url().includes('notification')) {
await page.bringToFront();
await page.waitForLoadState('load');
await page.waitForLoadState('domcontentloaded');
await page.waitForLoadState('networkidle');
const loadingSpinner = await page.$(
notificationPageElements.loadingSpinner,
);
if (loadingSpinner) {
await page.waitForSelector(notificationPageElements.loadingSpinner, {
hidden: true,
});
}
metamaskNotificationWindow = page;
retries = 0;
return page;
Expand Down

0 comments on commit a3ed516

Please sign in to comment.