Skip to content

Commit

Permalink
Merge pull request #135 from ProcessMaker/mobile_launchPad
Browse files Browse the repository at this point in the history
Mobile_launchPad
  • Loading branch information
karlOS123testing authored Jun 25, 2024
2 parents 8cc0087 + 210b07b commit 8c80d09
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
84 changes: 84 additions & 0 deletions pages/headerMobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import selectors from "../selectors/headerMobile"
export class HeaderMobile {
/**
* Method used to search a process and press `start` button from mobile view
* @param processName, Process name to create a Case
* @param nroStartEvent, A process can have many start events, then this parameter select one of them
*/
createCaseMobile(processName, nroStartEvent = 0){
cy.get(selectors.createCaseMobile).should("be.visible").click();
cy.get(selectors.panelCreateCase).eq(1).should("be.visible").within(() => {
cy.get(selectors.searchFieldCreateCase).type(processName, {delay:100});
cy.get(selectors.startButtonCreateCase).eq(nroStartEvent).click();
});
cy.get(selectors.HeaderMobile).should('be.visible');
}

/**
* header can select the option two options change to desktop view or logout
* @param {option} option
*/
selectOptionUser(option = "Log Out") {
let optionSelected = 1;
cy.get(selectors.headerUserButton).should("be.visible").click();
switch(option){
case "Switch to Desktop View":
optionSelected = 0;
break;
default:
optionSelected = 1;
}
cy.get(selectors.headerOptionList).should("be.visible").eq(optionSelected).click();
cy.url().should("contain", "/login");
}

/**
* Select a tab in mobile version
* @param {tabName} tabName should be Tasks, Cases, or default Processes tab
*/

selectTab(tabName){
switch(tabName){
case "Tasks":
cy.get(selectors.tabs).eq(0).click();
cy.url().should("contain", "/tasks");
break;
case "Cases":
cy.get(selectors.tabs).eq(1).click();
cy.url().should("contain", "/cases");
break;
default:
cy.get(selectors.tabs).eq(2).click();
cy.url().should("contain", "/process-browser");
}

}

/**
* Press back arroy button when a screen is displayed
*/
pressBackArroyTask() {
cy.get(selectors.backArroyButtonTask).should("be.visible").click();
}

/**
* Press `Prev` button when a screen is displayed
*/
pressPrevButtonTask() {
cy.get(selectors.prevButtonTask).should("be.visible").click();
}

/**
* Press `Next` button when a screen is displayed
*/
pressNextButtonTask() {
cy.get(selectors.nextButtonTask).should("be.visible").click();
}

/**
* Press `info` button when a screen is displayed
*/
pressInfoButtonTask() {
cy.get(selectors.infoButtonTask).should("be.visible").click();
}
}
32 changes: 32 additions & 0 deletions pages/loginMobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import selectors from "../selectors/loginMobile";
export class LoginMobile {
/**
* method to login with credentials, by default uses admin user.
* @param {username} username
* @param {password} password
*/
LoginMobile(username = Cypress.env("username"), password = Cypress.env("password")){
cy.visit("/");
cy.get("form")
.scrollIntoView()
.within(() => {
cy.get(selectors.usernameTxt).type(username);
cy.get(selectors.passwordTxt).type(password);
cy.get(selectors.loginBtn).click();
});
}

/**
* Use viewport in order to change the screen size
* @param {size} size, value can be an array or a string according to https://docs.cypress.io/api/commands/viewport#Arguments
*/
checkResolution(size) {
if (Cypress._.isArray(size)) {
cy.log("is array");
cy.viewport(size[0], size[1]);
} else {
cy.viewport(size);
}
}

}
14 changes: 14 additions & 0 deletions selectors/headerMobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
createCaseButton: 'button[id="navbar-request-button-mobile"]',
panelCreateCase: 'div[class="modal-content"]',
searchFieldCreateCase: '[data-test="new-request-modal-search-input"]',
startButtonCreateCase: 'button[data-test="new-request-modal-process-start-button"]',
headerMobile: 'div[id="navbarTaskMobile"]',
headerUserButton: '[class="content-nav"] a button[type="buttom"]',
headerOptionList: 'div a[class="dropdown-item"]',
tabs: 'li[role="presentation"]',
backArroyButtonTask: '[id="navbarTaskMobile"] button i[class="fas fa-arrow-left"]',
prevButtonTask: '[id="navbarTaskMobile"] button i[class="fas fa-chevron-left mr-1"]',
nextButtonTask: '[id="navbarTaskMobile"] button i[fas fa-chevron-right ml-1]',
infoButtonTask: '[id="navbarTaskMobile"] button i[class="fas fa-info-circle"]',
}
5 changes: 5 additions & 0 deletions selectors/loginMobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
usernameTxt: 'input[id="username"]',
passwordTxt: 'input[id="password"]',
loginBtn: 'button[type="submit"]',
}

0 comments on commit 8c80d09

Please sign in to comment.