Fix Cypress selectors broken by compass-ui Button migration

Update enterprise e2e specs that still targeted Bootstrap btn-* classes
or disabled classes on compass-ui label spans. Prefer GenericModal__button,
role+name, and the button disabled attribute instead.

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
This commit is contained in:
Cursor AgentandMatthew Birtch committed 2026-10-01 13:54:16 +00:00
1 parent 257f4dcc3d
commit 63b7952978
9 files changed
+23 -23

No files matched your search

@@ -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();
});
@@ -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
@@ -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);
@@ -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();
@@ -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});
@@ -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();
@@ -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');
}
/**
@@ -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();
@@ -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) {