Skip to content

Commit

Permalink
Update methods and selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
WendyFPM committed May 1, 2024
1 parent be3e466 commit 2447fe8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 22 additions & 6 deletions pages/abTesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class ABTesting {
return;
} else {
this.clickOnPlusBtn();
this.clickOnConfirmBtn({ force: true });
this.clickOnConfirmEnableBtn({ force: true });
}
})
}
Expand All @@ -25,11 +25,18 @@ export class ABTesting {
cy.iframe(selectors.iframeA).find(selectors.plusTab).click({ force: true, delay: 1000 });
}

clickOnConfirmBtn() {
clickOnConfirmEnableBtn() {
cy.iframe(selectors.iframeA).find('[class="modal-content"]').should('be.visible');
cy.iframe(selectors.iframeA).find(selectors.confirmBtn).should('be.visible');
cy.wait(2000)
cy.iframe(selectors.iframeA).find(selectors.confirmBtn).click({ force: true, delay: 1000 });
cy.wait(2000);
cy.iframe(selectors.iframeA).find(selectors.confirmEnableBtn).should('be.visible');
cy.iframe(selectors.iframeA).find(selectors.confirmEnableBtn).click({ force: true, delay: 1000 });
}

clickOnConfirmDeleteBtn() {
cy.iframe(selectors.iframeA).find('[class="modal-content"]').should('be.visible');
cy.wait(2000);
cy.iframe(selectors.iframeA).find(selectors.confirmDeleteBtn).should('be.visible');
cy.iframe(selectors.iframeA).find(selectors.confirmDeleteBtn).click({ force: true, delay: 1000 });
}

replaceAlternativeAWithDataOfAlternativeB(iframeOption) {
Expand Down Expand Up @@ -58,7 +65,16 @@ export class ABTesting {

deleteAlternativeB() {
cy.iframe(selectors.iframeA).find(selectors.deleteAltB_Btn).first().click();
this.clickOnConfirmBtn();
this.clickOnConfirmDeleteBtn();
}

deleteAlternativeB_ifExist() {
cy.iframe(selectors.iframeA).find(selectors.menuAB).invoke('text').then($text => {
cy.log($text)
if ($text.includes('Alternative B')) {
this.deleteAlternativeB();
}
})
}

//Publish New Version
Expand Down
4 changes: 2 additions & 2 deletions selectors/abTesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default {
alternativeB_Tab: '[data-test="tab-B"]',
plusTab: '[data-test="tab-plus"]',
deleteAltB_Btn: '[id="tab-B-remove"]',
confirmBtn: 'button[data-test="ab-enable-alternative-ok"]',

confirmEnableBtn: 'button[data-test="ab-enable-alternative-ok"]',
confirmDeleteBtn: 'button[data-test="ab-delete-alternative-ok"]',

//Replace alternative
replaceAlternativeBtn: '[data-test="tab-replace"]',
Expand Down

0 comments on commit 2447fe8

Please sign in to comment.