diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 4729e632..5e819c27 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -26,9 +26,13 @@ jobs: run: npm run build e2e_tests: - if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' + needs: ci runs-on: ubuntu-latest steps: + - name: Debug event info + run: | + echo "Event Name: ${{ github.event_name }}" + echo "Deployment Status: ${{ github.event.deployment_status.state }}" - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: diff --git a/README.md b/README.md index 81599367..d45e61c2 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,18 @@ If workers is no needed use: - `npx playwright test --project=webkit --workers 4` For more information on how to write tests using Playwright - [Playwright documentation](https://playwright.dev/docs/intro). + +## 🚀 Tests in CI Mode + +Tests are executed within a GitHub workflow. We organize our tests into two main directories: + +- `tests`: Contains tests that do not require authentication. +- `tests-with-auth`: Houses tests that interact with authenticated parts of the application. + +🔧 **Configuration:** + +Playwright is configured to utilize the `BASE_URL` environment variable. Ensure this is properly set in your CI configuration to point to the correct environment. + +📝 **Note:** + +After pages have been adjusted to work with authentication, all tests should be moved to the `tests` directory to streamline the testing process. diff --git a/playwright.config.ts b/playwright.config.ts index 3d8bb816..b3bf954d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: 'https://localhost:3000', + baseURL: process.env.BASE_URL || 'https://localhost:3000', /* Headless */ headless: true, /* Ignode SSL certificates */ diff --git a/tests/auth-topics-actions.spec.ts b/tests-with-auth/2-auth-topics-actions.spec.ts similarity index 99% rename from tests/auth-topics-actions.spec.ts rename to tests-with-auth/2-auth-topics-actions.spec.ts index f94e16cd..29f03204 100644 --- a/tests/auth-topics-actions.spec.ts +++ b/tests-with-auth/2-auth-topics-actions.spec.ts @@ -45,6 +45,7 @@ test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) const baseURL = process.env.BASE_URL || 'https://localhost:3000' + console.log('Base URL:', baseURL) await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000) diff --git a/tests/auth-drafts-actions.spec.ts b/tests-with-auth/3-auth-drafts-actions.spec.ts similarity index 99% rename from tests/auth-drafts-actions.spec.ts rename to tests-with-auth/3-auth-drafts-actions.spec.ts index 4c804d4a..650cdab8 100644 --- a/tests/auth-drafts-actions.spec.ts +++ b/tests-with-auth/3-auth-drafts-actions.spec.ts @@ -45,6 +45,7 @@ test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) const baseURL = process.env.BASE_URL || 'https://localhost:3000' + console.log('Base URL:', baseURL) await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000) diff --git a/tests/auth-user-actions.spec.ts b/tests-with-auth/4-auth-user-actions.spec.ts similarity index 99% rename from tests/auth-user-actions.spec.ts rename to tests-with-auth/4-auth-user-actions.spec.ts index 9323519e..11f5a5a6 100644 --- a/tests/auth-user-actions.spec.ts +++ b/tests-with-auth/4-auth-user-actions.spec.ts @@ -47,6 +47,7 @@ test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) const baseURL = process.env.BASE_URL || 'https://localhost:3000' + console.log('Base URL:', baseURL) await waitForServer(baseURL) context = await browser.newContext() page = await context.newPage() diff --git a/tests-with-auth/readme.txt b/tests-with-auth/readme.txt new file mode 100644 index 00000000..02a91b29 --- /dev/null +++ b/tests-with-auth/readme.txt @@ -0,0 +1 @@ +This is folder with Playwright tests, that are needed to move in /tests dir for wrking on playwright circle \ No newline at end of file diff --git a/tests/page-sections.spec.ts b/tests/1-page-sections.spec.ts similarity index 98% rename from tests/page-sections.spec.ts rename to tests/1-page-sections.spec.ts index f3c36901..8f51104b 100644 --- a/tests/page-sections.spec.ts +++ b/tests/1-page-sections.spec.ts @@ -45,6 +45,7 @@ test.beforeAll(async ({ browser }) => { console.log('Waiting for the server to start...') await new Promise((resolve) => setTimeout(resolve, 5000)) const baseURL = process.env.BASE_URL || 'https://localhost:3000' + console.log('Base URL:', baseURL) await waitForServer(baseURL) page = await browser.newPage() test.setTimeout(150000)