From b9d861e3a1b5212281a991c4a0a82357f8ceda8d Mon Sep 17 00:00:00 2001 From: linonetwo Date: Thu, 3 Oct 2024 23:37:01 +0800 Subject: [PATCH] refactor: compact the old test code --- editions/test/playwright.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/editions/test/playwright.spec.js b/editions/test/playwright.spec.js index 569a58bd6..f261a9cf3 100644 --- a/editions/test/playwright.spec.js +++ b/editions/test/playwright.spec.js @@ -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;