diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index 4ce06dd3bc..f96a2374c2 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -17,15 +17,16 @@ const generateLinkWithPwd = () => { // enable checkbox & feed pwd, save cy.getActiveModal().find('button:contains("More Options")').click({ force: true }); - const passwordCheckbox = cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first() - if (passwordCheckbox.eq(0)) { - passwordCheckbox.click({ force: true }); - cy.getActiveModal().find('input[type="password"]').type("1"); - cy.snipActiveModal("Modal_ShareView_Password"); - cy.getActiveModal().find('button:contains("Save password")').click(); - cy.toastWait("Successfully updated"); - } - + cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first().then(($el) => { + if (!$el.prop("checked")) { + cy.wrap($el).click({ force: true }); + cy.getActiveModal().find('input[type="password"]').type("1"); + cy.snipActiveModal("Modal_ShareView_Password"); + cy.getActiveModal().find('button:contains("Save password")').click(); + cy.toastWait("Successfully updated"); + } + }); + // copy link text, visit URL cy.getActiveModal() .find(".share-link-box")