Fixed Add Channel_test_cases (#22768)

* Fixed Add Channel_test_cases

* fixed more test cases

* fixed lint
This commit is contained in:
Furqan Malik
2023-04-03 18:22:48 -04:00
committed by GitHub
parent 8d301c0d64
commit f1f54508f4
11 changed files with 22 additions and 15 deletions

View File

@@ -69,7 +69,7 @@ describe('Verify Accessibility Support in Channel Sidebar Navigation', () => {
cy.uiGetLHSAddChannelButton().focus().tab().tab({shift: true});
// * Verify if the Plus button has focus
cy.findByRole('button', {name: 'Add Channel Dropdown'}).should('be.focused');
cy.uiGetLHSAddChannelButton().should('be.focused');
cy.focused().tab();
// * Verify if the Plus button has focus

View File

@@ -140,7 +140,7 @@ function createCategoryFromSidebarMenu() {
const categoryName = `category-${getRandomId()}`;
// # Click on the sidebar menu dropdown
cy.findByLabelText('Add Channel Dropdown').click();
cy.uiGetLHSAddChannelButton().click();
// # Click on create category link
cy.findByText('Create New Category').should('be.visible').click();

View File

@@ -23,7 +23,7 @@ describe('Category sorting', () => {
it('MM-T3916 Create Category character limit', () => {
// # Click on the sidebar menu dropdown
cy.findByLabelText('Add Channel Dropdown').click();
cy.uiGetLHSAddChannelButton().click();
// # Click on create category link
cy.findByText('Create New Category').should('be.visible').click();

View File

@@ -90,7 +90,7 @@ function createCategoryFromSidebarMenu() {
const categoryName = `category-${getRandomId()}`;
// # Click on the sidebar menu dropdown
cy.findByLabelText('Add Channel Dropdown').click();
cy.uiGetLHSAddChannelButton().click();
// # Click on create category link
cy.findByText('Create New Category').should('be.visible').click();

View File

@@ -62,7 +62,7 @@ describe('Channel sidebar', () => {
cy.url().should('include', `/${teamName}/channels/town-square`);
// # Click the New Channel Dropdown button
cy.get('.AddChannelDropdown_dropdownButton').should('be.visible').click();
cy.uiGetLHSAddChannelButton().should('be.visible').click();
// # Click the Browse Channels dropdown item
cy.get('.AddChannelDropdown .MenuItem:contains(Browse Channels) button').should('be.visible').click();

View File

@@ -105,7 +105,10 @@ describe('Recent Emoji', () => {
cy.uiGetPostTextBox().type('{enter} {enter}').wait(TIMEOUTS.TWO_SEC);
// # Hover over the last post by opening dot menu on it
cy.clickPostDotMenu();
cy.getLastPostId().then((postId) => {
// # Click on post dot menu so we can check for reaction icon
cy.get(`#post_${postId}`).trigger('mouseover');
});
cy.get('#recent_reaction_0').should('exist').then((recentReaction) => {
// * Assert that custom emoji is present as most recent in quick reaction menu
@@ -152,7 +155,10 @@ describe('Recent Emoji', () => {
cy.reload();
// # Hover over the last post by opening dot menu on it
cy.clickPostDotMenu();
cy.getLastPostId().then((postId) => {
// # Click on post dot menu so we can check for reaction icon
cy.get(`#post_${postId}`).trigger('mouseover');
});
cy.get('#recent_reaction_0').should('exist').then((recentReaction) => {
// * Assert that instead of custom emoji the system emoji is present as most recent in quick reaction menu

View File

@@ -196,7 +196,7 @@ describe('Verify Accessibility Support in different input fields', () => {
cy.get('#FormattingControl_ul').should('be.focused').and('have.attr', 'aria-label', 'bulleted list').tab();
// * Verify if the focus is on the numbered list button
cy.get('#FormattingControl_ol').should('be.focused').and('have.attr', 'aria-label', 'numbered list').tab();
cy.get('#FormattingControl_ol').should('be.focused').and('have.attr', 'aria-label', 'numbered list').tab().tab();
// * Verify if the focus is on the formatting options button
cy.get('#toggleFormattingBarButton').should('be.focused').and('have.attr', 'aria-label', 'formatting').tab();

View File

@@ -159,7 +159,7 @@ describe('LDAP guest', () => {
// # Create team if no membership
cy.skipOrCreateTeam(testSettings, getRandomId()).then(() => {
// * Verify user is a member
cy.findByRole('button', {name: 'Add Channel Dropdown'}).should('exist');
cy.uiGetLHSAddChannelButton().should('exist');
// # Demote the user
demoteUserToGuest(user2Data);
@@ -173,7 +173,7 @@ describe('LDAP guest', () => {
cy.uiAddDirectMessage().should('exist');
// * Check the user is a guest
cy.findByRole('button', {name: 'Add Channel Dropdown'}).should('not.exist');
cy.uiGetLHSAddChannelButton().should('not.exist');
});
});
});

View File

@@ -53,7 +53,7 @@ describe('System Scheme', () => {
cy.findByTestId('systemScheme-link').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Click on `Reset to defaults`
cy.findByTestId('resetPermissionsToDefault').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
cy.findByTestId('resetPermissionsToDefault').scrollIntoView().should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Confirm the dialog
cy.get('#confirmModalButton').click().wait(TIMEOUTS.TWO_SEC);
@@ -78,10 +78,10 @@ describe('System Scheme', () => {
cy.findByTestId('all_users-private_channel-create_private_channel-checkbox').should('not.have.class', 'checked');
// # Click on `Reset to defaults`
cy.findByTestId('resetPermissionsToDefault').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
cy.findByTestId('resetPermissionsToDefault').scrollIntoView().should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Confirm the dialog
cy.get('#confirmModalButton').click().wait(TIMEOUTS.HALF_SEC);
cy.get('#confirmModalButton').scrollIntoView().click().wait(TIMEOUTS.HALF_SEC);
// # Save changes
cy.get('#saveSetting').click().wait(TIMEOUTS.TWO_SEC);

View File

@@ -21,6 +21,7 @@ export function markAsUnreadShouldBeAbsent(postId, prefix = 'post', location = '
within(() => {
cy.findByText('Mark as Unread').should('not.exist');
});
cy.get('body').type('esc');
}
export function switchToChannel(channel) {

View File

@@ -32,7 +32,7 @@ Cypress.Commands.add('uiOpenTeamMenu', (item = '') => {
Cypress.Commands.add('uiGetLHSAddChannelButton', () => {
return cy.uiGetLHS().
findByRole('button', {name: 'Add Channel Dropdown'});
find('.AddChannelDropdown_dropdownButton');
});
Cypress.Commands.add('uiGetLHSTeamMenu', () => {
@@ -89,7 +89,7 @@ Cypress.Commands.add('uiGetLhsSection', (section) => {
});
Cypress.Commands.add('uiBrowseOrCreateChannel', (item) => {
cy.findByRole('button', {name: 'Add Channel Dropdown'}).
cy.get('.AddChannelDropdown_dropdownButton').
should('be.visible').
click();
cy.get('.dropdown-menu').should('be.visible');