From 2e712fef1369853835d7bb700d663244b5271e85 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Mon, 9 Sep 2024 08:41:08 +0200 Subject: [PATCH] test: always click on the details button in ui test --- test/ui/test/html-report.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/ui/test/html-report.spec.ts b/test/ui/test/html-report.spec.ts index 21c01d76ba01..cedf269705c6 100644 --- a/test/ui/test/html-report.spec.ts +++ b/test/ui/test/html-report.spec.ts @@ -35,11 +35,19 @@ test.describe('html report', () => { ) // run vite preview server - previewServer = await preview({ build: { outDir: 'html' }, preview: { port, strictPort: true } }) + previewServer = await preview({ + build: { outDir: 'html' }, + preview: { port, strictPort: true }, + }) }) test.afterAll(async () => { await new Promise((resolve, reject) => { + // if there is no preview server, `startVitest` failed already + if (!previewServer) { + resolve() + return + } previewServer.httpServer.close((err) => { if (err) { reject(err) @@ -72,7 +80,7 @@ test.describe('html report', () => { // report const sample = page.getByTestId('details-panel').getByLabel('sample.test.ts') await sample.hover() - await sample.getByTestId('btn-open-details').click() + await sample.getByTestId('btn-open-details').click({ force: true }) await page.getByText('All tests passed in this file').click() // graph tab @@ -96,7 +104,7 @@ test.describe('html report', () => { await page.goto(pageUrl) const sample = page.getByTestId('details-panel').getByLabel('fixtures/error.test.ts') await sample.hover() - await sample.getByTestId('btn-open-details').click() + await sample.getByTestId('btn-open-details').click({ force: true }) await expect(page.getByTestId('diff')).toContainText('- Expected + Received + ') }) })