forked from jitsi/jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 1
Add Playwright test for New meeting creation flow #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ValentynaBlahodyrQA
wants to merge
1
commit into
PB-5574-Automate-basic-meeting-creation
Choose a base branch
from
PB-5575-Automate-meeting-creation
base: PB-5574-Automate-basic-meeting-creation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { expect, Locator } from '@playwright/test'; | ||
|
|
||
| const DEBUG = process.env.DEBUG_TESTS === 'true'; | ||
|
|
||
| function parseTimer(value: string): number { | ||
| const [minutes, seconds] = value.split(':').map(Number); | ||
| return minutes * 60 + seconds; | ||
| } | ||
|
|
||
| export async function expectTimerToIncrease(timer: Locator) { | ||
| await expect(timer).toBeVisible(); | ||
|
|
||
| const firstText = (await timer.textContent())?.trim() ?? ''; | ||
| expect(firstText).toMatch(/^\d{1,2}:\d{2}$/); | ||
|
|
||
| const firstSeconds = parseTimer(firstText); | ||
|
|
||
| // wait until timer changes | ||
| await expect(timer).not.toHaveText(firstText, { timeout: 5000 }); | ||
|
|
||
| const secondText = (await timer.textContent())?.trim() ?? ''; | ||
| expect(secondText).toMatch(/^\d{1,2}:\d{2}$/); | ||
|
|
||
| const secondSeconds = parseTimer(secondText); | ||
|
|
||
| expect( | ||
| secondSeconds, | ||
| `Timer should increase. First: ${firstText}, Second: ${secondText}` | ||
| ).toBeGreaterThan(firstSeconds); | ||
| } | ||
|
|
||
| export async function expectTimerRunning(timer: Locator, checks = 3) { | ||
| await expect(timer).toBeVisible(); | ||
|
|
||
| let previous = 0; | ||
|
|
||
| for (let i = 0; i < checks; i++) { | ||
| const value = (await timer.textContent())?.trim() ?? ''; | ||
| if (DEBUG) console.log(`Timer check ${i}:`, value); | ||
|
|
||
| expect(value).toMatch(/^\d{1,2}:\d{2}$/); | ||
|
|
||
| const seconds = parseTimer(value); | ||
|
|
||
| if (i > 0) { | ||
| expect( | ||
| seconds, | ||
| `Timer should keep running. Previous: ${previous}, Current: ${seconds}` | ||
| ).toBeGreaterThanOrEqual(previous); | ||
| } | ||
|
|
||
| previous = seconds; | ||
|
|
||
| await timer.page().waitForTimeout(1000); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
| import { login } from '../helpers/auth'; | ||
| import { MeetHomePage } from '../pages/meet-home-page'; | ||
| import { expectTimerToIncrease, expectTimerRunning } from '../helpers/timer'; | ||
|
|
||
| const ultimateEmail = process.env.PLAYWRIGHT_ULTIMATE_EMAIL!; | ||
| const ultimatePassword = process.env.PLAYWRIGHT_ULTIMATE_PASSWORD!; | ||
| const ultimateName = process.env.PLAYWRIGHT_ULTIMATE_NAME!; | ||
| expect(ultimateName).toBeTruthy(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are this expect here? |
||
|
|
||
|
|
||
| test.beforeAll(() => { | ||
| expect(ultimateEmail).toBeTruthy(); | ||
| expect(ultimatePassword).toBeTruthy(); | ||
| expect(ultimateName).toBeTruthy(); | ||
| }); | ||
|
|
||
| test('Ultimate user can create a meeting', async ({ page }) => { | ||
| const meetHome = new MeetHomePage(page); | ||
|
|
||
| await test.step('GIVEN Ultimate user is authenticated', async () => { | ||
| await login(page, ultimateEmail, ultimatePassword); | ||
| }); | ||
|
|
||
| await test.step('WHEN user clicks New meeting', async () => { | ||
| await meetHome.expectUserLoggedIn(); | ||
| await meetHome.expectNewMeetingVisible(); | ||
| await meetHome.newMeetingButton.click(); | ||
| }); | ||
|
|
||
| await test.step('THEN prejoin modal is displayed ', async () => { | ||
| await expect(page.getByText('Your meeting is private')).toBeVisible(); | ||
| await expect(page.getByRole('textbox', { name: /enter your name/i })).toHaveValue(ultimateName); | ||
| await expect(page.getByText('Up to 5 participants')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('WHEN user confirms meeting creation', async () => { | ||
| // TODO: temporary workaround nth(1)— UI currently renders two "New Meeting" buttons. Should be one. | ||
| const newMeetingButtons = page.getByRole('button', { name: 'New Meeting' }); | ||
| await expect(newMeetingButtons).toHaveCount(2); | ||
| await newMeetingButtons.nth(1).click(); | ||
| }); | ||
|
|
||
| await test.step('THEN moderator message appears briefly', async () => { | ||
| const moderatorToast = page.getByText(/you're now a moderator/i); | ||
|
|
||
| await expect(moderatorToast).toBeVisible({ timeout: 5000 }); | ||
| await expect(moderatorToast).toBeHidden({ timeout: 5000 }); | ||
| }); | ||
|
|
||
| await test.step('AND meeting UI is visible', async () => { | ||
| await expect(page).toHaveURL(/meet\.internxt\.com\/[0-9a-fA-F-]{36}/); | ||
| await expect(page.getByRole('status')).toBeVisible(); | ||
| await expect(page.getByRole('button', { name: 'Gallery' })).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('AND timer is visible', async () => { | ||
| const timer = page.locator('text=/^\\d{1,2}:\\d{2}$/').first(); | ||
| await expect(timer).toBeVisible(); | ||
|
|
||
| await expectTimerToIncrease(timer); | ||
| await expectTimerRunning(timer); | ||
| }); | ||
|
|
||
| await test.step('AND meeting controls are visible', async () => { | ||
| const defaultControls = page.locator('[data-circle-button="default"]'); | ||
| const leaveControl = page.locator('[data-circle-button="cancel"]'); | ||
|
|
||
|
Comment on lines
+32
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Check the code indentation |
||
| // TODO: temporary workaround until stable data-testid attributes are added | ||
| await expect(defaultControls).toHaveCount(5); | ||
| await expect(leaveControl).toHaveCount(1); | ||
| }); | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong identation