2023-10-29 09:05:24 +00:00
|
|
|
const { test, expect } = require('@playwright/test');
|
|
|
|
const {resolve} = require('path');
|
|
|
|
|
|
|
|
const indexPath = resolve(__dirname, 'output', 'test.html');
|
|
|
|
const crossPlatformIndexPath = indexPath.replace(/^\/+/, '');
|
|
|
|
|
|
|
|
|
|
|
|
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}`);
|
2024-08-30 12:14:18 +00:00
|
|
|
const title = await page.title();
|
2023-10-29 09:05:24 +00:00
|
|
|
// Sanity check
|
2024-08-30 12:14:18 +00:00
|
|
|
await expect(title, "Expected correct page title to verify the test page was loaded").toContain('TiddlyWiki5');
|
2023-10-29 09:05:24 +00:00
|
|
|
|
|
|
|
// Wait for jasmine results bar to appear
|
|
|
|
await expect(page.locator('.jasmine-overall-result'), "Expected jasmine test results bar to be present").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();
|
|
|
|
});
|