diff --git a/tests/auth-drafts-actions.spec.ts b/tests/auth-drafts-actions.spec.ts index 07c6a82e..679a4b18 100644 --- a/tests/auth-drafts-actions.spec.ts +++ b/tests/auth-drafts-actions.spec.ts @@ -2,6 +2,8 @@ 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 @@ -44,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 = 'https://localhost:3000' + const baseURL = `${baseHost}` 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 391de1c7..e801fe29 100644 --- a/tests/auth-topics-actions.spec.ts +++ b/tests/auth-topics-actions.spec.ts @@ -2,6 +2,8 @@ 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 @@ -44,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 = 'https://localhost:3000' + const baseURL = `${baseHost}` 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 e743c140..1e6a7b2d 100644 --- a/tests/auth-user-actions.spec.ts +++ b/tests/auth-user-actions.spec.ts @@ -2,6 +2,8 @@ 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 @@ -46,7 +48,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 = 'https://localhost:3000' + const baseURL = `${baseHost}` await waitForServer(baseURL) context = await browser.newContext() page = await context.newPage() diff --git a/tests/basic-routes.spec.ts b/tests/basic-routes.spec.ts deleted file mode 100644 index 421f715f..00000000 --- a/tests/basic-routes.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { expect, test } from '@playwright/test' - -const baseHost = process.env.BASE_HOST || 'https://localhost:3000' - -const pagesTitles: { [key: string]: RegExp } = { - '/': /Дискурс/, - '/feed': /Лента/, - '/edit/new': /Выберите тип публикации/, - '/guide/support': /Поддержите Дискурс/, - '/author': /Авторы/, - '/topic': /Темы и сюжеты/, - '/inbox': /Входящие/ -} - -Object.keys(pagesTitles).forEach((res: string) => { - test(`страница ${res}`, async ({ page }) => { - await page.goto(`${baseHost}${res}`) - const title = pagesTitles[res] - await expect(page).toHaveTitle(title) - }) -}) diff --git a/tests/basic-routes.test.js b/tests/basic-routes.test.js deleted file mode 100644 index 9880d3b0..00000000 --- a/tests/basic-routes.test.js +++ /dev/null @@ -1,37 +0,0 @@ -import { chromium } from 'playwright' -;(async () => { - const browser = await chromium.launch() - const context = await browser.newContext() - - // Define the URLs to visit - const pagesToVisit = [ - 'https://localhost:3000/', - 'https://localhost:3000/feed', - 'https://localhost:3000/edit/new', - 'https://localhost:3000/guide/support', - 'https://localhost:3000/author', - 'https://localhost:3000/topic', - 'https://localhost:3000/inbox' - ] - - // Loop through the pages and visit each one - for (const pageUrl of pagesToVisit) { - const page = await context.newPage() - - // Log a message before visiting the page - console.log(`Visiting page: ${pageUrl}`) - - await page.goto(pageUrl) - - // Add your test assertions here if needed - - // Log a message after visiting the page - console.log(`Finished visiting page: ${pageUrl}`) - - // Close the page before moving to the next one - await page.close() - } - - // Close the browser - await browser.close() -})() diff --git a/tests/page-sections.spec.ts b/tests/page-sections.spec.ts index 7401996b..4b4ebc2d 100644 --- a/tests/page-sections.spec.ts +++ b/tests/page-sections.spec.ts @@ -2,6 +2,8 @@ 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 @@ -44,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 = 'https://localhost:3000' + const baseURL = `${baseHost}` await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000)