Skip to content

Commit

Permalink
fixes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFlashAccount committed May 22, 2024
1 parent bc0897d commit a2894a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 14 additions & 7 deletions app/ide-desktop/lib/dashboard/e2e/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,19 @@ async function mockDate({ page }: MockParams) {

/**
* Passes Terms and conditions dialog
* @param page
*/
export async function passTermsAndConditionsDialog({page}: MockParams) {
await page.waitForSelector('', {
state: 'attached'
})


export async function passTermsAndConditionsDialog({ page }: MockParams) {
// wait for terms and conditions dialog to appear
// but don't fail if it doesn't appear
try {
// wait for terms and conditions dialog to appear
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
await page.waitForSelector('#terms-of-service-modal', { timeout: 500 })
await page.getByRole('checkbox').click()
await page.getByRole('button', { name: 'Accept' }).click()
} catch (error) {
// do nothing
}
}

// ========================
Expand Down Expand Up @@ -849,6 +854,8 @@ export async function mockAllAndLogin({ page }: MockParams) {
const mocks = await mockAll({ page })
await login({ page })

await passTermsAndConditionsDialog({ page })

// This MUST run after login, otherwise the element's styles are reset when the browser
// is navigated to another page.
await mockIDEContainer({ page })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ export function TermsOfServiceModal() {
hideCloseButton
modalProps={{ isOpen: true }}
testId="terms-of-service-modal"
id="terms-of-service-modal"
>
<ariaComponents.Form
testId="terms-of-service-form"
schema={ariaComponents.Form.schema.object({
agree: ariaComponents.Form.schema
.boolean()
// we accept only true
.refine(value => value, getText('licenseAgreementCheckboxError')),
})}
onSubmit={() => {
Expand Down

0 comments on commit a2894a9

Please sign in to comment.