summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/deinflector.test.js1
-rw-r--r--test/dictionary-data-validate.test.js4
-rw-r--r--test/playwright/integration.spec.js14
-rw-r--r--test/playwright/visual.spec.js16
4 files changed, 17 insertions, 18 deletions
diff --git a/test/deinflector.test.js b/test/deinflector.test.js
index 7ef8e6dd..9c8443d2 100644
--- a/test/deinflector.test.js
+++ b/test/deinflector.test.js
@@ -962,5 +962,4 @@ function main() {
testDeinflections();
}
-
main();
diff --git a/test/dictionary-data-validate.test.js b/test/dictionary-data-validate.test.js
index c54f7dbb..5334bc2e 100644
--- a/test/dictionary-data-validate.test.js
+++ b/test/dictionary-data-validate.test.js
@@ -18,7 +18,7 @@
import {fileURLToPath} from 'node:url';
import path from 'path';
-import {describe, test} from 'vitest';
+import {describe, it} from 'vitest';
import * as dictionaryValidate from '../dev/dictionary-validate.js';
import {createDictionaryArchive} from '../dev/util.js';
@@ -46,7 +46,7 @@ describe('Dictionary validation', () => {
];
const schemas = dictionaryValidate.getSchemas();
describe.each(testCases)('Test dictionary $name', ({name, valid}) => {
- test(`Should be ${valid ? 'valid' : 'invalid'}`, async ({expect}) => {
+ it(`should be ${valid ? 'valid' : 'invalid'}`, async ({expect}) => {
const archive = createTestDictionaryArchive(name);
if (valid) {
await expect(dictionaryValidate.validateDictionary(null, archive, schemas)).resolves.not.toThrow();
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');