Merge pull request #22912 from mattermost/MM-52097

e2e: fix yearly subscription test
Этот коммит содержится в:
yasserfaraazkhan
2023-04-25 21:50:55 +05:30
коммит произвёл GitHub
родитель 33af25f2ab 2c5eb63181
Коммит 19189566d5
3 изменённых файлов: 21 добавлений и 13 удалений

Просмотреть файл

@@ -15,7 +15,10 @@ import {getRandomId} from '../../../utils';
describe('Leave an archived channel', () => { describe('Leave an archived channel', () => {
let testTeam; let testTeam;
let offTopicUrl; let offTopicUrl;
const channelType = {
public: 'Channel Type: Public',
archived: 'Channel Type: Archived',
};
before(() => { before(() => {
cy.apiUpdateConfig({ cy.apiUpdateConfig({
TeamSettings: { TeamSettings: {
@@ -97,7 +100,7 @@ describe('Leave an archived channel', () => {
// # More channels modal opens // # More channels modal opens
cy.get('#moreChannelsModal').should('be.visible').within(() => { cy.get('#moreChannelsModal').should('be.visible').within(() => {
// # Click on dropdown // # Click on dropdown
cy.findByText('Show: Public Channels').should('be.visible').click(); cy.findByText(channelType.public).should('be.visible').click();
// # Click archived channels // # Click archived channels
cy.findByText('Archived Channels').click(); cy.findByText('Archived Channels').click();
@@ -145,7 +148,7 @@ describe('Leave an archived channel', () => {
// # More channels modal opens // # More channels modal opens
cy.get('.more-modal').should('be.visible').within(() => { cy.get('.more-modal').should('be.visible').within(() => {
// # Public channel list opens by default // # Public channel list opens by default
cy.findByText('Show: Public Channels').should('be.visible').click(); cy.findByText(channelType.public).should('be.visible').click();
// # Click on archived channels // # Click on archived channels
cy.findByText('Archived Channels').click(); cy.findByText('Archived Channels').click();
@@ -198,7 +201,7 @@ describe('Leave an archived channel', () => {
// # More channels modal opens // # More channels modal opens
cy.get('.more-modal').should('be.visible').within(() => { cy.get('.more-modal').should('be.visible').within(() => {
// # Public channels are shown by default // # Public channels are shown by default
cy.findByText('Show: Public Channels').should('be.visible').click(); cy.findByText(channelType.public).should('be.visible').click();
// # Go to archived channels // # Go to archived channels
cy.findByText('Archived Channels').click(); cy.findByText('Archived Channels').click();
@@ -252,7 +255,7 @@ describe('Leave an archived channel', () => {
// # More channels modal opens // # More channels modal opens
cy.get('.more-modal').should('be.visible').within(() => { cy.get('.more-modal').should('be.visible').within(() => {
// # Show public channels is visible by default // # Show public channels is visible by default
cy.findByText('Show: Public Channels').should('be.visible').click(); cy.findByText(channelType.public).should('be.visible').click();
// # Go to archived channels // # Go to archived channels
cy.findByText('Archived Channels').click(); cy.findByText('Archived Channels').click();
@@ -286,7 +289,7 @@ describe('Leave an archived channel', () => {
// # More channels modal opens and lands on public channels // # More channels modal opens and lands on public channels
cy.get('#moreChannelsModal').should('be.visible').within(() => { cy.get('#moreChannelsModal').should('be.visible').within(() => {
cy.findByText('Show: Public Channels').should('be.visible').click(); cy.findByText(channelType.public).should('be.visible').click();
// # Go to archived channels // # Go to archived channels
cy.findByText('Archived Channels').click(); cy.findByText('Archived Channels').click();

Просмотреть файл

@@ -14,6 +14,11 @@ import * as TIMEOUTS from '../../../fixtures/timeouts';
import {createPrivateChannel} from '../enterprise/elasticsearch_autocomplete/helpers'; import {createPrivateChannel} from '../enterprise/elasticsearch_autocomplete/helpers';
const channelType = {
public: 'Channel Type: Public',
archived: 'Channel Type: Archived',
};
describe('Channels', () => { describe('Channels', () => {
let testUser; let testUser;
let otherUser; let otherUser;
@@ -65,7 +70,7 @@ describe('Channels', () => {
cy.get('#moreChannelsModal').should('be.visible').within(() => { cy.get('#moreChannelsModal').should('be.visible').within(() => {
// * Dropdown should be visible, defaulting to "Public Channels" // * Dropdown should be visible, defaulting to "Public Channels"
cy.get('#channelsMoreDropdown').should('be.visible').and('contain', 'Show: Public Channels').wait(TIMEOUTS.HALF_SEC); cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).wait(TIMEOUTS.HALF_SEC);
cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC); cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC);
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 1).within(() => { cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 1).within(() => {
@@ -113,7 +118,7 @@ describe('Channels', () => {
cy.findByText('Archived Channels').should('be.visible').click(); cy.findByText('Archived Channels').should('be.visible').click();
// * Channel test should be visible as an archived channel in the list // * Channel test should be visible as an archived channel in the list
cy.wrap(el).should('contain', 'Show: Archived Channels'); cy.wrap(el).should('contain', channelType.archived);
}); });
cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC); cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC);
@@ -196,7 +201,7 @@ describe('Channels', () => {
// * Dropdown should be visible, defaulting to "Public Channels" // * Dropdown should be visible, defaulting to "Public Channels"
cy.get('#channelsMoreDropdown').should('be.visible').within((el) => { cy.get('#channelsMoreDropdown').should('be.visible').within((el) => {
cy.wrap(el).should('contain', 'Show: Public Channels'); cy.wrap(el).should('contain', channelType.public);
}); });
// * Users should be able to type and search // * Users should be able to type and search
@@ -207,12 +212,12 @@ describe('Channels', () => {
cy.get('#moreChannelsModal').should('be.visible').within(() => { cy.get('#moreChannelsModal').should('be.visible').within(() => {
// * Users should be able to switch to "Archived Channels" list // * Users should be able to switch to "Archived Channels" list
cy.get('#channelsMoreDropdown').should('be.visible').and('contain', 'Show: Public Channels').click().within((el) => { cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).click().within((el) => {
// # Click on archived channels item // # Click on archived channels item
cy.findByText('Archived Channels').should('be.visible').click(); cy.findByText('Archived Channels').should('be.visible').click();
// * Modal should show the archived channels list // * Modal should show the archived channels list
cy.wrap(el).should('contain', 'Show: Archived Channels'); cy.wrap(el).should('contain', channelType.archived);
}).wait(TIMEOUTS.HALF_SEC); }).wait(TIMEOUTS.HALF_SEC);
cy.get('#searchChannelsTextbox').clear(); cy.get('#searchChannelsTextbox').clear();
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2); cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2);
@@ -250,7 +255,7 @@ function verifyMoreChannelsModal(isEnabled) {
// * Verify that the more channels modal is open and with or without option to view archived channels // * Verify that the more channels modal is open and with or without option to view archived channels
cy.get('#moreChannelsModal').should('be.visible').within(() => { cy.get('#moreChannelsModal').should('be.visible').within(() => {
if (isEnabled) { if (isEnabled) {
cy.get('#channelsMoreDropdown').should('be.visible').and('have.text', 'Show: Public Channels'); cy.get('#channelsMoreDropdown').should('be.visible').and('have.text', channelType.public);
} else { } else {
cy.get('#channelsMoreDropdown').should('not.exist'); cy.get('#channelsMoreDropdown').should('not.exist');
} }

Просмотреть файл

@@ -142,7 +142,7 @@ describe('System Console - Subscriptions section', () => {
cy.get('.RHS').find('button').should('be.enabled'); cy.get('.RHS').find('button').should('be.enabled');
// # Change the user seats field to a value smaller than the current number of users // # Change the user seats field to a value smaller than the current number of users
const lessThanUserCount = count - 5; const lessThanUserCount = 1;
cy.get('#input_UserSeats').clear().type(lessThanUserCount); cy.get('#input_UserSeats').clear().type(lessThanUserCount);
// * Ensure that the yearly, monthly, and yearly saving prices match the new user seats value entered // * Ensure that the yearly, monthly, and yearly saving prices match the new user seats value entered