From 1cac091a1ce2f111b7c705426b9c3ced5a2948d9 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Thu, 4 Jul 2024 01:11:10 +0000 Subject: [PATCH] style: refactor tests code to make it clean. But maybe this is can solve the problem in 404 --- tests/auth-drafts-actions.spec.ts | 4 +--- tests/auth-topics-actions.spec.ts | 4 +--- tests/auth-user-actions.spec.ts | 4 +--- tests/page-sections.spec.ts | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/auth-drafts-actions.spec.ts b/tests/auth-drafts-actions.spec.ts index 679a4b18..4c804d4a 100644 --- a/tests/auth-drafts-actions.spec.ts +++ b/tests/auth-drafts-actions.spec.ts @@ -2,8 +2,6 @@ import https from 'node:https' import { type Page, expect, test } from '@playwright/test' -const baseHost = process.env.BASE_URL || 'https://localhost:3000' - /* Global starting test config */ let page: Page @@ -46,7 +44,7 @@ async function waitForServer(url: string, timeout = 150000) { test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) - const baseURL = `${baseHost}` + const baseURL = process.env.BASE_URL || 'https://localhost:3000' await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000) diff --git a/tests/auth-topics-actions.spec.ts b/tests/auth-topics-actions.spec.ts index e801fe29..f94e16cd 100644 --- a/tests/auth-topics-actions.spec.ts +++ b/tests/auth-topics-actions.spec.ts @@ -2,8 +2,6 @@ import https from 'node:https' import { type Page, expect, test } from '@playwright/test' -const baseHost = process.env.BASE_URL || 'https://localhost:3000' - /* Global starting test config */ let page: Page @@ -46,7 +44,7 @@ async function waitForServer(url: string, timeout = 150000) { test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) - const baseURL = `${baseHost}` + const baseURL = process.env.BASE_URL || 'https://localhost:3000' await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000) diff --git a/tests/auth-user-actions.spec.ts b/tests/auth-user-actions.spec.ts index 1e6a7b2d..9323519e 100644 --- a/tests/auth-user-actions.spec.ts +++ b/tests/auth-user-actions.spec.ts @@ -2,8 +2,6 @@ import https from 'node:https' import { type Page, expect, test } from '@playwright/test' -const baseHost = process.env.BASE_URL || 'https://localhost:3000' - // biome-ignore lint/suspicious/noExplicitAny: let context: any let page: Page @@ -48,7 +46,7 @@ async function waitForServer(url: string, timeout = 150000) { test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) - const baseURL = `${baseHost}` + const baseURL = process.env.BASE_URL || 'https://localhost:3000' await waitForServer(baseURL) context = await browser.newContext() page = await context.newPage() diff --git a/tests/page-sections.spec.ts b/tests/page-sections.spec.ts index 4b4ebc2d..e90a4bb2 100644 --- a/tests/page-sections.spec.ts +++ b/tests/page-sections.spec.ts @@ -46,7 +46,7 @@ async function waitForServer(url: string, timeout = 150000) { test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) - const baseURL = `${baseHost}` + const baseURL = process.env.BASE_URL || 'https://localhost:3000' await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000)