1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-03 04:39:10 +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 // The tests can take a while to run
const timeout = 1000 * 30; const timeout = 1000 * 30;
test.setTimeout(timeout); test.setTimeout(timeout);
// Load the generated test TW html // Load the generated test TW html
await page.goto(`file:///${crossPlatformIndexPath}`); await page.goto(`file:///${crossPlatformIndexPath}`);
// Sanity check // 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 // 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 // Assert the tests have passed
await expect(page.locator('.jasmine-overall-result.jasmine-failed'), "Expected jasmine tests to not have failed").not.toBeVisible(); await Promise.all([
await expect(page.locator('.jasmine-overall-result.jasmine-passed'), "Expected jasmine tests to have passed").toBeVisible(); 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 }) => { test('Search tiddler with link and navigate to block mark', async ({ page }) => {
const timeout = 1000 * 30; const timeout = 1000 * 30;