diff options
author | MarvNC <rotrobmin@gmail.com> | 2023-11-03 11:59:21 -0700 |
---|---|---|
committer | MarvNC <rotrobmin@gmail.com> | 2023-11-03 11:59:21 -0700 |
commit | ec62375c017f124570cf922647c530829714eee2 (patch) | |
tree | accb3968e083f6e59a243b840d7859d61b3fae9e /test/playwright/visual.spec.js | |
parent | 5e10b67c500b7af9d5af6d98caae9734ebdf984d (diff) | |
parent | b64f51c3b13a46af4dd7f1e43048ac19c781ca7b (diff) |
Merge remote-tracking branch 'upstream/master' into update-dictionaries
Diffstat (limited to 'test/playwright/visual.spec.js')
-rw-r--r-- | test/playwright/visual.spec.js | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/test/playwright/visual.spec.js b/test/playwright/visual.spec.js index acb12e97..001f329f 100644 --- a/test/playwright/visual.spec.js +++ b/test/playwright/visual.spec.js @@ -16,40 +16,20 @@ */ const path = require('path'); -const {test: base, chromium} = require('@playwright/test'); -const root = path.join(__dirname, '..', '..'); - -export const test = base.extend({ - context: async ({ }, use) => { - const pathToExtension = path.join(root, 'ext'); - const context = await chromium.launchPersistentContext('', { - // headless: false, - args: [ - '--headless=new', - `--disable-extensions-except=${pathToExtension}`, - `--load-extension=${pathToExtension}` - ] - }); - await use(context); - await context.close(); - }, - extensionId: async ({context}, use) => { - let [background] = context.serviceWorkers(); - if (!background) { - background = await context.waitForEvent('serviceworker'); - } - const extensionId = background.url().split('/')[2]; - await use(extensionId); - } -}); -const expect = test.expect; +const { + test, + expect, + root +} = require('./playwright-util'); -test('visual', async ({context, page, extensionId}) => { +test.beforeEach(async ({context}) => { // wait for the on-install welcome.html tab to load, which becomes the foreground tab const welcome = await context.waitForEvent('page'); welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang +}); +test('visual', async ({page, extensionId}) => { // open settings await page.goto(`chrome-extension://${extensionId}/settings.html`); @@ -117,4 +97,4 @@ test('visual', async ({context, page, extensionId}) => { await screenshot(2, i, el, {x: 15, y: 15}); i++; } -}); +});
\ No newline at end of file |