-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web): Stabilize PW E2E (#5656)
* chore(web): Stabilize team-members E2E * chore(web): Do not throw an error on empty feature flags in PW * chore(root): Increase the number of retries Try once more for flaky tests * chore(web): Stabilize e2e for API Keys page * Simplify blueprint mock data for E2E * Apply better naming to test utility function * Consolidate Activity Feed page specs * Remove the TODO - prefix in skipped E2E specs * Polish Playwright tests for the invitation flow * Skip one more flaky test
- Loading branch information
1 parent
68ffbb4
commit 454b10c
Showing
15 changed files
with
63 additions
and
403 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -4,10 +4,11 @@ import { AuthLoginPage } from './page-models/authLoginPage'; | |
import { HeaderPage } from './page-models/headerPage'; | ||
import { SidebarPage } from './page-models/sidebarPage'; | ||
import { SignUpPage } from './page-models/signupPage'; | ||
import { validateTokenNotExisting } from './utils.ts/authUtils'; | ||
import { initializeSession } from './utils.ts/browser'; | ||
import { logout } from './utils.ts/commands'; | ||
import { clearDatabase, inviteUser, SessionData } from './utils.ts/plugins'; | ||
import { dropDatabase, inviteUser, SessionData } from './utils.ts/plugins'; | ||
|
||
test.describe.configure({ mode: 'serial' }); | ||
|
||
export const TestUserConstants = { | ||
Email: '[email protected]', | ||
|
@@ -17,7 +18,7 @@ export const TestUserConstants = { | |
let session: SessionData; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await clearDatabase(); | ||
await dropDatabase(); | ||
const { featureFlagsMock, session: newSession } = await initializeSession(page); | ||
session = newSession; | ||
featureFlagsMock.setFlagsToMock({ | ||
|
@@ -30,21 +31,21 @@ test.beforeEach(async ({ page }) => { | |
}); | ||
}); | ||
|
||
test('should accept invite to organization', async ({ context, page }) => { | ||
test('invite a new user to the organization', async ({ context, page }) => { | ||
const newSession = await inviteUser(session, TestUserConstants.Email); | ||
await logout(page, session); | ||
await doRegisterFromInvite(page, newSession.token); | ||
await registerFromInvitation(page, newSession.token); | ||
|
||
const headerPage = await HeaderPage.goTo(page); | ||
await headerPage.clickAvatar(); | ||
const orgName = headerPage.getOrganizationName(); | ||
expect(orgName).toContainText(newSession.organization.name, { ignoreCase: true }); | ||
}); | ||
|
||
test.skip('TODO - should allow to login if invited new user', async ({ context, page }) => { | ||
test('invite an existing user to the organization', async ({ context, page }) => { | ||
const newUserOne = await inviteUser(session, TestUserConstants.Email); | ||
await logout(page, session); | ||
await doRegisterFromInvite(page, newUserOne.token); | ||
await registerFromInvitation(page, newUserOne.token); | ||
|
||
const { session: newSession } = await initializeSession(page, { | ||
overrideSessionOptions: { page, singleTokenInjection: true }, | ||
|
@@ -65,42 +66,7 @@ test.skip('TODO - should allow to login if invited new user', async ({ context, | |
await expect(orgOptions).toBeVisible(); | ||
}); | ||
|
||
test.skip('TODO - should also accept invite if already logged in with right user', async ({ context, page }) => { | ||
const newUserOne = await inviteUser(session, TestUserConstants.Email); | ||
await logout(page, session); | ||
await doRegisterFromInvite(page, newUserOne.token); | ||
|
||
const { session: newSession } = await initializeSession(page, { | ||
overrideSessionOptions: { page, singleTokenInjection: true }, | ||
}); | ||
const newUserTwo = await inviteUser(newSession, TestUserConstants.Email); | ||
await logout(page, session); | ||
|
||
const loginPage = await AuthLoginPage.goTo(page); | ||
await loginPage.fillLoginForm({ email: TestUserConstants.Email, password: TestUserConstants.Password }); | ||
await loginPage.clickSignInButton(); | ||
await expect(page).toHaveURL(/\/workflows/); | ||
|
||
await page.goto(`/auth/invitation/${newUserTwo.token}`); | ||
|
||
await new HeaderPage(page).clickAvatar(); | ||
const orgSwitch = new SidebarPage(page).getOrganizationSwitch(); | ||
await orgSwitch.focus(); | ||
const orgOptions = orgSwitch.page().getByRole('option', { name: newUserTwo.organization.name }); | ||
await expect(orgOptions).toBeVisible(); | ||
}); | ||
|
||
test.skip('TODO - should redirect to invitation page again if invitation open with an active user session', async ({ | ||
page, | ||
}) => { | ||
const newUser = await inviteUser(session, TestUserConstants.Email); | ||
await page.goto(`/auth/invitation/${newUser.token}`); | ||
await page.getByTestId('success-screen-reset').click(); | ||
await validateTokenNotExisting(page); | ||
await expect(page).toHaveURL(`/auth/invitation/${newUser.token}`); | ||
}); | ||
|
||
async function doRegisterFromInvite(page: Page, token: string) { | ||
async function registerFromInvitation(page: Page, token: string) { | ||
await page.goto(`/auth/invitation/${token}`); | ||
const singUpPage = new SignUpPage(page); | ||
await singUpPage.getFullNameLocator().fill('Invited User'); | ||
|
This file contains 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 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 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 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 |
---|---|---|
|
@@ -13,19 +13,13 @@ test.beforeEach(async ({ page }) => { | |
}); | ||
}); | ||
|
||
test('invite user by email', async ({ page }) => { | ||
test('invite a member to the organization and then remove them', async ({ page }) => { | ||
const teamMembersPage = await TeamMembersPage.goTo(page); | ||
await teamMembersPage.assertNumberOfUsersInTeamMembersList(1); | ||
await teamMembersPage.inviteUserByEmail('[email protected]'); | ||
await teamMembersPage.assertNumberOfUsersInTeamMembersList(2); | ||
}); | ||
|
||
test('remove user from team', async ({ page }) => { | ||
const teamMembersPage = await TeamMembersPage.goTo(page); | ||
await teamMembersPage.inviteUserByEmail('[email protected]'); | ||
|
||
await teamMembersPage.assertNumberOfUsersInTeamMembersList(2); | ||
|
||
await teamMembersPage.removeUserFromTeam(); | ||
await page.waitForTimeout(300); | ||
await teamMembersPage.assertNumberOfUsersInTeamMembersList(1); | ||
}); |
Oops, something went wrong.