diff --git a/tests/e2e/default/enketo/edit-report-with-attachment.wdio-spec.js b/tests/e2e/default/enketo/edit-report-with-attachment.wdio-spec.js index 4efc273e053..6ee7882566e 100644 --- a/tests/e2e/default/enketo/edit-report-with-attachment.wdio-spec.js +++ b/tests/e2e/default/enketo/edit-report-with-attachment.wdio-spec.js @@ -6,7 +6,6 @@ const loginPage = require('@page-objects/default/login/login.wdio.page'); const utils = require('@utils'); const userData = require('@page-objects/default/users/user.data'); const fs = require('fs'); -const commonElements = require('@page-objects/default/common/common.wdio.page'); const oneTextForm = fs.readFileSync(`${__dirname}/forms/one-text-form.xml`, 'utf8'); const instanceID = uuid(); @@ -65,14 +64,11 @@ describe('Edit report with attachmnet', () => { await utils.seedTestData(userContactDoc, [...docs, formDoc]); await loginPage.cookieLogin(); await common.hideSnackbar(); - }); - - it('should remove attachment when saving', async () => { reportDoc._id = uuid(); await utils.saveDoc(reportDoc); + }); - await commonElements.goToReports(); - + it('should remove attachment when saving', async () => { await reportsPage.editReport(reportDoc._id); await reportsPage.submitForm(); @@ -89,10 +85,6 @@ describe('Edit report with attachmnet', () => { }); it('should save edits', async () => { - reportDoc._id = uuid(); - await utils.saveDoc(reportDoc); - - await commonElements.goToReports(); await reportsPage.editReport(reportDoc._id); await (await genericForm.fieldByName(formDoc.internalId, 'intro')).setValue('updated text'); await reportsPage.submitForm(); diff --git a/tests/e2e/default/enketo/training-cards.wdio-spec.js b/tests/e2e/default/enketo/training-cards.wdio-spec.js index 9a6777af483..12991d523c6 100644 --- a/tests/e2e/default/enketo/training-cards.wdio-spec.js +++ b/tests/e2e/default/enketo/training-cards.wdio-spec.js @@ -47,7 +47,6 @@ describe('Training Cards', () => { }); it('should cancel training and not save it as completed', async () => { - await commonPage.goToMessages(); await trainingCardsPage.waitForTrainingCards(); const confirmMessage = await trainingCardsPage.quitTraining(); diff --git a/tests/e2e/default/reports/reports-subject.wdio-spec.js b/tests/e2e/default/reports/reports-subject.wdio-spec.js index 9cb2643294f..fdde40baa2e 100644 --- a/tests/e2e/default/reports/reports-subject.wdio-spec.js +++ b/tests/e2e/default/reports/reports-subject.wdio-spec.js @@ -30,7 +30,7 @@ describe('Reports Subject', () => { subject = person.name, lineage = `${clinic.name}${healthCenter.name}${districtHospital.name}` }) => { - await commonPage.refresh(); + await commonPage.goToPeople(); await commonPage.goToReports(); const firstReport = await reportsPage.firstReport(); await reportsPage.openSelectedReport(firstReport); diff --git a/tests/e2e/default/users/add-user.wdio-spec.js b/tests/e2e/default/users/add-user.wdio-spec.js index 662588c904a..364806d6dbc 100644 --- a/tests/e2e/default/users/add-user.wdio-spec.js +++ b/tests/e2e/default/users/add-user.wdio-spec.js @@ -31,6 +31,9 @@ describe('User Test Cases ->', () => { }); beforeEach(async () => { + if (await usersAdminPage.addUserDialog().isDisplayed()) { + await usersAdminPage.closeAddUserDialog(); + } await usersAdminPage.goToAdminUser(); await usersAdminPage.openAddUserDialog(); }); diff --git a/tests/page-objects/default/reports/reports.wdio.page.js b/tests/page-objects/default/reports/reports.wdio.page.js index e2aeaf2a779..fc5a5212e46 100644 --- a/tests/page-objects/default/reports/reports.wdio.page.js +++ b/tests/page-objects/default/reports/reports.wdio.page.js @@ -367,7 +367,7 @@ const resetFilter = async () => { const openReport = async (reportId) => { await (await firstReport()).waitForDisplayed(); const reportListItem = await reportByUUID(reportId); - await reportListItem.waitForDisplayed(); + await reportListItem.waitForClickable(); await reportListItem.click(); await reportBodyDetails().waitForDisplayed(); }; diff --git a/tests/page-objects/default/users/user.wdio.page.js b/tests/page-objects/default/users/user.wdio.page.js index 8cfcd765bc1..da49bd8596d 100644 --- a/tests/page-objects/default/users/user.wdio.page.js +++ b/tests/page-objects/default/users/user.wdio.page.js @@ -1,12 +1,13 @@ const _ = require('lodash'); const commonElements = require('../common/common.wdio.page'); const addUserButton = () => $('a#add-user'); +const cancelButton = () => $('a[test-id="modal-cancel-btn"]'); const addUserDialog = () => $('div#edit-user-profile'); const userName = () => $('#edit-username'); const userFullName = () => $('#fullname'); const userPassword = () => $('#edit-password'); const userConfirmPassword = () => $('#edit-password-confirm'); -const saveUserButton = () => $('//a[@test-id="modal-submit-btn"]'); +const saveUserButton = () => $('a[test-id="modal-submit-btn"]'); const logoutButton = () => $('i.fa-power-off'); const usernameTextSelector = '[test-id="username-list"]'; const usernameText = () => $(usernameTextSelector); @@ -48,8 +49,8 @@ const scrollToBottomOfModal = async () => { }; const inputAddUserFields = async (username, fullname, role, place, contact, password, confirmPassword = password) => { - await (await userName()).addValue(username); - await (await userFullName()).addValue(fullname); + await (await userName()).setValue(username); + await (await userFullName()).setValue(fullname); await (await $(`#role-select input[value="${role}"]`)).click(); // we need to scroll to the bottom to bring the select2 elements into view @@ -64,8 +65,8 @@ const inputAddUserFields = async (username, fullname, role, place, contact, pass await selectContact(contact); } - await (await userPassword()).addValue(password); - await (await userConfirmPassword()).addValue(confirmPassword); + await (await userPassword()).setValue(password); + await (await userConfirmPassword()).setValue(confirmPassword); }; const inputUploadUsersFields = async (filePath) => { @@ -96,7 +97,7 @@ const selectContact = async (associatedContact) => { }; const saveUser = async (isSuccessExpected = true) => { - await (await saveUserButton()).waitForDisplayed(); + await (await saveUserButton()).waitForClickable(); await (await saveUserButton()).click(); if (isSuccessExpected) { await (await addUserDialog()).waitForDisplayed({ reverse: true }); @@ -123,6 +124,7 @@ const getUsernameErrorText = async () => { }; const getPasswordErrorText = async () => { + await (await passwordErrorMessage()).waitForDisplayed(); return await (await passwordErrorMessage()).getText(); }; @@ -163,7 +165,15 @@ const waitForUploadSummary = async () => { await (await uploadSummaryDialog()).waitForDisplayed(); }; +const closeAddUserDialog = async () => { + await (await cancelButton()).waitForClickable(); + await (await cancelButton()).click(); + await (await addUserDialog()).waitForDisplayed({ reverse: true }); +}; + + module.exports = { + addUserDialog, goToAdminUser, goToAdminUpgrade, openAddUserDialog, @@ -182,5 +192,6 @@ module.exports = { getSuccessfulyUploadedUsers, getPreviouslyUploadedUsers, getFailedUploadedUsers, - backToUserList + backToUserList, + closeAddUserDialog, };