1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-23 15:36:52 +00:00

refactor: compact the old test code

This commit is contained in:
linonetwo 2024-10-03 23:37:01 +08:00
parent 18b492103c
commit b9d861e3a1

View File

@ -9,19 +9,19 @@ test('get started link', async ({ page }) => {
// The tests can take a while to run
const timeout = 1000 * 30;
test.setTimeout(timeout);
// Load the generated test TW html
await page.goto(`file:///${crossPlatformIndexPath}`);
// Sanity check
await expect(page.locator('.tc-site-title'), "Expected correct page title to verify the test page was loaded").toHaveText('TiddlyWiki5');
await expect(page.locator('.tc-site-title'), "Correct page title to verify the test page was loaded").toHaveText('TiddlyWiki5');
// Wait for jasmine results bar to appear
await expect(page.locator('.jasmine-overall-result'), "Expected jasmine test results bar to be present").toBeVisible({timeout});
await expect(page.locator('.jasmine-overall-result'), "Jasmine test results bar presented").toBeVisible({timeout});
// Assert the tests have passed
await expect(page.locator('.jasmine-overall-result.jasmine-failed'), "Expected jasmine tests to not have failed").not.toBeVisible();
await expect(page.locator('.jasmine-overall-result.jasmine-passed'), "Expected jasmine tests to have passed").toBeVisible();
await Promise.all([
expect(page.locator('.jasmine-overall-result.jasmine-failed'), "Jasmine tests not failed").not.toBeVisible(),
expect(page.locator('.jasmine-overall-result.jasmine-passed'), "Jasmine tests passed").toBeVisible()
]);
});
test('Search tiddler with link and navigate to block mark', async ({ page }) => {
const timeout = 1000 * 30;