Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzimon committed May 13, 2024
1 parent 40ba4c2 commit 8f89296
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const InviteUserModal = NiceModal.create(() => {
const roles = rolesQuery.data.roles;
const assignableRoles = assignableRolesQuery.data.roles;

let okLabel = 'Send invitation now';
let okLabel = 'Send invitation';
if (saveState === 'saving') {
okLabel = 'Sending...';
} else if (saveState === 'saved') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe('User invitations', async () => {

// Validation failures

await modal.getByRole('button', {name: 'Send invitation now'}).click();
await modal.getByRole('button', {name: 'Send invitation'}).click();
await expect(modal).toContainText('Please enter a valid email address');

// Reset error with keydown event
Expand All @@ -47,22 +47,22 @@ test.describe('User invitations', async () => {

await modal.getByLabel('Email address').fill('test');
await expect(modal).not.toContainText('Please enter a valid email address');
await modal.getByRole('button', {name: 'Send invitation now'}).click();
await modal.getByRole('button', {name: 'Send invitation'}).click();
await expect(modal).toContainText('Please enter a valid email address');

await modal.getByLabel('Email address').fill('author@test.com');
await modal.getByRole('button', {name: 'Send invitation now'}).click();
await modal.getByRole('button', {name: 'Retry'}).click();
await expect(modal).toContainText('A user with that email address already exists.');

await modal.getByLabel('Email address').fill('invitee@test.com');
await modal.getByRole('button', {name: 'Send invitation now'}).click();
await modal.getByRole('button', {name: 'Retry'}).click();
await expect(modal).toContainText('A user with that email address was already invited.');

// Successful invitation

await modal.getByLabel('Email address').fill('newuser@test.com');
await modal.locator('input[value=author]').check();
await modal.getByRole('button', {name: 'Send invitation now'}).click();
await modal.getByRole('button', {name: 'Retry'}).click();

await expect(page.getByTestId('toast-success')).toHaveText(/Invitation successfully sent/);

Expand Down

0 comments on commit 8f89296

Please sign in to comment.