From ce4f8b7147180dc9ef235bb20d97f74245d74852 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 4 Feb 2024 14:49:55 +0300 Subject: [PATCH] e2e-fix --- .gitea/workflows/main.yml | 12 ++++----- ...c-routes.test.js => basic-routes.test.сjs} | 27 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) rename test/{basic-routes.test.js => basic-routes.test.сjs} (54%) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index f853a18c..09a23df1 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -12,18 +12,18 @@ jobs: - name: Install dependencies run: npm ci - - name: Lint styles - run: npm run lint:styles - - - name: Check types - run: npm run typecheck - - name: Install Biome run: npm install --global --save-exact @biomejs/biome - name: Lint with Biome run: npx biome ci . + - name: Lint styles + run: npm run lint:styles + + - name: Check types + run: npm run typecheck + Playwright: name: Run end-to-end tests runs-on: ubuntu-latest diff --git a/test/basic-routes.test.js b/test/basic-routes.test.сjs similarity index 54% rename from test/basic-routes.test.js rename to test/basic-routes.test.сjs index 0b3f042e..52eb41a2 100644 --- a/test/basic-routes.test.js +++ b/test/basic-routes.test.сjs @@ -1,10 +1,8 @@ -// test/discoursio-webapp.check.js - -const { chromium } = require('playwright') +const { chromium } = require('playwright'); ;(async () => { - const browser = await chromium.launch() - const context = await browser.newContext() + const browser = await chromium.launch(); + const context = await browser.newContext(); // Define the URLs to visit const pagesToVisit = [ @@ -15,19 +13,26 @@ const { chromium } = require('playwright') 'http://localhost:3000/authors', 'http://localhost:3000/topics', 'http://localhost:3000/inbox', - ] + ]; // Loop through the pages and visit each one for (const pageUrl of pagesToVisit) { - const page = await context.newPage() - await page.goto(pageUrl) + 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() + await page.close(); } // Close the browser - await browser.close() -})() + await browser.close(); +})();