diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/guest_invitation_ui_more_spec.ts b/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/guest_invitation_ui_more_spec.ts index 5b63917bc26..b97c12df8db 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/guest_invitation_ui_more_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/guest_invitation_ui_more_spec.ts @@ -136,7 +136,7 @@ describe('Guest Account - Guest User Invitation Flow', () => { // * Update email outside whitelisted domain and verify error message cy.get('#resetEmailModal').should('be.visible').within(() => { cy.get('input[type="email"]').type(email); - cy.get('button.btn-primary.confirm').click(); + cy.get('button.GenericModal__button.confirm').click(); cy.get('.error').should('be.visible').and('have.text', 'The email you provided does not belong to an accepted domain for guest accounts. Please contact your administrator or sign up with a different email.'); cy.get('.close').click(); }); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/system_console_manage_guest_spec.ts b/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/system_console_manage_guest_spec.ts index 56122570081..72fabcca7d7 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/system_console_manage_guest_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/guest_accounts/system_console_manage_guest_spec.ts @@ -87,7 +87,7 @@ describe('Guest Account - Verify Manage Guest Users', () => { const email = `temp-${getRandomId()}@mattermost.com`; cy.get('#resetEmailModal').should('be.visible').within(() => { cy.get('input[type="email"]').type(email); - cy.get('button.btn-primary.confirm').click(); + cy.get('button.GenericModal__button.confirm').click(); }); // * Verify if Guest's email was updated diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/system_console/archived_channels_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/system_console/archived_channels_spec.js index 676d387d48b..6b469906ea1 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/system_console/archived_channels_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/system_console/archived_channels_spec.js @@ -62,7 +62,7 @@ describe('Archived channels', () => { cy.visit(`/admin_console/user_management/channels/${testChannel.id}`); // * Verify the Unarchive Channel button is visible - cy.get('button.btn-secondary', {timeout: TIMEOUTS.TWO_SEC}).should('have.text', 'Unarchive Channel').should('be.visible').should('be.enabled'); + cy.findByRole('button', {name: 'Unarchive Channel', timeout: TIMEOUTS.TWO_SEC}).should('be.visible').should('be.enabled'); // * Verify that only one widget is visible cy.get('div.AdminPanel').should('be.visible').and('have.length', 1); @@ -73,10 +73,10 @@ describe('Archived channels', () => { cy.visit(`/admin_console/user_management/channels/${testChannel.id}`); // # Click Unarchive Channel button - cy.get('button.btn-secondary', {timeout: TIMEOUTS.TWO_SEC}).findAllByText('Unarchive Channel').click(); + cy.findByRole('button', {name: 'Unarchive Channel', timeout: TIMEOUTS.TWO_SEC}).click(); // * Verify the Archive Channel button is visible - cy.get('button.btn-secondary.btn-danger', {timeout: TIMEOUTS.TWO_SEC}).findAllByText('Archive Channel').should('be.visible'); + cy.findByRole('button', {name: 'Archive Channel', timeout: TIMEOUTS.TWO_SEC}).should('be.visible'); // * Verify that the other widget appears cy.get('div.AdminPanel').should('be.visible').should('have.length', 5); diff --git a/e2e-tests/cypress/tests/integration/channels/integrations/custom_slash_commands/slash_commands_spec.js b/e2e-tests/cypress/tests/integration/channels/integrations/custom_slash_commands/slash_commands_spec.js index e73d5e317c3..a44d738898b 100644 --- a/e2e-tests/cypress/tests/integration/channels/integrations/custom_slash_commands/slash_commands_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/integrations/custom_slash_commands/slash_commands_spec.js @@ -155,7 +155,7 @@ describe('Slash commands page', () => { cy.get('#url').clear().type('http://mattermost.com'); // # Click on Cancel - cy.get('a').contains('Cancel').click(); + cy.findByRole('button', {name: 'Cancel'}).click(); // # Click on edit again cy.get('a[href*="/edit"]').click(); diff --git a/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_dm_spec.js b/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_dm_spec.js index 6f386a80a25..035a8c2b5d9 100644 --- a/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_dm_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_dm_spec.js @@ -191,8 +191,8 @@ describe('Forward Message', () => { // * Assert channel select is not existent cy.get('.forward-post__select').should('not.exist'); - // * Assert if button is enabled - cy.get('.btn-tertiary').should('not.be.disabled'); + // * Assert if cancel button is enabled + cy.findByRole('button', {name: 'Cancel'}).should('not.be.disabled'); // * Assert Notification is shown cy.findByTestId('notification_forward_post').should('be.visible').should('contain.text', `This message is from a private conversation and can only be shared with ${dmChannel.display_name}`); @@ -206,8 +206,8 @@ describe('Forward Message', () => { } if (cancel) { - // * Assert if button is active - cy.get('.btn-tertiary').should('not.be.disabled').type('{esc}', {force: true}); + // * Assert if cancel button is active, then dismiss with escape + cy.findByRole('button', {name: 'Cancel'}).should('not.be.disabled').type('{esc}', {force: true}); } else { // * Assert if button is active cy.get('.GenericModal__button.confirm').should('not.be.disabled').type('{enter}', {force: true}); diff --git a/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_private_channel_spec.js b/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_private_channel_spec.js index 5fa8cb785fb..fae10016ed0 100644 --- a/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_private_channel_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/message_forwarding/forward_message_from_private_channel_spec.js @@ -188,8 +188,8 @@ describe('Forward Message', () => { cy.findByTestId('notification_forward_post').should('be.visible').should('contain.text', `This message is from a private channel and can only be shared with ~${privateChannel.display_name}`); if (cancel) { - // * Assert if button is active - cy.get('.btn-tertiary').should('not.be.disabled').click(); + // * Assert if cancel button is active + cy.findByRole('button', {name: 'Cancel'}).should('not.be.disabled').click(); } else { // * Assert if button is active cy.get('.GenericModal__button.confirm').should('not.be.disabled').click(); diff --git a/e2e-tests/cypress/tests/integration/channels/multi_team_and_dm/existing_channel_name_spec.js b/e2e-tests/cypress/tests/integration/channels/multi_team_and_dm/existing_channel_name_spec.js index c075ca6347e..9b4f442bed8 100644 --- a/e2e-tests/cypress/tests/integration/channels/multi_team_and_dm/existing_channel_name_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/multi_team_and_dm/existing_channel_name_spec.js @@ -62,7 +62,7 @@ describe('Channel', () => { cy.get('.url-input-error').should('not.exist'); // * 'Create Channel' button should be enabled - cy.findByText('Create channel').should('not.have.class', 'disabled'); + cy.findByRole('button', {name: 'Create channel'}).should('not.be.disabled'); // # Click on Cancel button to move out of New Channel Modal cy.findByText('Cancel').click(); @@ -92,7 +92,7 @@ function verifyExistingChannelError(newChannelName, makePrivate = false) { cy.get('.url-input-error').contains('A channel with that URL already exists'); // * 'Create Channel' button should be disabled - cy.findByText('Create channel').should('have.class', 'disabled'); + cy.findByRole('button', {name: 'Create channel'}).should('be.disabled'); } /** diff --git a/e2e-tests/cypress/tests/integration/channels/system_console/user_management/users_spec.js b/e2e-tests/cypress/tests/integration/channels/system_console/user_management/users_spec.js index fff50a3a33a..673137e1577 100644 --- a/e2e-tests/cypress/tests/integration/channels/system_console/user_management/users_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/system_console/user_management/users_spec.js @@ -70,7 +70,7 @@ describe('System Console > User Management > Users', () => { // # Type new password and submit. cy.get('input[type=password]').type('new' + testUser.password); - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // # Log out. cy.apiLogout(); @@ -96,7 +96,7 @@ describe('System Console > User Management > Users', () => { cy.get('input[type=password]').eq(1).type('new' + otherAdmin.password); // # Click the 'Cancel' button. - cy.get('.modal-footer > .btn-tertiary').should('contain', 'Cancel').click().wait(TIMEOUTS.HALF_SEC); + cy.get('.modal-footer').findByRole('button', {name: 'Cancel'}).click().wait(TIMEOUTS.HALF_SEC); // # Log out. cy.apiLogout(); @@ -113,7 +113,7 @@ describe('System Console > User Management > Users', () => { cy.get('input[type=password]').eq(1).type('new' + otherAdmin.password); // # Click the 'Reset' button. - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // * Verify the appropriate error is returned (current password error shows in modal header area). cy.get('.genericModalError .error').should('be.visible'). @@ -128,7 +128,7 @@ describe('System Console > User Management > Users', () => { cy.get('input[type=password]').eq(1).type('new'); // # Click the 'Reset' button. - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // * Verify the appropriate error is returned (new password error shows under the input). cy.get('.Input___error').should('be.visible').and('contain', 'characters long'); @@ -138,7 +138,7 @@ describe('System Console > User Management > Users', () => { searchUserAndOpenResetPassword(otherAdmin.username, otherAdmin.email); // # Click the 'Reset' button. - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // * Verify the appropriate error is returned (current password missing). cy.get('.genericModalError .error').should('be.visible'). @@ -148,7 +148,7 @@ describe('System Console > User Management > Users', () => { cy.get('input[type=password]').eq(0).type(otherAdmin.password); // # Click the 'Reset' button. - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // * Verify the appropriate error is returned (new password error shows under the input). cy.get('.Input___error').should('be.visible').and('contain', 'characters long'); @@ -162,7 +162,7 @@ describe('System Console > User Management > Users', () => { cy.get('input[type=password]').eq(1).type('new' + otherAdmin.password); // # Click the 'Reset' button. - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // # Log out. cy.apiLogout(); diff --git a/e2e-tests/cypress/tests/integration/channels/system_console/user_management_spec.js b/e2e-tests/cypress/tests/integration/channels/system_console/user_management_spec.js index 5dbecfefac5..8dc6bd2ca94 100644 --- a/e2e-tests/cypress/tests/integration/channels/system_console/user_management_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/system_console/user_management_spec.js @@ -194,7 +194,7 @@ describe('User Management', () => { // # Set new password. cy.get('input[type=password]').type('new' + testUser.password); - cy.get('button.btn-primary.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); + cy.get('button.GenericModal__button.confirm').should('contain', 'Reset').click().wait(TIMEOUTS.HALF_SEC); // * Verify Update email option is visible. cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC); @@ -269,7 +269,7 @@ describe('User Management', () => { } // # Click the "Update" button. - cy.get('button.btn-primary.confirm').click(); + cy.get('button.GenericModal__button.confirm').click(); // * Check for the error messages, if any. if (errorMsg.length > 0) {