Skip to content

Commit

Permalink
correct function Create Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
PaolaPellegrini committed Apr 30, 2024
1 parent 2b8eca9 commit c2cc8cf
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
56 changes: 48 additions & 8 deletions pages/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export class Screens {
}

selectScreenType(type) {
cy.get(Selectors.typeDropDown).select(type);
cy.xpath(Selectors.arrowTypeScreen).click();

//cy.xpath(Selectors.typeDropDown).click();
}

clickOnSave() {
cy.xpath(Selectors.saveBtn).should('be.visible').click();
cy.get(Selectors.saveBtn).should('be.visible').click();
}
clickOnPublishSave() {
cy.xpath(Selectors.savePublishBtn).should('be.visible').click();
Expand All @@ -34,15 +36,53 @@ export class Screens {
cy.get(Selectors.CategoryTxt).should('have.text','Uncategorized');
this.enterScreenName(name);
this.enterScreenDescription(description);
this.selectScreenType(type);
this.selectTypeScreen(type);
this.clickOnSave();
if (type == 'Conversational') {
cy.get(Selectors.saveScreenBtn).should('be.visible');
} else {
cy.get(Selectors.savePublishVersionsBtn).should('be.visible');
}
cy.get(Selectors.savePublishVersionsBtn).should('be.visible');

}

selectTypeScreen(
type = " ",

) {

{
cy.xpath(Selectors.arrowTypeScreen).should('be.visible');
cy.xpath(Selectors.arrowTypeScreen).click();

}

switch (type) {
case "Form":
this.selectScreenForm();
break;
case "Email":
this.selectScreenEmail();
break;
case "Display":
this.selectScreenDisplay();
break;
case "Conversational":
this.selectScreenConversational();
break;
}
}

selectScreenForm() {
cy.get(Selectors.screenTypeForm).eq(1).click();
}
selectScreenEmail() {
cy.get(Selectors.screenTypeEmail).click();
}
selectScreenDisplay() {
cy.get(Selectors.screenTypeDisplay).click();
}
selectScreenConversational() {
cy.get(Selectors.screenTypeConversational).click();
}


saveTheChanges(type) {
if (type == 'Conversational') {
this.clickOnSaveScreen();
Expand Down
9 changes: 7 additions & 2 deletions selectors/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ export default{
newAssetButton: '[data-cy="asset-search-menu"] button.btn.addBtn',
nameTxtBx: 'input[name="title"]',
descriptionTxtBx: '[name="description"]',
typeDropDown: 'select[name="type"]',
saveBtn: '//button[text()="Save"]',
arrowTypeScreen:'(//div[@class="multiselect__select"])[1]',
typeDropDown: '(//div[@data-cy="type-container-Form"])[1]',
screenTypeForm:'[data-cy="type-container-Form"]',
screenTypeEmail: '[data-cy="type-container-E-mail"]',
screenTypeDisplay: '[data-cy="type-container-Display"]',
screenTypeConversational: '[data-cy="type-container-Conversational"]',
saveBtn: '[data-cy="create_screen_save_btn"]',
savePublishBtn: '//button[text()="Publish"]',
varaibleNameTxtBx: '[name="Variable Name"]',
dataSourceDropDown: 'select#data-sources',
Expand Down

0 comments on commit c2cc8cf

Please sign in to comment.