docbrown/cypress/integration/seededFlows/adminFlows/users/invitedUsers.spec.js
Suzanne Aitchison b1e7d8a5ec
Member index (phase 2) - Search invitations (#17210)
* add ability to search invitations

* add an invited scope

* add a cypress test
2022-04-12 10:40:44 +01:00

40 lines
1.3 KiB
JavaScript

describe('Invited users', () => {
beforeEach(() => {
cy.testSetup();
cy.fixture('users/adminUser.json').as('user');
cy.get('@user').then((user) => {
cy.loginUser(user)
.then(() => cy.enableFeatureFlag('member_index_view'))
.then(() =>
cy.inviteUser({
name: 'Test user',
email: 'test@test.com',
}),
)
.then(() => cy.visitAndWaitForUserSideEffects('/admin/invitations'));
});
});
it('searches for an invited user', () => {
// The single invited user should be visible on the page
cy.findByText('test@test.com').should('exist');
// Search for a term that should match the entry
cy.findByRole('textbox', {
name: 'Search invited members by name, username, or email',
}).type('test');
cy.findByRole('button', { name: 'Search' }).click();
cy.url().should('contain', 'search=test');
cy.findByText('test@test.com').should('exist');
// Search for a term that shouldn't match the entry
cy.findByRole('textbox', {
name: 'Search invited members by name, username, or email',
})
.clear()
.type('something');
cy.findByRole('button', { name: 'Search' }).click();
cy.url().should('contain', 'search=something');
cy.findByText('test@test.com').should('not.exist');
});
});