From b7c27a4a5a308ef59faf4a4b9308890755b9b7d6 Mon Sep 17 00:00:00 2001 From: ValentynaBlahodyrQA Date: Fri, 13 Mar 2026 11:46:24 +0100 Subject: [PATCH 1/3] Add Playwright login and logout tests for Meet --- .gitignore | 1 + playwright.config.ts | 8 +++- playwright/helpers/auth.ts | 60 +++++++++++++++++++++++++++ playwright/tests/login-logout.spec.ts | 39 +++++++++++++++++ 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 playwright/helpers/auth.ts create mode 100644 playwright/tests/login-logout.spec.ts diff --git a/.gitignore b/.gitignore index 747e9fd0e232..cef8d10c56f3 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,4 @@ react-native-sdk/sounds tests/.env test-results +.env.playwright diff --git a/playwright.config.ts b/playwright.config.ts index 6c9c8935c58c..04a4dccda490 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,11 +1,15 @@ +import * as dotenv from 'dotenv'; +dotenv.config({ path: '.env.playwright' }); + import { defineConfig } from '@playwright/test'; + export default defineConfig({ testDir: './playwright/tests', timeout: 60_000, expect: { timeout: 10_000 }, use: { - baseURL: 'https://localhost:8080', + baseURL: 'https://meet.internxt.com/', ignoreHTTPSErrors: true, trace: 'on-first-retry', screenshot: 'only-on-failure', @@ -14,4 +18,4 @@ export default defineConfig({ projects: [ { name: 'chromium', use: { browserName: 'chromium' } }, ], -}); +}); \ No newline at end of file diff --git a/playwright/helpers/auth.ts b/playwright/helpers/auth.ts new file mode 100644 index 000000000000..cdc1c776df1e --- /dev/null +++ b/playwright/helpers/auth.ts @@ -0,0 +1,60 @@ +import { expect, Page } from '@playwright/test'; +import 'dotenv/config'; + +export async function login(page: Page, email: string, password: string) { + await page.goto('/'); + + await page.getByRole('button', { name: 'Log in' }).click(); + + const popupPromise = page.waitForEvent('popup'); + await page.getByRole('button', { name: 'Sign in with Internxt' }).click(); + const popup = await popupPromise; + + const emailField = popup.locator('[data-cy="emailInput"]'); + const passField = popup.locator('[data-cy="passwordInput"]'); + const submitLoginButton = popup.locator('[data-cy="loginButton"]'); + + await expect(emailField).toBeVisible({ timeout: 15_000 }); + await emailField.fill(email); + + await expect(passField).toBeVisible({ timeout: 15_000 }); + await passField.fill(password); + + await expect(submitLoginButton).toBeVisible({ timeout: 15_000 }); + await submitLoginButton.click(); + + await Promise.race([ + popup.waitForEvent('close').catch(() => {}), + popup.waitForLoadState('networkidle').catch(() => {}), + ]); + + if (!popup.isClosed()) { + await popup.close().catch(() => {}); + } + + await expect(page.locator('button img.rounded-full').first()).toBeVisible({ timeout: 20_000 }); +} + +export async function expectLoggedIn(page: Page, email: string) { + const avatarButton = page.locator('button img.rounded-full').first(); + + await expect(avatarButton).toBeVisible({ timeout: 20_000 }); + await avatarButton.click(); + + const userMenu = page.locator('div.flex.items-center.p-3'); + await expect(userMenu).toContainText(email); + + // close menu so next step starts from a clean state + await avatarButton.click(); +} + +export async function logout(page: Page) { + const avatarButton = page.locator('button img.rounded-full').first(); + const logoutButton = page.getByRole('button', { name: /log out|logout|sign out/i }); + + await expect(avatarButton).toBeVisible({ timeout: 20_000 }); + await avatarButton.click(); + + await expect(logoutButton).toBeVisible({ timeout: 10_000 }); + await logoutButton.click(); +} \ No newline at end of file diff --git a/playwright/tests/login-logout.spec.ts b/playwright/tests/login-logout.spec.ts new file mode 100644 index 000000000000..d894eb859292 --- /dev/null +++ b/playwright/tests/login-logout.spec.ts @@ -0,0 +1,39 @@ +import { test, expect } from '@playwright/test'; +import { login, expectLoggedIn, logout } from '../helpers/auth'; + +const email = process.env.PLAYWRIGHT_ULTIMATE_EMAIL!; +const password = process.env.PLAYWRIGHT_ULTIMATE_PASSWORD!; + +test.beforeAll(() => { + expect(email).toBeTruthy(); + expect(password).toBeTruthy(); +}); + +test('User can log in', async ({ page }) => { + + await test.step('GIVEN user logs in via Internxt', async () => { + await login(page, email, password); + }); + + await test.step('THEN user is authenticated', async () => { + await expectLoggedIn(page, email); + }); + +}); + + +test('User can log out', async ({ page }) => { + + await test.step('GIVEN user is logged in', async () => { + await login(page, email, password); + }); + + await test.step('WHEN user logs out', async () => { + await logout(page); + }); + + await test.step('THEN user is logged out', async () => { + await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible(); + }); + +}); \ No newline at end of file From 2795ec8da58bc87709cbbd0fe30f3022fc4cef36 Mon Sep 17 00:00:00 2001 From: ValentynaBlahodyrQA Date: Mon, 16 Mar 2026 17:19:11 +0100 Subject: [PATCH 2/3] Add .env.playwright.example template for Playwright env variables --- .env.playwright.example | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .env.playwright.example diff --git a/.env.playwright.example b/.env.playwright.example new file mode 100644 index 000000000000..abecdcdd3cb2 --- /dev/null +++ b/.env.playwright.example @@ -0,0 +1,4 @@ +PLAYWRIGHT_BASE_URL=https://meet.internxt.com +PLAYWRIGHT_ULTIMATE_EMAIL=your-test-email@example.com +PLAYWRIGHT_ULTIMATE_PASSWORD=your-test-password +PLAYWRIGHT_ULTIMATE_NAME=Name \ No newline at end of file From 7f1d20d710c4cf92655259ce197d8f1766f08881 Mon Sep 17 00:00:00 2001 From: ValentynaBlahodyrQA Date: Mon, 16 Mar 2026 17:42:08 +0100 Subject: [PATCH 3/3] Add Playwright README with instructions for running tests --- playwright/readme.md | 75 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 playwright/readme.md diff --git a/playwright/readme.md b/playwright/readme.md new file mode 100644 index 000000000000..c04148603a4c --- /dev/null +++ b/playwright/readme.md @@ -0,0 +1,75 @@ +# Playwright Tests – Internxt Meet + +This folder contains end-to-end (E2E) tests for **Internxt Meet** using **Playwright**. + + +--- +# Prerequisites + +Make sure you have installed: + +- Node.js +- Yarn +--- +# Install dependencies + +Install project dependencies: + +`yarn install` + +--- +# Install Playwright browsers: + +`npx playwright install` + +# Environment configuration + +Tests require environment variables. + +Create a local environment file from the example template: + +`cp .env.playwright.example .env.playwright` + +Then update the values in **.env.playwright** with valid credentials. + + +# Running tests + +Run all tests: + +`npx playwright test` + +Run a specific test file: + +`npx playwright test playwright/tests/specific_test.spec.ts` + +Run tests in UI mode: + +`npx playwright test --ui` + +# Debugging tests + +Run tests with Playwright debugger: + +`npx playwright test --debug` + +# Test reports + +After running tests, open the Playwright report: + +`npx playwright show-report` + +# Project structure +playwright/ + ├── helpers/ # reusable helper functions + ├── pages/ # page objects + ├── tests/ # test specifications + └── readme.md # documentation for Playwright tests + +# Notes + +Environment variables are loaded from **.env.playwright.** + +**.env.playwright.example** provides a template for required variables. + +**.env.playwright** should not be committed to the repository. \ No newline at end of file