Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
coverage/
node_modules/
npm-debug.log
debug.log
12 changes: 12 additions & 0 deletions model/endTestEmailModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import EndTestEmail from "@pages/EndTestEmail"

class EndTestEmailModel {
verifyFirstEndTestEmail(email){
EndTestEmail.verifyFirstEndTestEmail(email)
}

deleteEmailEndTest(email){
EndTestEmail.deleteEmails(email)
}
}
export default new EndTestEmailModel();
15 changes: 13 additions & 2 deletions model/processModel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ProcessV1 } from "../pages/processV1";
import { ProcessV1 } from "#pages/processV1"
import { ProcessAPI } from "#pages/processAPI"
const processPage = new ProcessV1()

const processAPI = new ProcessAPI()
export class ProcessModel {
/**
* Publishes a process with optional version data
Expand Down Expand Up @@ -52,4 +53,14 @@ export class ProcessModel {
processPage.pressDiscardButtonModal()
}

openCreatedRequest(processData){
processData.then(processData => {
processPage.openRequestByID(processData.id)
})
}

createRequestAPI(processId, nodeId, data = {}){
return processAPI.returnDataStartProcessAPI(processId, nodeId, data)
}

}
60 changes: 60 additions & 0 deletions model/savedSearchModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import savedSearchAPI from "@pages/savedSearchAPI";
import savedSearchAction from "@pages/savedSearchV1";

class savedSearchModel {

createSavedSearchAPI(data) {
return savedSearchAPI.createSavedSearchAPI(data)
}

deleteSavedSearchByIdAPI(id, time=2000) {
return savedSearchAPI.deleteSavedSearchByIdAPI(id, time)
}

openSavedSearchByObject(objSS, type) {
savedSearchAction.openSavedSearchByObject(objSS, type)
}

openSavedSearchById(id, type){
savedSearchAction.gotoSavedSearchByID(type, id)
}

searchSavedSearch(criteria) {
savedSearchAction.searchSavedSearch(criteria)
}

pressNotificationButton(){
savedSearchAction.pressNotificationButton()
}

pressConfigurationButton(){
savedSearchAction.pressConfigurationButton()
}

pressColumnTabSavedSearchById(){
savedSearchAction.pressColumnsButton()
}

pressTab(name){
savedSearchAction.pressTab(name);
}

createChartAPI(savedSearchID, payload){
savedSearchAPI.createChartAPI(savedSearchID, payload)
}

updateSavedSearch(savedSearchID, payload){
savedSearchAPI.updateSavedSearchAPI(savedSearchID, payload)
}

sendReportSavedSearch(payload){
savedSearchAction.pressSendReportButton()
savedSearchAction.fillSendTo(payload.sendTo.type, payload.sendTo.selector, payload.sendTo.value)
savedSearchAction.fillEmailSubject(payload.subject.type, payload.subject.selector, payload.subject.value)
savedSearchAction.fillBody(payload.body.type, payload.body.selector, payload.body.value)
savedSearchAction.pressSaveReport(payload.sendReport.type, payload.sendReport.selector)
}

}

export default new savedSearchModel();
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"#pages/*": "./pages/*",
"#selectors/*": "./selectors/*",
"#support/*": "./support/*",
"#model/*": "./model/*"
"#model/*": "./model/*",
"#verify/*": "./verify/*"
},
"devDependencies": {
"@4tw/cypress-drag-drop": "^2.2.5",
Expand Down
38 changes: 38 additions & 0 deletions pages/endTestEmail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class EndTestEmail {
returnEndTestMainElement(){
return cy.get("div.email_list div.email_item")
}

returnSubjectEndTest(){
return cy.get("div.email_subject")
}

returnFromEndTest(){
return cy.get("div.email_from")
}

deleteEmails(email){
cy.session("delete email endTest", () => {
cy.visit(`https://app.endtest.io/mailbox?email=${email}&action=delete`)
})
}
verifyFirstEndTestEmail(emailData){
cy.session("Verify email endTest", () => {
cy.visit("https://app.endtest.io/")
cy.wait(emailData.time)
cy.visit(`https://app.endtest.io/mailbox?email=${emailData.email}`)
this.returnEndTestMainElement().should("be.visible").first().then(($el)=>{
cy.wrap($el).within(() => {
this.returnSubjectEndTest().then(($subject)=>{
expect(emailData.subject).to.include($subject.text().trim())
})
this.returnFromEndTest().then(($email)=>{
expect($email.text().trim()).to.be.eq(emailData.from)
})
})
})
});
}
}

export default new EndTestEmail();
22 changes: 22 additions & 0 deletions pages/processAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,26 @@ export class ProcessAPI {
});
});
}


/**
* Starts a process instance using the ProcessMaker API
* @param {string|number} processId - The ID of the process to start
* @param {string} nodeId - The node ID where the process should start
* @param {Object} data - Optional data to pass to the process instance
* @returns {Promise<object>} - A promise that resolves to the process data
*/
returnDataStartProcessAPI(processId, nodeId, data = {}) {
return cy.window().then(win => {
return win.ProcessMaker.apiClient.post(
'process_events/' + processId,
data,
{
params: { event: nodeId }
}
).then(response => {
return response.data;
});
})
}
}
4 changes: 4 additions & 0 deletions pages/processV1.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ export class ProcessV1 {
cy.get(selectors.discardButton).contains(optionButton).click()
})
}

