Skip to content

Commit

Permalink
Stabilize and demote tests (mattermost#29367)
Browse files Browse the repository at this point in the history
* Stabilize and demote tests
  • Loading branch information
mvitale1989 authored Nov 25, 2024
1 parent f4e9221 commit 37edbc8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ function verifyNoChannelToJoinMessage(isVisible) {
cy.findByText('No public channels').should(isVisible ? 'be.visible' : 'not.exist');
}

function ensureHideJoinedCheckboxEnabled(shouldBeChecked) {
cy.get('#hideJoinedPreferenceCheckbox').then(($checkbox) => {
cy.wrap($checkbox).findByText('Hide Joined').should('be.visible');
cy.wrap($checkbox).find('button').invoke('attr', 'class').then(($classList) => {
if ($classList.split(' ').includes('checked') ^ shouldBeChecked) {
// We click on the button only when the XOR operands do not match
// e.g. checkbox is checked, but should not be checked; and vice-versa
cy.wrap($checkbox).click();
cy.wrap($checkbox).find('button').should(`${shouldBeChecked ? '' : 'not.'}have.class`, 'checked');
}
});
});
}

describe('browse public channels', () => {
let testUser: UserProfile;
let otherUser: UserProfile;
Expand Down Expand Up @@ -63,11 +77,7 @@ describe('browse public channels', () => {
cy.findByText('Public channels').should('be.visible').click();

// # Click hide joined checkbox if not already checked
cy.findByText('Hide Joined').should('be.visible').then(($checkbox) => {
if (!$checkbox.prop('checked')) {
cy.wrap($checkbox).click();
}
});
ensureHideJoinedCheckboxEnabled(true);

// * Assert that the moreChannelsList is visible and the number of channels is 31
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 31);
Expand Down Expand Up @@ -108,6 +118,9 @@ describe('browse public channels', () => {
// # Click archived channels
cy.findByText('Public channels').should('be.visible').click();

// # Click hide joined checkbox if not already checked
ensureHideJoinedCheckboxEnabled(true);

// * Assert that the "No more channels to join" message is visible
verifyNoChannelToJoinMessage(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ describe('Collapsed Reply Threads', () => {
it('MM-T4843_2 should go to threads view when threads view is the penultimate view and leave the current channel', () => {
// # Go to the ‘Threads’ view on Team A
cy.uiGetSidebarThreadsButton().click();
cy.url().should('include', `${teamA.name}/threads`);

// # Switch to Test Channel
cy.uiClickSidebarItem(testChannel.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('Message Draft with attachment and Switch Channels', () => {
testChannel2 = out.channel;
});
cy.visit(`/${team.name}/channels/town-square`);
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Town Square');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************

// Stage: @prod
// Group: @channels @system_console @enterprise @cloud_only

import * as TIMEOUTS from '../../../../fixtures/timeouts';
Expand Down

0 comments on commit 37edbc8

Please sign in to comment.