mirror of
https://github.com/enso-org/enso.git
synced 2024-09-11 13:15:52 +03:00
Fix E2E tests
This commit is contained in:
parent
e70c749d13
commit
8dcdc91653
@ -765,7 +765,7 @@ export async function login(
|
||||
await locateLoginButton(page).click()
|
||||
await test.expect(page.getByText('Logging in to Enso...')).not.toBeVisible()
|
||||
if (first) {
|
||||
await passTermsAndConditionsDialog({ page, setupAPI })
|
||||
await passAgreementsDialog({ page, setupAPI })
|
||||
await test.expect(page.getByText('Logging in to Enso...')).not.toBeVisible()
|
||||
}
|
||||
})
|
||||
@ -840,11 +840,12 @@ async function mockDate({ page }: MockParams) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Pass the Terms and conditions dialog. */
|
||||
export async function passTermsAndConditionsDialog({ page }: MockParams) {
|
||||
/** Pass the Agreements dialog. */
|
||||
export async function passAgreementsDialog({ page }: MockParams) {
|
||||
await test.test.step('Accept Terms and Conditions', async () => {
|
||||
await page.waitForSelector('#terms-of-service-modal')
|
||||
await page.getByRole('checkbox').click()
|
||||
await page.waitForSelector('#agreements-modal')
|
||||
await page.getByRole('checkbox').and(page.getByTestId('terms-of-service-checkbox')).click()
|
||||
await page.getByRole('checkbox').and(page.getByTestId('privacy-policy-checkbox')).click()
|
||||
await page.getByRole('button', { name: 'Accept' }).click()
|
||||
})
|
||||
}
|
||||
|
@ -83,6 +83,14 @@ export default class RegisterPageActions extends BaseActions {
|
||||
await this.page.getByPlaceholder(TEXT.emailPlaceholder).fill(email)
|
||||
await this.page.getByPlaceholder(TEXT.passwordPlaceholder).fill(password)
|
||||
await this.page.getByPlaceholder(TEXT.confirmPasswordPlaceholder).fill(confirmPassword)
|
||||
await this.page
|
||||
.getByRole('checkbox')
|
||||
.and(this.page.getByTestId('terms-of-service-checkbox'))
|
||||
.click()
|
||||
await this.page
|
||||
.getByRole('checkbox')
|
||||
.and(this.page.getByTestId('privacy-policy-checkbox'))
|
||||
.click()
|
||||
await this.page
|
||||
.getByRole('button', { name: TEXT.register, exact: true })
|
||||
.getByText(TEXT.register)
|
||||
|
@ -65,7 +65,7 @@ test.test('asset panel contents', ({ page }) =>
|
||||
})
|
||||
.login()
|
||||
.do(async (thePage) => {
|
||||
await actions.passTermsAndConditionsDialog({ page: thePage })
|
||||
await actions.passAgreementsDialog({ page: thePage })
|
||||
})
|
||||
.driveTable.clickRow(0)
|
||||
.toggleAssetPanel()
|
||||
|
@ -12,7 +12,7 @@ test.test('login and logout', ({ page }) =>
|
||||
.mockAll({ page })
|
||||
.login()
|
||||
.do(async (thePage) => {
|
||||
await actions.passTermsAndConditionsDialog({ page: thePage })
|
||||
await actions.passAgreementsDialog({ page: thePage })
|
||||
await test.expect(actions.locateDriveView(thePage)).toBeVisible()
|
||||
await test.expect(actions.locateLoginButton(thePage)).not.toBeVisible()
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ import * as test from '@playwright/test'
|
||||
import {
|
||||
INVALID_PASSWORD,
|
||||
mockAll,
|
||||
passTermsAndConditionsDialog,
|
||||
passAgreementsDialog,
|
||||
TEXT,
|
||||
VALID_EMAIL,
|
||||
VALID_PASSWORD,
|
||||
@ -26,7 +26,7 @@ test.test('login screen', ({ page }) =>
|
||||
// Technically it should not be allowed, but
|
||||
.login(VALID_EMAIL, INVALID_PASSWORD)
|
||||
.do(async (thePage) => {
|
||||
await passTermsAndConditionsDialog({ page: thePage })
|
||||
await passAgreementsDialog({ page: thePage })
|
||||
})
|
||||
.withDriveView(async (driveView) => {
|
||||
await test.expect(driveView).toBeVisible()
|
||||
|
@ -129,8 +129,8 @@ export function AgreementsModal() {
|
||||
isDismissable={false}
|
||||
hideCloseButton
|
||||
modalProps={{ defaultOpen: true }}
|
||||
testId="terms-of-service-modal"
|
||||
id="terms-of-service-modal"
|
||||
testId="agreements-modal"
|
||||
id="agreements-modal"
|
||||
>
|
||||
<Form
|
||||
schema={formSchema}
|
||||
@ -138,7 +138,7 @@ export function AgreementsModal() {
|
||||
agreedToTos: tosHash === cachedTosHash,
|
||||
agreedToPrivacyPolicy: privacyPolicyHash === cachedPrivacyPolicyHash,
|
||||
}}
|
||||
testId="terms-of-service-form"
|
||||
testId="agreements-form"
|
||||
method="dialog"
|
||||
onSubmit={() => {
|
||||
// Only the last one in the sequence should trigger a re-render.
|
||||
@ -191,7 +191,7 @@ export function AgreementsModal() {
|
||||
'flex size-4 cursor-pointer overflow-clip rounded-lg border border-primary outline-primary focus-visible:outline focus-visible:outline-2',
|
||||
isInvalid && 'border-red-700 text-red-500 outline-red-500',
|
||||
)}
|
||||
data-testid="terms-of-service-checkbox"
|
||||
data-testid="privacy-policy-checkbox"
|
||||
{...omit(register('agreedToPrivacyPolicy'), 'isInvalid')}
|
||||
/>
|
||||
|
||||
|
@ -210,7 +210,7 @@ export default function Registration() {
|
||||
'flex size-4 cursor-pointer overflow-clip rounded-lg border border-primary outline-primary focus-visible:outline focus-visible:outline-2',
|
||||
isInvalid && 'border-red-700 text-red-500 outline-red-500',
|
||||
)}
|
||||
data-testid="terms-of-service-checkbox"
|
||||
data-testid="privacy-policy-checkbox"
|
||||
{...omit(register('agreedToPrivacyPolicy'), 'isInvalid')}
|
||||
/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user