-
-
Notifications
You must be signed in to change notification settings - Fork 132
fix(login): fill email and password in one prompt #3117
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
riderx
wants to merge
9
commits into
main
Choose a base branch
from
fix/login-password-manager-autofill
base: main
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
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2400b6c
fix(login): fill email and password in one prompt
riderx 316910e
chore(login): add one-form login screenshot
riderx c35b360
fix(login): satisfy eslint use-before-define
riderx 24d3bda
chore(login): add live screenshots for each login path
riderx 89a2d7e
fix(login): send SSO domains through SSO only
riderx ef338cb
fix(login): ignore stale SSO domain checks
riderx 1144a6b
fix(login): retry failed SSO checks
riderx 08db9fd
fix(login): hide password until domain is not SSO
riderx aca0228
fix(login): drop stale SSO email cache
riderx 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
|---|---|---|
| @@ -1,64 +1,65 @@ | ||
| import { expect, test } from '../support/commands' | ||
|
|
||
| test.describe('SSO Login Flow (Two-Step)', () => { | ||
| test.describe('SSO Login Flow', () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto('/login/') | ||
| }) | ||
|
|
||
| test('should show email step first (Step 1)', async ({ page }) => { | ||
| test('should show email only on first paint', async ({ page }) => { | ||
| await expect(page.locator('[data-test="email"]')).toBeVisible() | ||
| await expect(page.locator('[data-test="continue"]')).toBeVisible() | ||
|
|
||
| await expect(page.locator('[data-test="password"]')).not.toBeVisible() | ||
| await expect(page.locator('[data-test="submit"]')).not.toBeVisible() | ||
| await expect(page.locator('[data-test="submit"]')).toBeHidden() | ||
| await expect(page.locator('[data-test="sso-login"]')).toHaveCount(0) | ||
| await expect(page.locator('[data-test="password"]')).toHaveCount(1) | ||
| await expect(page.locator('[data-password-ready="false"]')).toHaveCount(1) | ||
| }) | ||
|
|
||
| test('should show password field for non-SSO domain after Continue (Step 2)', async ({ page }) => { | ||
| await page.fill('[data-test="email"]', 'test@example.com') | ||
| await page.click('[data-test="continue"]') | ||
| test('should reveal password for non-SSO domains', async ({ page }) => { | ||
| await page.route('**/private/sso/check-domain', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ has_sso: false }), | ||
| }) | ||
| }) | ||
|
|
||
| await expect(page.locator('[data-test="password"]')).toBeVisible({ timeout: 10000 }) | ||
| const domainCheck = page.waitForResponse(response => response.url().includes('/private/sso/check-domain')) | ||
| await page.fill('[data-test="email"]', 'test@example.com') | ||
| await domainCheck | ||
| await expect(page.locator('[data-password-ready="true"]')).toHaveCount(1) | ||
| await expect(page.locator('[data-test="password"]')).toBeVisible() | ||
| await expect(page.locator('[data-test="submit"]')).toBeVisible() | ||
|
|
||
| await expect(page.locator('[data-test="continue"]')).not.toBeVisible() | ||
| await expect(page.locator('[data-test="sso-login"]')).toHaveCount(0) | ||
| }) | ||
|
|
||
| test('should return to Step 1 when clicking Back from password step', async ({ page }) => { | ||
| await page.fill('[data-test="email"]', 'test@example.com') | ||
| await page.click('[data-test="continue"]') | ||
|
|
||
| await expect(page.locator('[data-test="password"]')).toBeVisible({ timeout: 10000 }) | ||
|
|
||
| await page.locator('[data-test="back-to-email"]').click() | ||
|
|
||
| await expect(page.locator('[data-test="email"]')).toBeVisible() | ||
| await expect(page.locator('[data-test="continue"]')).toBeVisible() | ||
| await expect(page.locator('[data-test="password"]')).not.toBeVisible() | ||
| test('should use SSO only when the domain has SSO', async ({ page }) => { | ||
| await page.route('**/private/sso/check-domain', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ has_sso: true, enforce_sso: false }), | ||
| }) | ||
| }) | ||
|
|
||
| await page.fill('[data-test="email"]', 'user@sso.example') | ||
| await expect(page.locator('[data-test="sso-login"]')).toBeVisible({ timeout: 10000 }) | ||
| await expect(page.locator('[data-password-ready="false"]')).toHaveCount(1) | ||
| await expect(page.locator('[data-test="submit"]')).toBeHidden() | ||
| }) | ||
|
riderx marked this conversation as resolved.
|
||
|
|
||
| test('should keep Back visible and tappable on mobile password step', async ({ page }) => { | ||
| test('should keep email editable on mobile when the domain has SSO', async ({ page }) => { | ||
| await page.setViewportSize({ width: 375, height: 667 }) | ||
| await page.route('**/private/sso/check-domain', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ has_sso: true }), | ||
| }) | ||
| }) | ||
|
|
||
| const longEmail = 'avery.long.email.address.with-many-segments@very-long-example-domain-for-mobile-testing.example.com' | ||
| await page.fill('[data-test="email"]', longEmail) | ||
| await page.click('[data-test="continue"]') | ||
|
|
||
| await expect(page.locator('[data-test="password"]')).toBeVisible({ timeout: 10000 }) | ||
|
|
||
| const backButton = page.locator('[data-test="back-to-email"]') | ||
| await expect(backButton).toBeVisible() | ||
|
|
||
| const selectedEmail = page.locator('[data-test="selected-email"]') | ||
| await expect(selectedEmail).toHaveText(longEmail) | ||
|
|
||
| const buttonBox = await backButton.boundingBox() | ||
| const emailBox = await selectedEmail.boundingBox() | ||
| expect(buttonBox?.height).toBeGreaterThanOrEqual(44) | ||
| expect(emailBox?.y).toBeGreaterThan((buttonBox?.y ?? 0) + (buttonBox?.height ?? 0)) | ||
| expect((emailBox?.x ?? 0) + (emailBox?.width ?? 0)).toBeLessThanOrEqual(375) | ||
| expect(emailBox?.height).toBeGreaterThan(32) | ||
|
|
||
| await backButton.click() | ||
| await expect(page.locator('[data-test="email"]')).toBeFocused() | ||
| await expect(page.locator('[data-test="sso-login"]')).toBeVisible({ timeout: 10000 }) | ||
| await expect(page.locator('[data-test="email"]')).toHaveValue(longEmail) | ||
| await expect(page.locator('[data-test="email"]')).toBeEditable() | ||
| }) | ||
| }) | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.