Skip to content

Commit

Permalink
playwright test importing from url and deleting dictionary (#1233)
Browse files Browse the repository at this point in the history
* try testing url import in playwright

* try fixes

* fixes

* try fixing button

* try fixing button

* try fixing button

* test deleting

* test deleting

* test deleting

* typo
  • Loading branch information
StefanVukovic99 authored Jul 17, 2024
1 parent f43cfd0 commit f2632ef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/playwright/visual.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ test('visual', async ({page, extensionId}) => {
// Wait for the advanced settings to be visible
await page.locator('input#advanced-checkbox').evaluate((/** @type {HTMLInputElement} */ element) => element.click());

// Import jmdict_swedish.zip from a URL
await page.locator('.settings-item[data-modal-action="show,dictionaries"]').click();
await page.locator('button[id="dictionary-import-button"]').click();
await page.locator('textarea[id="dictionary-import-url-text"]').fill('https://github.com/themoeway/yomitan/raw/dictionaries/jmdict_swedish.zip');
await page.locator('button[id="dictionary-import-url-button"]').click();
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (2 installed, 2 enabled)', {timeout: 5 * 60 * 1000});

// Delete the jmdict_swedish dictionary
await page.locator('button.dictionary-menu-button').nth(1).click();
await page.locator('button.popup-menu-item[data-menu-action="delete"]').click();
await page.locator('#dictionary-confirm-delete-button').click();
await page.locator('#dictionaries-modal button[data-modal-action="hide"]').getByText('Close').click();
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});

// Get page height by getting the footer and adding height and y position as other methods of calculation don't work for some reason
const footer = /** @type {import('@playwright/test').ElementHandle<HTMLElement>} */ (await page.locator('.footer-padding').elementHandle());
expect(footer).not.toBe(null);
Expand Down

0 comments on commit f2632ef

Please sign in to comment.