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...