Skip to content

Commit

Permalink
Merge pull request #36 from ProcessMaker/newFunctioncreateScreenFromT…
Browse files Browse the repository at this point in the history
…emplate

new  function for  screen template
  • Loading branch information
PaolaPellegrini authored May 3, 2024
2 parents 4d3d189 + 0c9f599 commit 9a59300
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 17 deletions.
115 changes: 98 additions & 17 deletions pages/screenTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,7 @@ verifyPresenceOfScreenSharedtemplateAndImport(screenTemplateSharedTemplate, scre
cy.get(Selectors.fileBtn).attachFile(screenTemplatePath);
cy.get(selectors.importBtnScreenSharedTemplate).click();
}
/* cy.xpath(selectors.ImportButtonMyTemplate).first().click();
cy.xpath(selectors.titleImportScreenTemplate)
.first()
.should("have.text", "Import Screen Template")
.should("be.visible");
cy.get(selectors.browseScreenTemplate).attachFile(screenTemplatePath);
cy.xpath(selectors.importBtnScreentemplate)
.parent()
.should("have.attr", "disabled", "disabled");
cy.xpath(selectors.importBtnScreentemplate)
.parent()
.should("not.have.attr", "disabled", "disabled");
cy.xpath(selectors.importBtnScreentemplate).click();
cy.get(selectors.loadingScreenTemplateSpinner).should("not.exist");*/

//}


verifyPresenceOfScreenTemplateAndCreate(nameScreenTemplate) {

cy.xpath('//*[@id="nav-myTemplates-tab"]').should('be.visible').click();
Expand Down Expand Up @@ -378,4 +362,101 @@ verifyPresenceOfScreenSharedtemplateAndImport(screenTemplateSharedTemplate, scre
});
}

createScreenFromTemplate(name, description, type, typeScreenTemplate, nameTemplate) {
this.clickOnAddScreen();
cy.get(Selectors.CategoryTxt).should('have.text','Uncategorized');
this.enterScreenName(name);
this.enterScreenDescription(description);
this.selectTypeScreen(type);
this.selectTypeTemplate(typeScreenTemplate);
this.selectTemplate(nameTemplate);
this.clickOnSave();
cy.get(Selectors.savePublishVersionsBtn).should('be.visible');

}

clickOnAddScreen() {
cy.get(Selectors.addScreenButton).click();
}
enterScreenName(name) {
cy.get(Selectors.nameTxtBx).type(name).should('have.value', name);
}
enterScreenDescription(description) {
cy.get(Selectors.descriptionTxtBx).type(description).should('have.value', description);
}
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();
}

selectTypeTemplate(typeScreenTemplate = " ")
{
cy.xpath(selectors.arrowTypeTemplate).should('be.visible');
cy.xpath(selectors.arrowTypeTemplate).click();

switch (typeScreenTemplate)
{
case "Shared":
this.selectSharedTemplate();
break;
case "My Templates":
this.selectMyTemplate();
break;
}
}

selectSharedTemplate() {
cy.get(selectors.sharedTemplateType).eq(1).click();
}

selectMyTemplate() {
cy.get(selectors.myTemplateType).should('be.visible').click();
}

selectTemplate(nameTemplate) {

cy.get(selectors.selectScreenTemplate.replace('CustomCard',nameTemplate+'-card')).click({force:true});

}


clickOnSave() {
cy.get(Selectors.saveBtn).should('be.visible').should('be.visible').click({force:true});
}




}
4 changes: 4 additions & 0 deletions selectors/screenTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export default {
saveButtonConfiguration: '//button[text()="Save"]',
txtDescriptionConfiguration: '//*[@id="description-text"]',
versionConfiguration: '//*[@id="version-text"]',
arrowTypeTemplate: '(//div[@class="multiselect__select"])[2]',
sharedTemplateType: '[data-cy="type-container-Shared Templates"]',
myTemplateType: '[data-cy="type-container-My Templates"]',
selectScreenTemplate:'[data-cy="CustomCard"] input',


}

0 comments on commit 9a59300

Please sign in to comment.