Skip to content
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

fix: enrollment e2e fixes #472

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions e2e/tests/enrollment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
createDevice,
createUserEnrollment,
password,
selectEnrollment,
setPassword,
setToken,
validateData,
Expand Down Expand Up @@ -44,6 +45,7 @@ test.describe('Create user with enrollment enabled', () => {
await waitForBase(page);
await page.goto(testsConfig.ENROLLMENT_URL);
await waitForPromise(2000);
await selectEnrollment(page);
await setToken(token, page);
// Welcome page
await page.getByTestId('enrollment-next').click();
Expand Down
7 changes: 6 additions & 1 deletion e2e/utils/controllers/enrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ export const createUserEnrollment = async (
return { user, token };
};

export const selectEnrollment = async (page: Page) => {
const selectButton = page.getByTestId('select-enrollment');
selectButton.click();
};

export const setToken = async (token: string, page: Page) => {
const formElement = page.getByTestId('enrollment-token-form');
await formElement.getByTestId('field-token').type(token);
await formElement.locator('button[type="submit"]').click();
await page.getByTestId('enrollment-token-submit-button').click();
};

export const validateData = async (user: User, page: Page) => {
Expand Down
Loading