-
Notifications
You must be signed in to change notification settings - Fork 2k
E2E Auth: Add GitHub login test #103461
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
E2E Auth: Add GitHub login test #103461
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
1ec6db1
to
60fdb9b
Compare
|
||
it( 'Verify successful login to WordPress.com', async function () { | ||
// Verify we're on WordPress.com | ||
expect( page.url() ).toMatch( /.*wordpress\.com\/sites.*/ ); |
Check failure
Code scanning / CodeQL
Missing regular expression anchor
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the issue, we need to add anchors (^
and $
) to the regular expression to ensure it matches the entire URL and not just a substring. Specifically, the regular expression /.*wordpress\.com\/sites.*/
should be updated to /^https:\/\/.*wordpress\.com\/sites.*$/
. This ensures that the URL starts with https://
, contains the expected domain and path, and matches the entire string.
-
Copy modified line R61
@@ -60,3 +60,3 @@ | ||
// Verify we're on WordPress.com | ||
expect( page.url() ).toMatch( /.*wordpress\.com\/sites.*/ ); | ||
expect( page.url() ).toMatch( /^https:\/\/.*wordpress\.com\/sites.*$/ ); | ||
} ); |
Do we still plan to move this one forward @bogiii? |
We are experiencing an issue with a suspended GH testing account. I'll try one more potential solution. |
22d9001
to
8069b8c
Compare
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.
Works well. Left some suggestions, but no blockers!
packages/calypso-e2e/src/lib/pages/external/github-login-page.ts
Outdated
Show resolved
Hide resolved
packages/calypso-e2e/src/lib/pages/external/github-login-page.ts
Outdated
Show resolved
Hide resolved
packages/calypso-e2e/src/lib/pages/external/github-login-page.ts
Outdated
Show resolved
Hide resolved
* Clicks the "Continue with GitHub" link. | ||
*/ | ||
async clickLoginWithGitHub(): Promise< Locator > { | ||
const locator = await this.page.locator( ':text-is("Continue with GitHub")' ); |
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.
The same here. I believe we can use page.getBy*
matchers.
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.
The entire file needs updates and selector replacements. I just matched the same approach.
I'll leave it as it is for now, and we can replace it in a separate PR.
|
||
it( 'Handle GitHub device verification if needed', async function () { | ||
// GitHub may show a device verification screen in CI | ||
const verificationUrl = 'https://github.com/sessions/verified-device'; |
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.
I think we can extract this to a constant? No biggie though.
Part of https://linear.app/a8c/issue/DOTCOM-10590/fix-authentication-tests
Proposed Changes
Why are these changes being made?
Testing Instructions
yarn workspace wp-e2e-tests build
yarn workspace wp-e2e-tests test -- specs/authentication/authentication__github.ts
Pre-merge Checklist