From 1fc6b96c1be8d248fd43bd0c9454fa6664237c0e Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Mon, 25 Sep 2023 22:09:42 +0800 Subject: [PATCH] fix(e2e): several tests (#24539) --- .../channels/auth_sso/authentication_4_spec.ts | 8 ++++---- .../channels/interactive_dialog/scrollable_spec.js | 10 ++++++---- .../ctrl_cmd_k_focuses_message_box_spec.js | 6 ++++-- .../channels/keyboard_shortcuts/dot_menu_spec.js | 6 ++---- .../ctrl_cmd_k_find_gm_by_matching_name_spec.js | 1 + .../channels/messaging/message_with_gif_spec.js | 4 ++-- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/e2e-tests/cypress/tests/integration/channels/auth_sso/authentication_4_spec.ts b/e2e-tests/cypress/tests/integration/channels/auth_sso/authentication_4_spec.ts index 4e8a3057b4..ea0d702e44 100644 --- a/e2e-tests/cypress/tests/integration/channels/auth_sso/authentication_4_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/auth_sso/authentication_4_spec.ts @@ -130,10 +130,10 @@ describe('Authentication', () => { cy.get('.admin-console__header').should('be.visible').and('have.text', 'Password'); cy.findByTestId('passwordMinimumLengthinput').should('be.visible').and('have.value', '8'); - cy.findByLabelText('At least one lowercase letter').get('input').should('not.be.checked'); - cy.findByLabelText('At least one uppercase letter').get('input').should('not.be.checked'); - cy.findByLabelText('At least one number').get('input').should('not.be.checked'); - cy.findByLabelText('At least one symbol (e.g. "~!@#$%^&*()")').get('input').should('not.be.checked'); + cy.findByText('At least one lowercase letter').siblings().should('not.be.checked'); + cy.findByText('At least one uppercase letter').siblings().should('not.be.checked'); + cy.findByText('At least one number').siblings().should('not.be.checked'); + cy.findByText('At least one symbol (e.g. "~!@#$%^&*()")').siblings().should('not.be.checked'); if (!isCloudLicensed) { cy.findByTestId('maximumLoginAttemptsinput').should('be.visible').and('have.value', '10'); diff --git a/e2e-tests/cypress/tests/integration/channels/interactive_dialog/scrollable_spec.js b/e2e-tests/cypress/tests/integration/channels/interactive_dialog/scrollable_spec.js index f54234a997..7fa398a51f 100644 --- a/e2e-tests/cypress/tests/integration/channels/interactive_dialog/scrollable_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/interactive_dialog/scrollable_spec.js @@ -84,16 +84,18 @@ describe('Interactive Dialog', () => { if (index === 0) { expect(element.name).to.equal('someuserselector'); cy.wrap($elForm).find('.suggestion-list__item').first().should('be.visible'); - cy.wrap($elForm).find('.form-control').type('{downarrow}'.repeat(10)); + cy.wrap($elForm).find('.form-control').type('{uparrow}', {force: true}); + cy.wrap($elForm).find('.form-control').type('{downarrow}'.repeat(10), {force: true}); cy.wrap($elForm).find('.suggestion-list__item').first().should('not.be.visible'); - cy.wrap($elForm).find('.form-control').type('{uparrow}'.repeat(10)); + cy.wrap($elForm).find('.form-control').type('{uparrow}'.repeat(10), {force: true}); cy.wrap($elForm).find('.suggestion-list__item').first().should('be.visible'); } else if (index === 1) { expect(element.name).to.equal('somechannelselector'); cy.wrap($elForm).find('.suggestion-list__item').first().should('be.visible'); - cy.wrap($elForm).find('.form-control').type('{downarrow}'.repeat(10)); + cy.wrap($elForm).find('.form-control').type('{uparrow}', {force: true}); + cy.wrap($elForm).find('.form-control').type('{downarrow}'.repeat(10), {force: true}); cy.wrap($elForm).find('.suggestion-list__item').first().should('not.be.visible'); - cy.wrap($elForm).find('.form-control').type('{uparrow}'.repeat(10)); + cy.wrap($elForm).find('.form-control').type('{uparrow}'.repeat(10), {force: true}); cy.wrap($elForm).find('.suggestion-list__item').first().should('be.visible'); } diff --git a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_k_focuses_message_box_spec.js b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_k_focuses_message_box_spec.js index f8a01b7b02..b71bc57b0a 100644 --- a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_k_focuses_message_box_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_k_focuses_message_box_spec.js @@ -29,12 +29,14 @@ describe('Keyboard Shortcuts', () => { cy.get('body').cmdOrCtrlShortcut('K'); cy.get('#quickSwitchInput').type('T'); + // * Confirm the town-square channel is selected in the suggestion list + cy.get('#suggestionList').findByTestId('town-square').should('be.visible').and('have.class', 'suggestion--selected'); + // # Press down arrow cy.wait(TIMEOUTS.HALF_SEC); cy.get('body').type('{downarrow}'); - cy.get('body').type('{downarrow}'); - // * Confirm the offtopic channel is selected in the suggestion list + // * Confirm the off-topic channel is selected in the suggestion list cy.get('#suggestionList').findByTestId('off-topic').should('be.visible').and('have.class', 'suggestion--selected'); // # Press ENTER diff --git a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/dot_menu_spec.js b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/dot_menu_spec.js index 6e495bc454..db50836ddf 100644 --- a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/dot_menu_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/dot_menu_spec.js @@ -94,10 +94,8 @@ describe('Keyboard Shortcuts', () => { }); cy.getLastPostId().then((postId) => { - // * verify Save not shown in webview - cy.findByText('Save').should('not.exist'); - - cy.viewport('iphone-6'); + // * verify Saved not shown in webview + cy.findByText('Saved').should('not.exist'); // # Save Post cy.uiPostDropdownMenuShortcut(postId, 'Save', 'S', 'RHS_ROOT'); diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/ctrl_cmd_k_find_gm_by_matching_name_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/ctrl_cmd_k_find_gm_by_matching_name_spec.js index 69baab83bd..7a8a8437a9 100644 --- a/e2e-tests/cypress/tests/integration/channels/messaging/ctrl_cmd_k_find_gm_by_matching_name_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/messaging/ctrl_cmd_k_find_gm_by_matching_name_spec.js @@ -42,6 +42,7 @@ describe('Messaging', () => { cy.apiCreateGroupChannel([firstUser.id, secondUser.id, thirdUser.id]).then(({channel}) => { // # Visit the newly created group message cy.visit(`/${testTeam.name}/channels/${channel.name}`); + cy.postMessage('hello'); // # Go to off-topic cy.get('#sidebarItem_off-topic').click(); diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/message_with_gif_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/message_with_gif_spec.js index 9b1727949f..3de2c7dabe 100644 --- a/e2e-tests/cypress/tests/integration/channels/messaging/message_with_gif_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/messaging/message_with_gif_spec.js @@ -36,11 +36,11 @@ describe('Show GIF images properly', () => { cy.url().should('include', offtopiclink); // # Post tenor GIF - cy.postMessage('https://c.tenor.com/Ztva2YFROSkAAAAi/duck-searching.gif'); + cy.postMessage('https://media.tenor.com/yCFHzEvKa9MAAAAi/hello.gif'); cy.getLastPostId().as('postId').then((postId) => { // * Validate image size - cy.get(`#post_${postId}`).find('.attachment__image').should('have.css', 'width', '137px'); + cy.get(`#post_${postId}`).find('.attachment__image').should('have.css', 'width', '189px'); }); // # Post giphy GIF