openRequestByID(id){
cy.visit(`/requests/${id}`)
}
}
49 changes: 49 additions & 0 deletions pages/savedSearchAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class SavedSearchAPI {

createSavedSearchAPI(data) {
return cy.window().then(win => {
return win.ProcessMaker.apiClient.post(
'/saved-searches',
data
).then(response => {
console.log(">>>"+response.data)
return response.data
});
});
}

deleteSavedSearchByIdAPI(savedSearchID, staticTime=2000) {
cy.wait(staticTime)
return cy.window().then(win => {
return win.ProcessMaker.apiClient.delete(
'/saved-searches/'+savedSearchID
).then(response => {
console.log(`saved search by ID ${savedSearchID} was deleted > `+response)
});
});
}

createChartAPI(savedSearchID, payload){
return cy.window().then(win => {
return win.ProcessMaker.apiClient.post(
`/saved-searches/${savedSearchID}/charts`,
payload
).then(response => {
return response.data
});
});
}

updateSavedSearchAPI(savedSearchID, payload){
return cy.window().then(win => {
return win.ProcessMaker.apiClient.put(
`/saved-searches/${savedSearchID}`,
payload
).then(response => {
return response.data
});
});
}
}

export default new SavedSearchAPI();
139 changes: 139 additions & 0 deletions pages/savedSearchV1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import selector from "#selectors/savedSearchV1";

class savedSearchAction {

gotoSavedSearchByID(type="requets", id) {
let url
if(type = "requests")
url = `/requests/saved-searches/${id}`
else
url = `/tasks/saved-searches/${id}`
cy.visit(url)
}

openSavedSearchByObject(objSS, type) {
objSS.then((objSS) => {
this.gotoSavedSearchByID(type, objSS.id)
})
}

getSaveSearchTab() {
return cy.get(selector.tabList)
}

getColumnTabSaveSearch(){
return cy.get(selector.columnTab)
}

getSearchSavedSeachField() {
return cy.get(selector.searchField)
}

getPressSendReportButton() {
return cy.get(selector.sendReportBtn)
}

getPressScheduleReportsButton() {
return cy.get(selector.scheduleReportBtn)
}

getNotificationButton() {
return cy.get(selector.notificationBtn)
}

getConfigurationButton() {
return cy.get(selector.configurationBtn)
}
//accepts "Data" or "Charts"
pressTab(tabName) {
const index = (tabName == "Data") ? 0 : 1;
this.getSaveSearchTab().eq(index).click()
}

searchSavedSearch(criteria) {
this.getSearchSavedSeachField().clear().type(criteria)
this.getSearchSavedSeachField().type('{enter}')
}
pressSendReportButton() {
this.getPressSendReportButton().click()
}
pressScheduleReportsButton() {
this.getPressScheduleReportsButton().click()
}
pressNotificationButton() {
this.getNotificationButton().click()
}
pressConfigurationButton() {
this.getConfigurationButton().click()
}

pressColumnsButton(){
this.getColumnTabSaveSearch().click()
}

addNameChartConfig(nameChart){
cy.get("div[class='saved-search-chart-config'] input[name='title']").type(nameChart)
}
selectChartTypeConfig(type){
let chartType
switch(type){
case "vertical":
chartType = cy.get("div[class='saved-search-chart-config'] canvas[id='bar-chart']")
break
case "Line":
chartType = cy.get("div[class='saved-search-chart-config'] canvas[id='line-chart']")
break
case "Pie":
chartType = cy.get("div[class='saved-search-chart-config'] canvas[id='pie-chart']")
break
case "Doughnut":
chartType = cy.get("div[class='saved-search-chart-config'] canvas[id='doughnut-chart']")
break
case "Count":
chartType = cy.get("div[class='saved-search-chart-config'] div.count-chart-preview")
break
case "List":
chartType = cy.get("div[class='saved-search-chart-config'] div.list-chart-preview")
break
default:
//"bar (horizontal)"
chartType = cy.get("div[class='saved-search-chart-config'] canvas[id='horizontalbar-chart']")
break
}
chartType.click()
}
selectGeneralTabChartConfig(){
cy.get("div[class='saved-search-chart-config'] a[id='general-tab']").click()
}
selectSourceTabChartConfig(){
cy.get("div[class='saved-search-chart-config'] a[id='data-tab']").click()
}
selectDisplayTabChartConfig(){
cy.get("div[class='saved-search-chart-config'] a[id='display-tab']").click()
}

fillSendTo(t, element, text){
if(t == "css"){
cy.get(element).type(text)
}else{
cy.xpath(element).type(text)
}
}

fillEmailSubject(t, element, text){
const selector = (t == "css") ? cy.get(element) : cy.xpath(element);
selector.type(text);
}

fillBody(t, element, text){
const selector = (t == "css") ? cy.get(element) : cy.xpath(element);
selector.type(text);
}

pressSaveReport(t, element){
const selector = (t=="css") ? cy.get(element): cy.xpath(element)
selector.click()
}
}

export default new savedSearchAction();
9 changes: 9 additions & 0 deletions selectors/savedSearchV1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
tabList: '[role="tablist"] li a',
searchField: 'textarea[placeholder="Search here"]',
sendReportBtn: 'button[title="Send Report"]',
scheduleReportBtn: 'a[title="Scheduled Reports"]',
notificationBtn: 'button[title="Enable Notifications"]',
configurationBtn: 'a[title="Configure Saved Search"]',
columnTab: "[id='nav-columns-tab']",
}
Loading
Loading