aboutsummaryrefslogtreecommitdiff
path: root/test/playwright
diff options
context:
space:
mode:
Diffstat (limited to 'test/playwright')
-rw-r--r--test/playwright/integration.spec.js14
-rw-r--r--test/playwright/visual.spec.js16
2 files changed, 15 insertions, 15 deletions
diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js
index c8cf2f6d..d5b8360c 100644
--- a/test/playwright/integration.spec.js
+++ b/test/playwright/integration.spec.js
@@ -29,7 +29,7 @@ import {
} from './playwright-util';
test.beforeEach(async ({context}) => {
- // wait for the on-install welcome.html tab to load, which becomes the foreground tab
+ // Wait for the on-install welcome.html tab to load, which becomes the foreground tab
const welcome = await context.waitForEvent('page');
await welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
});
@@ -44,7 +44,7 @@ test('search clipboard', async ({page, extensionId}) => {
});
test('anki add', async ({context, page, extensionId}) => {
- // mock anki routes
+ // Mock anki routes
/** @type {?(value: unknown) => void} */
let resolve = null;
const addNotePromise = new Promise((res) => {
@@ -58,10 +58,10 @@ test('anki add', async ({context, page, extensionId}) => {
}
});
- // open settings
+ // Open settings
await page.goto(`chrome-extension://${extensionId}/settings.html`);
- // load in test dictionary
+ // Load in test dictionary
const dictionary = createDictionaryArchive(path.join(root, 'test/data/dictionaries/valid-dictionary1'), 'valid-dictionary1');
const testDictionarySource = await dictionary.generateAsync({type: 'arraybuffer'});
await page.locator('input[id="dictionary-import-file-input"]').setInputFiles({
@@ -71,11 +71,11 @@ test('anki add', async ({context, page, extensionId}) => {
});
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});
- // connect to anki
+ // Connect to anki
await page.locator('.toggle', {has: page.locator('[data-setting="anki.enable"]')}).click();
await expect(page.locator('#anki-error-message')).toHaveText('Connected');
- // prep anki deck
+ // Prep anki deck
await page.locator('[data-modal-action="show,anki-cards"]').click();
await page.locator('select.anki-card-deck').selectOption('Mock Deck');
await page.locator('select.anki-card-model').selectOption('Mock Model');
@@ -85,7 +85,7 @@ test('anki add', async ({context, page, extensionId}) => {
await page.locator('#anki-cards-modal > div > div.modal-footer > button:nth-child(2)').click();
await writeToClipboardFromPage(page, '読むの例文');
- // add to anki deck
+ // Add to anki deck
await page.goto(`chrome-extension://${extensionId}/search.html`);
await expect(async () => {
await page.locator('#search-textbox').clear();
diff --git a/test/playwright/visual.spec.js b/test/playwright/visual.spec.js
index 02efc985..3b46a6d0 100644
--- a/test/playwright/visual.spec.js
+++ b/test/playwright/visual.spec.js
@@ -20,28 +20,28 @@ import {pathToFileURL} from 'url';
import {expect, root, test} from './playwright-util';
test.beforeEach(async ({context}) => {
- // wait for the on-install welcome.html tab to load, which becomes the foreground tab
+ // 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
+ // Open settings
await page.goto(`chrome-extension://${extensionId}/settings.html`);
await expect(page.locator('id=dictionaries')).toBeVisible();
- // get the locator for the disk usage indicator so we can later mask it out of the screenshot
+ // Get the locator for the disk usage indicator so we can later mask it out of the screenshot
const storage_locator = page.locator('.storage-use-finite >> xpath=..');
- // take a simple screenshot of the settings page
+ // Take a simple screenshot of the settings page
await expect.soft(page).toHaveScreenshot('settings-fresh.png', {mask: [storage_locator]});
- // load in jmdict_english.zip
+ // Load in jmdict_english.zip
await page.locator('input[id="dictionary-import-file-input"]').setInputFiles(path.join(root, 'dictionaries/jmdict_english.zip'));
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});
- // take a screenshot of the settings page with jmdict loaded
+ // Take a screenshot of the settings page with jmdict loaded
await expect.soft(page).toHaveScreenshot('settings-jmdict-loaded.png', {mask: [storage_locator]});
/**
@@ -55,10 +55,10 @@ test('visual', async ({page, extensionId}) => {
const box = (await el.boundingBox()) || {x: 0, y: 0, width: 0, height: 0};
- // find the popup frame if it exists
+ // Find the popup frame if it exists
let popup_frame = page.frames().find((f) => f.url().includes('popup.html'));
- // otherwise prepare for it to be attached
+ // Otherwise prepare for it to be attached
let frame_attached;
if (popup_frame === undefined) {
frame_attached = page.waitForEvent('frameattached');