fix(tooling): remove wdio & upgrade meeting widget to playwright#628
fix(tooling): remove wdio & upgrade meeting widget to playwright#628Riteshfyi wants to merge 18 commits intowebex:nextfrom
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52c36927e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
packages/@webex/widgets/package.json
Outdated
| "release:dry-run": "semantic-release --dry-run", | ||
| "start": "npm run demo:serve", | ||
| "test:e2e": "npm run demo:build && wdio wdio.conf.js", | ||
| "test:e2e": "npm run demo:build && yarn playwright test --project='Meetings Setup' --project='Meetings Widget Test'", |
There was a problem hiding this comment.
Use the configured setup project name in test:e2e
test:e2e invokes Playwright with --project='Meetings Setup', but the setup project defined in playwright.config.ts is named OAuth: Get Meeting Access Token (line 76). Since Playwright resolves --project by exact project name, this command fails before tests run, which means the e2e_test_meetings workflow path (.github/workflows/pull-request.yml, Test E2E) cannot execute the migrated meetings suite.
Useful? React with 👍 / 👎.
| this.unmuteAudioBtn = this.controls.getByRole('button', {name: 'Unmute'}); | ||
| this.muteVideoBtn = this.controls.getByRole('button', {name: 'Stop video'}); | ||
| this.unmuteVideoBtn = this.controls.getByRole('button', {name: 'Start video'}); | ||
| this.joinMeetingBtn = this.controls.getByRole('button', {name: /^(Muted, video off|Unmuted, video on)$/}); |
There was a problem hiding this comment.
Match the join button’s actual accessible name
The new locator only matches a button named /^(Muted, video off|Unmuted, video on)$/, but the meeting widget code still identifies the pre-join control as button[aria-label="Join meeting"] (packages/@webex/widgets/src/widgets/WebexMeetings/WebexMeetings.jsx), and the prior E2E test also targeted “Join meeting”; in that pre-join state joinMeetingBtn.click() in both suites cannot resolve an element, so the tests fail before joining.
Useful? React with 👍 / 👎.
Shreyas281299
left a comment
There was a problem hiding this comment.
Thanks for this upgrade. Changes look good. Lets just ensure that the checks are passing.
And what about the credentials?
|
Will Move these Changes to a feature branch, before we migrate the meeting widgets to latest version of our Webex |
| "release:dry-run": "semantic-release --dry-run", | ||
| "start": "npm run demo:serve", | ||
| "test:e2e": "npm run demo:build && wdio wdio.conf.js", | ||
| "test:e2e": "npm run demo:build && yarn playwright test --config=../../../playwright.config.ts --project='Meetings Widget Test'", |
There was a problem hiding this comment.
- Why are we using both npm and yarn ? Let's use a single package manager
- Do we have to provide the config path ? Is there a way we can use the default path and keep the command to minimum ?
- Can we also rename the folder from
widgetstomeetings-widgetsor justmeetings? NOT IN THE SCOPE OF THIS PR
| @@ -0,0 +1,31 @@ | |||
| import {Page, Locator, expect} from '@playwright/test'; | |||
|
|
|||
| const TEST_URL = 'https://localhost:9000/'; | |||
There was a problem hiding this comment.
- Should we move this to a constant or config file ?
- Will it work in the pipeline ? Maybe this value can come from env variable
| import { test, expect } from '@playwright/test'; | ||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
| import { SamplesPage } from './pages/SamplesPage'; | ||
| import { MeetingWidgetPage } from './pages/MeetingWidgetPage'; | ||
| import dotenv from 'dotenv'; |
There was a problem hiding this comment.
nitpick: Let's re-arrange the imports. Please check other files for reference
| // Re-read .env fresh so we pick up the token written by Meetings Setup | ||
| const envPath = path.resolve(__dirname, '../../.env'); | ||
| const envConfig = dotenv.parse(fs.readFileSync(envPath)); | ||
| for (const key in envConfig) { | ||
| process.env[key] = envConfig[key]; | ||
| } |
There was a problem hiding this comment.
Why do we need to do this? We are calling the dotenv.config() at the top. Please verify if it's require
There was a problem hiding this comment.
Playwright test files were reading older environment variable values. For example, after OAuth, the tests were reading an empty string instead of the newly written access token. To address this issue, this change has been made.
| test.describe('Meeting Widget', () => { | ||
| let samplesPage: SamplesPage; | ||
| let meetingPage: MeetingWidgetPage; | ||
| let accessToken: string; |
There was a problem hiding this comment.
Are we changing the value of accessToken anywhere? If not, this can be const and value can be assigned here itself from the env variable
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
nitpick: remove unnecessary newlines.
Applicable everywhere in this file
| const envPath = path.resolve(__dirname, '../.env'); | ||
| let envContent = ''; | ||
| if (fs.existsSync(envPath)) { | ||
| envContent = fs.readFileSync(envPath, 'utf8'); | ||
| } | ||
|
|
||
|
|
||
| const tokenPattern = /^PW_MEETING_ACCESS_TOKEN=.*$/m; | ||
| if (tokenPattern.test(envContent)) { | ||
| envContent = envContent.replace(tokenPattern, `PW_MEETING_ACCESS_TOKEN=${accessToken}`); | ||
| } else { | ||
| if (!envContent.endsWith('\n') && envContent.length > 0) envContent += '\n'; | ||
| envContent += `PW_MEETING_ACCESS_TOKEN=${accessToken}\n`; | ||
| } | ||
|
|
||
| fs.writeFileSync(envPath, envContent, 'utf8'); | ||
| console.log('Access token written to .env'); | ||
| }); |
There was a problem hiding this comment.
Why do we have to do all this if we are using dotenv package ?
| const e2eConfig = [ | ||
| `--disable-site-isolation-trials`, | ||
| `--disable-web-security`, | ||
| `--no-sandbox`, | ||
| `--disable-features=WebRtcHideLocalIpsWithMdns`, | ||
| `--allow-file-access-from-files`, | ||
| `--use-fake-ui-for-media-stream`, | ||
| `--use-fake-device-for-media-stream`, | ||
| `--use-file-for-fake-audio-capture=${dummyAudioPath}`, | ||
| `--disable-extensions`, | ||
| `--disable-plugins`, | ||
| `--window-size=1280,720`, | ||
| ]; |
There was a problem hiding this comment.
Let's add a comment at the end of each config for what they are being used
| webServer: [ | ||
| { | ||
| command: 'yarn workspace samples-cc-react-app serve', | ||
| url: 'http://localhost:3000', |
There was a problem hiding this comment.
This can come from constant or cofing file.
Applicable everywhere in this file
| }, | ||
| webServer: [ | ||
| { | ||
| command: 'yarn workspace samples-cc-react-app serve', |
There was a problem hiding this comment.
Let's ensure we are using either npm or yarn throughout the codebase
COMPLETES #https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-772628
This pull request addresses
Removes Wdio E2E Tests & moves to playwright for meetings widget.
by making the following changes
converting previous tests to typescrip & updating them for palywright
VIDCAST
https://app.vidcast.io/share/efc89d9a-211e-4130-a602-e326ac9f3b43
Change Type
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.