generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/cypress all inputs test (#1783)
* digiwf-cypress refactor and cleanup classes * digiwf-cypress refactor and cleanup classes * digiwf-cypress refactor and cleanup classes * digiwf-cypress refactor input selector * digiwf-cypress refactor input selector * digiwf-cypress delay request to have minimal duration * digiwf-cypress env group name * digiwf-cypress increase timeout for loading btn * digiwf-cypress update dependencies * digiwf-cypress add prettier * digiwf-cypress refactor env usage * digiwf-cypress refactor task count compare and process start * digiwf-cypress increase load btn timeout to 30s * digiwf-cypress fix nav btns * digiwf-cypress init grouptask test * digiwf-cypress fix package-lock.json * digiwf-cypress refactor start waiting * digiwf-cypress update grouptask test * digiwf-cypress add code comments * digiwf-cypress refactor loading timeout * digiwf-cypress form extract task elements * digiwf-cypress tests use headline instead of inline string * digiwf-cypress form add single user input * digiwf-cypress init test example all input fields * digiwf-cypress init test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress fix pagination goToLastPage * digiwf-cypress update js docs * digiwf-cypress update test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress update test example all input fields * digiwf-cypress refactor reporter setup * digiwf-cypress fix typo * digiwf-cypress fix example grouptask test * digiwf-cypress update npm commands * digiwf-cypress increase default timeout * Revert "digiwf-cypress increase default timeout" This reverts commit c4daa20. * digiwf-cypress all inputs update number check * digiwf-cypress all inputs optional container selector workaround * digiwf-cypress all inputs add readonly page support * cypress increase default timeout * cypress update README.md
- Loading branch information
Showing
15 changed files
with
407 additions
and
1,262 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
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
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 |
---|---|---|
@@ -1,18 +1,131 @@ | ||
class Form { | ||
formElements = { | ||
form: () => cy.get(".container form .vjsf-property-allOf-0"), | ||
tab: (index) => | ||
cy.get( | ||
`.container form .v-tabs [role="tablist"] .v-tab:nth-of-type(${index + 1})` | ||
), | ||
loadingInput: () => cy.get(".container form .v-input--is-loading"), | ||
inputElement: (inputId) => | ||
cy.get( | ||
'.container form .vjsf-property[class*="' + | ||
inputId + | ||
' "] input[type!="hidden"]' | ||
`.container form .vjsf-property[class*="${inputId} "] input[type!="hidden"]` | ||
), | ||
textareaElement: (inputId) => | ||
cy.get( | ||
`.container form .vjsf-property[class*="${inputId} "] textarea[type!="hidden"]:visible` | ||
), | ||
markdownReadonly: (inputId) => | ||
cy.get(`.container form .vjsf-property[class*="${inputId} "] .v-card`), | ||
checkboxElement: (inputId) => | ||
cy.get( | ||
'.container form .vjsf-property[class*="' + | ||
inputId + | ||
' "] .v-input--selection-controls__input' | ||
`.container form .vjsf-property[class*="${inputId} "] .v-input--selection-controls__input` | ||
), | ||
switchElement: (inputId) => | ||
cy.get( | ||
`.container form .vjsf-property[class*="${inputId} "] .v-input--selection-controls__ripple` | ||
), | ||
selectDropdown: (index) => | ||
cy.get(`[role="listbox"]:visible .v-list-item:nth-child(${index + 1})`), | ||
comboboxValues: (input) => input.parent().find("span span"), | ||
multiFileValues: (input) => | ||
input | ||
.closest(".vjsf-property") | ||
.find(".listWrapper .doc-card .v-card__title div"), | ||
}; | ||
|
||
waitFormVisible() { | ||
this.formElements.form().should("be.visible"); | ||
} | ||
|
||
waitLoadingFinished() { | ||
this.formElements.loadingInput().should("not.exist"); | ||
} | ||
|
||
setUserInput(input, user) { | ||
input.type(user, { force: true }); | ||
cy.wait("@dataUserSearch").its("response.statusCode").should("equal", 200); | ||
this.formElements | ||
.selectDropdown(0) | ||
.contains("Benutzer werden gesucht") | ||
.should("not.exist"); | ||
this.formElements.selectDropdown(0).click(); | ||
} | ||
|
||
setSelect(input, indexes) { | ||
input.click(); | ||
for (const i of indexes) { | ||
this.formElements.selectDropdown(i).click(); | ||
} | ||
} | ||
|
||
selectHasValue(input, items) { | ||
let res = []; | ||
input | ||
.parent() | ||
.find(".v-select__selection span") | ||
.each((i) => { | ||
cy.wrap(i) | ||
.invoke("text") | ||
.then((text) => { | ||
res.push(text.trim().replace(",", "")); | ||
}); | ||
}); | ||
cy.wrap(res).then((i) => { | ||
expect(i.sort()).to.deep.eq(items.sort()); | ||
}); | ||
} | ||
|
||
multiFileInputHasValues(input, values) { | ||
let res = []; | ||
this.formElements.multiFileValues(input).each((i) => { | ||
cy.wrap(i) | ||
.invoke("text") | ||
.then((text) => { | ||
res.push(text.trim()); | ||
}); | ||
}); | ||
cy.wrap(res).then((i) => { | ||
expect(i.sort()).to.deep.eq(values.sort()); | ||
}); | ||
} | ||
|
||
userInputHasValue(input, user) { | ||
input | ||
.siblings("div") | ||
.invoke("text") | ||
.then((text) => text.trim()) | ||
.should("eq", user); | ||
} | ||
|
||
comboboxHasValues(input, values) { | ||
let res = []; | ||
this.formElements.comboboxValues(input).each((i) => { | ||
cy.wrap(i) | ||
.invoke("text") | ||
.then((text) => { | ||
res.push(text.trim()); | ||
}); | ||
}); | ||
cy.wrap(res).then((i) => { | ||
expect(i.sort()).to.deep.eq(values.sort()); | ||
}); | ||
} | ||
|
||
markdownHasValue(input, value) { | ||
input | ||
.closest(".vjsf-property") | ||
.find('div.EasyMDEContainer [role="presentation"] pre:visible') | ||
.invoke("text") | ||
.then((text) => { | ||
cy.wrap(text).should("eq", value); | ||
}); | ||
} | ||
|
||
markdownHasValueReadonly(input, value) { | ||
input.invoke("text").then((text) => { | ||
cy.wrap(text).should("eq", value); | ||
}); | ||
} | ||
} | ||
|
||
export default Form; |
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
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
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
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
55 changes: 55 additions & 0 deletions
55
digiwf-cypress/cypress/e2e/3-example-all-input-fields.cy.js
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,55 @@ | ||
import nav from "../components/nav"; | ||
import { USER_REALNAME } from "../constants/env"; | ||
import exampleAllInputFields from "../pages/processes/exampleAllInputFields"; | ||
import exampleAllInputFieldsStart from "../pages/processes/exampleAllInputFieldsStart"; | ||
|
||
beforeEach(() => { | ||
cy.loginDefault(); | ||
}); | ||
|
||
describe("Example All Input Fields", () => { | ||
it("passes", () => { | ||
cy.visit("/"); | ||
|
||
cy.log("Start process"); | ||
let startProcess = nav.openStartProcess(); | ||
startProcess.startProcess(exampleAllInputFieldsStart.headline); | ||
exampleAllInputFieldsStart.checkHeadline(); | ||
exampleAllInputFieldsStart.setUser(USER_REALNAME); | ||
exampleAllInputFieldsStart.clickComplete(); | ||
|
||
cy.log("Fill out first task"); | ||
let myTasks = nav.openMyTasks(); | ||
myTasks.itemContainsText(0, exampleAllInputFields.headline1); | ||
myTasks.itemContainsText(0, exampleAllInputFieldsStart.headline); | ||
myTasks.clickItem(0); | ||
exampleAllInputFields.checkHeadline1(); | ||
exampleAllInputFields.waitFormVisible(); | ||
exampleAllInputFields.clickComplete(); | ||
exampleAllInputFields.hasValidationAlert(); | ||
exampleAllInputFields.fillDefault(); | ||
exampleAllInputFields.clickComplete(); | ||
|
||
cy.log("Validate second task"); | ||
myTasks.waitNoUncompletedTasks(); | ||
myTasks.itemContainsText(0, exampleAllInputFields.headline2); | ||
myTasks.itemContainsText(0, exampleAllInputFieldsStart.headline); | ||
myTasks.clickItem(0); | ||
exampleAllInputFields.checkHeadline2(); | ||
exampleAllInputFields.waitFormVisible(); | ||
exampleAllInputFields.validateDefault(); | ||
exampleAllInputFields.clickComplete(); | ||
myTasks.waitNoUncompletedTasks(); | ||
|
||
cy.log("Readonly task"); | ||
myTasks.waitNoUncompletedTasks(); | ||
myTasks.itemContainsText(0, exampleAllInputFields.headlineReadonly); | ||
myTasks.itemContainsText(0, exampleAllInputFieldsStart.headline); | ||
myTasks.clickItem(0); | ||
exampleAllInputFields.checkHeadlineReadonly(); | ||
exampleAllInputFields.waitFormVisible(); | ||
exampleAllInputFields.validateDefault(true); | ||
exampleAllInputFields.clickComplete(); | ||
myTasks.waitNoUncompletedTasks(); | ||
}); | ||
}); |
Oops, something went wrong.