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

update inviate to project test to work with new 'invite' checkbox #993

Closed
hahn-kev opened this issue Jul 31, 2024 · 0 comments · Fixed by #994
Closed

update inviate to project test to work with new 'invite' checkbox #993

hahn-kev opened this issue Jul 31, 2024 · 0 comments · Fixed by #994
Assignees
Labels
bug Something isn't working

Comments

@hahn-kev
Copy link
Collaborator

PR #966 is causing our integration test for inviting project users to fail. We need to update that test to check the 'invite' box in order for it to work.

The test can be found here:

test('register via new-user invitation email', async ({ page }) => {
test.setTimeout(TEST_TIMEOUT_2X);
await loginAs(page.request, 'admin', defaultPassword);
const adminPage = await new AdminDashboardPage(page).goto();
const projectPage = await adminPage.openProject('Sena 3', 'sena-3');
const uuid = randomUUID();
const newEmail = `${uuid}@mailinator.com`;
const addMemberModal = await projectPage.clickAddMember();
await addMemberModal.emailField.fill(newEmail);
await addMemberModal.selectEditorRole();
await addMemberModal.submitButton.click();
await page.locator(':text("has been sent an invitation email")').waitFor();
// Check invite link returnTo is relative path, not absolute
const inboxPage = await getInbox(page, uuid).goto();
const emailPage = await inboxPage.openEmail(EmailSubjects.ProjectInvitation);
const invitationUrl = await emailPage.getFirstLanguageDepotUrl();
expect(invitationUrl).not.toBeNull();
expect(invitationUrl!).toContain('acceptInvitation');
expect(invitationUrl!).toContain('returnTo=');
expect(invitationUrl!).not.toContain('returnTo=http');
// Click invite link, verify register page contains pre-filled email address
const pagePromise = emailPage.page.context().waitForEvent('page');
await emailPage.clickFirstLanguageDepotUrl();
const newPage = await pagePromise;
const acceptPage = await new AcceptInvitationPage(newPage).waitFor();
await expect(newPage.getByLabel('Email')).toHaveValue(newEmail);
await acceptPage.fillForm(`Test user ${uuid}`, defaultPassword);
await acceptPage.submit();
const userDashboardPage = await new UserDashboardPage(newPage).waitFor();
// Register current user ID to be cleaned up even if test fails later on
const userId = await getCurrentUserId(newPage.request);
userIdsToDelete.push(userId);
// Should be able to open sena-3 project from user dashboard as we are now a member
await userDashboardPage.openProject('Sena 3', 'sena-3');
});

it might not be a bad idea to document how to run these integration tests in the frontend readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants