summaryrefslogtreecommitdiff
path: root/test/playwright/integration.spec.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-12-06 03:53:16 +0000
committerGitHub <noreply@github.com>2023-12-06 03:53:16 +0000
commitbd5bc1a5db29903bc098995cd9262c4576bf76af (patch)
treec9214189e0214480fcf6539ad1c6327aef6cbd1c /test/playwright/integration.spec.js
parentfd6bba8a2a869eaf2b2c1fa49001f933fce3c618 (diff)
parent23e6fb76319c9ed7c9bcdc3efba39bc5dd38f288 (diff)
Merge pull request #339 from toasted-nutbread/type-annotations
Type annotations
Diffstat (limited to 'test/playwright/integration.spec.js')
-rw-r--r--test/playwright/integration.spec.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js
index b9a86d84..c8cf2f6d 100644
--- a/test/playwright/integration.spec.js
+++ b/test/playwright/integration.spec.js
@@ -45,7 +45,8 @@ test('search clipboard', async ({page, extensionId}) => {
test('anki add', async ({context, page, extensionId}) => {
// mock anki routes
- let resolve;
+ /** @type {?(value: unknown) => void} */
+ let resolve = null;
const addNotePromise = new Promise((res) => {
resolve = res;
});
@@ -53,7 +54,7 @@ test('anki add', async ({context, page, extensionId}) => {
mockAnkiRouteHandler(route);
const req = route.request();
if (req.url().includes('127.0.0.1:8765') && req.postDataJSON().action === 'addNote') {
- resolve(req.postDataJSON());
+ /** @type {(value: unknown) => void} */ (resolve)(req.postDataJSON());
}
});
@@ -63,7 +64,11 @@ test('anki add', async ({context, page, extensionId}) => {
// 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({name: 'valid-dictionary1.zip', buffer: Buffer.from(testDictionarySource)});
+ await page.locator('input[id="dictionary-import-file-input"]').setInputFiles({
+ name: 'valid-dictionary1.zip',
+ mimeType: 'application/x-zip',
+ buffer: Buffer.from(testDictionarySource)
+ });
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});
// connect to anki
@@ -75,7 +80,7 @@ test('anki add', async ({context, page, extensionId}) => {
await page.locator('select.anki-card-deck').selectOption('Mock Deck');
await page.locator('select.anki-card-model').selectOption('Mock Model');
for (const modelField of mockModelFieldNames) {
- await page.locator(`[data-setting="anki.terms.fields.${modelField}"]`).fill(mockModelFieldsToAnkiValues[modelField]);
+ await page.locator(`[data-setting="anki.terms.fields.${modelField}"]`).fill(/** @type {string} */ (mockModelFieldsToAnkiValues[modelField]));
}
await page.locator('#anki-cards-modal > div > div.modal-footer > button:nth-child(2)').click();
await writeToClipboardFromPage(page, '読むの例文');