diff --git a/pages/abTesting.js b/pages/abTesting.js index 85e7328..b60384f 100644 --- a/pages/abTesting.js +++ b/pages/abTesting.js @@ -84,6 +84,7 @@ export class ABTesting { //Publish New Version publishNewVersion(option, iframeOption, alternative, version, description) { this.clickOnPublishBtn(iframeOption); + this.load(); switch (option) { case 'withoutAB': break; @@ -98,8 +99,7 @@ export class ABTesting { default: break; } - this.load(); - this.clickOnPublishBtnInModal(); + this.clickOnPublishBtnInModal(iframeOption); } alert(iframeOption = 'a') { @@ -124,21 +124,25 @@ export class ABTesting { selectAlternativeA(iframeOption = 'a') { let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB + cy.iframe(iframeSelector).find(selectors.alternativeA_Btn).should('be.visible'); cy.iframe(iframeSelector).find(selectors.alternativeA_Btn).click(); } selectAlternativeB(iframeOption = 'a') { let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB + cy.iframe(iframeSelector).find(selectors.alternativeB_Btn).should('be.visible'); cy.iframe(iframeSelector).find(selectors.alternativeB_Btn).click(); } selectAlternativeAB(iframeOption = 'a') { let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB + cy.iframe(iframeSelector).find(selectors.alternativeAB_Btn).should('be.visible'); cy.iframe(iframeSelector).find(selectors.alternativeAB_Btn).click(); } - clickOnPublishBtnInModal() { - cy.iframe(selectors.iframeA).find(selectors.publishBtnInModal).click({ force: true }); + clickOnPublishBtnInModal(iframeOption) { + let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB + cy.iframe(iframeSelector).find(selectors.publishBtnInModal).click({ force: true }); } clickOnSaveAndPublish(iframeOption = 'a') { diff --git a/selectors/abTesting.js b/selectors/abTesting.js index 377bd35..54b17b2 100644 --- a/selectors/abTesting.js +++ b/selectors/abTesting.js @@ -23,8 +23,8 @@ export default { publishBtn: '[data-cy="publish-btn"]', modalPublishVersion: '[class="modal-dialog modal-lg modal-dialog-centered"]', publishBtnInModal: '[data-test="btn-save-publish"]', - alternativeA_Btn: '[data-test="btn-alternative-a"]', - alternativeB_Btn: '[data-test="btn-alternative-b"]', + alternativeA_Btn: 'button[data-test="btn-alternative-a"]', + alternativeB_Btn: 'button[data-test="btn-alternative-b"]', alternativeAB_Btn: '[data-test="btn-alternative-ab"]', saveAndPublish: '[data-test="btn-save-publish"]', version: 'input[name="version"]',