From 8777c9595d9f89a4591ac7e5d4862b83bf183c5f Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Mon, 11 Mar 2024 22:16:21 +0100 Subject: [PATCH] Added github reporter. --- src/playwright.config.ts | 9 +++++++-- .../frontend-new/specs/embed_value.spec.ts | 18 ++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/playwright.config.ts b/src/playwright.config.ts index c820c7e1a..20b0361ba 100644 --- a/src/playwright.config.ts +++ b/src/playwright.config.ts @@ -1,17 +1,21 @@ import {defineConfig, devices, test} from '@playwright/test'; +export const defaultExpectTimeout = process.env.CI ? 20 * 1000 : 5000 +export const defaultTestTimeout = 90 * 1000 + /** * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ testDir: './tests/frontend-new/', - timeout: 90000, /* Run tests in files in parallel */ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: process.env.CI ? 'github' : 'html', + expect: { timeout: defaultExpectTimeout }, + timeout: defaultTestTimeout, retries: 2, workers: 20, /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ @@ -21,6 +25,7 @@ export default defineConfig({ baseURL: "localhost:9001", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', + video: 'on-first-retry', }, /* Configure projects for major browsers */ diff --git a/src/tests/frontend-new/specs/embed_value.spec.ts b/src/tests/frontend-new/specs/embed_value.spec.ts index 14e380a55..674e001d1 100644 --- a/src/tests/frontend-new/specs/embed_value.spec.ts +++ b/src/tests/frontend-new/specs/embed_value.spec.ts @@ -63,8 +63,7 @@ test.describe('embed links', function () { // create a new pad before each test run await goToNewPad(page); }) - test.describe('the share link', function () { - test('is the actual pad url', async function ({page}) { + test('the share link is the actual pad url', async function ({page}) { const shareButton = page.locator('.buttonicon-embed') // open share dropdown @@ -75,10 +74,8 @@ test.describe('embed links', function () { const padURL = page.url(); expect(shareLink).toBe(padURL); }); - }); - test.describe('the embed as iframe code', function () { - test('is an iframe with the the correct url parameters and correct size', async function ({page}) { + test('is an iframe with the the correct url parameters and correct size', async function ({page}) { const shareButton = page.locator('.buttonicon-embed') await shareButton.click() @@ -89,7 +86,6 @@ test.describe('embed links', function () { await checkiFrameCode(embedCode, false, page); }); - }); }); test.describe('when read only option is set', function () { @@ -98,8 +94,7 @@ test.describe('embed links', function () { await goToNewPad(page); }) - test.describe('the share link', function () { - test('shows a read only url', async function ({page}) { + test('the share link shows a read only url', async function ({page}) { // open share dropdown const shareButton = page.locator('.buttonicon-embed') @@ -115,10 +110,8 @@ test.describe('embed links', function () { const containsReadOnlyLink = shareLink.indexOf('r.') > 0; expect(containsReadOnlyLink).toBe(true); }); - }); - test.describe('the embed as iframe code', function () { - test('is an iframe with the the correct url parameters and correct size', async function ({page}) { + test('the embed as iframe code is an iframe with the the correct url parameters and correct size', async function ({page}) { // open share dropdown @@ -139,8 +132,5 @@ test.describe('embed links', function () { await checkiFrameCode(embedCode, true, page); }); - }); - }) - })