-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from ProcessMaker/mobile_launchPad
Mobile_launchPad
- Loading branch information
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]', | ||
} |