Taking a final step with test functions
The tests that we created consist of chains of actions. Some of them, such as the Creating a new project
test, are still being repeated. So, one final logical step to take will be to separate such sequences of actions into the functions. Let's see how this can be achieved with the createNewProject
, createNewIssue
, and uploadFile
functions inside redmine-page.js
:
const { Selector, ClientFunction, Role, t } = require('testcafe');const { stamp } = require('js-automation-tools');// ...redminePage.getPageUrl = ClientFunction(() => {Â Â Â Â return window.location.href;});redminePage.regularUser = Role(redminePage.urlRedmine, async (t) => {Â Â Â Â await t.click(redminePage.linkLogin)Â Â Â Â Â Â Â Â .typeText(redminePage.inputUsername, redminePage.emailRegularUser)Â Â Â Â Â Â Â Â .typeText(redminePage.inputPassword, redminePage...