Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(#9523): upgrade WebdriverIO to v9 #9627

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
4,501 changes: 3,365 additions & 1,136 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@
"@typescript-eslint/eslint-plugin": "7.5",
"@typescript-eslint/parser": "7.5",
"@typescript-eslint/utils": "8.11",
"@wdio/allure-reporter": "^8.34.0",
"@wdio/appium-service": "^8.36.1",
"@wdio/cli": "^8.35.1",
"@wdio/devtools-service": "^8.35.1",
"@wdio/local-runner": "^8.35.1",
"@wdio/mocha-framework": "^8.35.0",
"@wdio/spec-reporter": "^8.32.4",
"allure-commandline": "^2.24.0",
"@wdio/allure-reporter": "^9.1.3",
"@wdio/appium-service": "^9.2.1",
"@wdio/cli": "^9.2.1",
"@wdio/devtools-service": "^8.40.2",
"@wdio/local-runner": "^9.2.1",
"@wdio/mocha-framework": "^9.1.3",
"@wdio/spec-reporter": "^9.1.3",
"allure-commandline": "^2.30.0",
"appium-uiautomator2-driver": "^3.0.0",
"browserify": "^17.0.0",
"browserify-ngannotate": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('More Options Menu - Offline User', () => {
describe('Message tab', () => {
it('should hide the kebab menu.', async () => {
await sms.sendSms('testing', contact.phone);
expect(await (await commonPage.moreOptionsMenu()).isExisting()).to.be.false;
expect(await commonPage.moreOptionsMenu().isExisting()).to.be.false;
});
});

Expand Down Expand Up @@ -93,7 +93,7 @@ describe('More Options Menu - Offline User', () => {
it('should hide the \'export\' and \'edit\' options and ' +
'enable the \'delete\' and \'review\' options when the sms report is opened', async () => {
await commonPage.goToReports();
expect(await (await commonPage.moreOptionsMenu()).isExisting()).to.be.false;
expect(await commonPage.moreOptionsMenu().isExisting()).to.be.false;

await reportPage.goToReportById(smsReportId);
await commonPage.openMoreOptionsMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Navigation', () => {

it('should load reports list when navigating from a report that was opened from reports tab', async () => {
await commonPage.goToReports();
await (await reportsPage.reportsPageDefault.leftPanelSelectors.firstReport()).waitForDisplayed();
await reportsPage.reportsPageDefault.leftPanelSelectors.firstReport().waitForDisplayed();

await reportsPage.reportsPageDefault.openReport(reportDocs[1].id);
await commonPage.waitForLoaders();
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/default-mobile/reports/bulk-delete.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ describe('Bulk delete reports', () => {
expect(deselectSomeResult.selectedCount).to.equal(1);

await reportsPage.deleteSelectedReports();
expect(await (await reportsPageDefault.reportsListDetails()).length).to.equal(2);
expect(await (await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[0])).isDisplayed()).to.be.true;
expect(await (await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[1])).isDisplayed()).to.be.true;
expect(await (await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[2])).isDisplayed()).to.be.false;
expect((await reportsPageDefault.reportsListDetails()).length).to.equal(2);
expect(await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[0]).isDisplayed()).to.be.true;
expect(await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[1]).isDisplayed()).to.be.true;
expect(await reportsPageDefault.leftPanelSelectors.reportByUUID(savedUuids[2]).isDisplayed()).to.be.false;
});

it('should open a selected report and a no selected report', async () => {
Expand Down
16 changes: 8 additions & 8 deletions tests/e2e/default-mobile/reports/search.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('Search Reports', () => {
await searchPage.performSearch('+64275555556');
await commonPage.waitForLoaders();
expect((await reportsPage.reportsListDetails()).length).to.equal(2);
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(hospitalSMS.id)).isDisplayed()).to.be.true;
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(healthCenterSMS.id)).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(hospitalSMS.id).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(healthCenterSMS.id).isDisplayed()).to.be.true;

await searchPage.searchPageDefault.clearSearch();
expect((await reportsPage.reportsListDetails()).length).to.equal(reportDocs.length);
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(hospitalSMS.id)).isDisplayed()).to.be.true;
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(healthCenterSMS.id)).isDisplayed()).to.be.true;
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(hospitalReport.id)).isDisplayed()).to.be.true;
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(healthCenterReport.id)).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(hospitalSMS.id).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(healthCenterSMS.id).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(hospitalReport.id).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(healthCenterReport.id).isDisplayed()).to.be.true;
});

it('should navigate back to list view and return results when searching by case_id', async () => {
Expand All @@ -62,7 +62,7 @@ describe('Search Reports', () => {
await reportsPage.clickOnCaseId();
await commonPage.waitForLoaders();
expect((await reportsPage.reportsListDetails()).length).to.equal(2);
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(hospitalReport.id)).isDisplayed()).to.be.true;
expect(await (await reportsPage.leftPanelSelectors.reportByUUID(healthCenterReport.id)).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(hospitalReport.id).isDisplayed()).to.be.true;
expect(await reportsPage.leftPanelSelectors.reportByUUID(healthCenterReport.id).isDisplayed()).to.be.true;
});
});
2 changes: 1 addition & 1 deletion tests/e2e/default/about/about.wdio-spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions tests/e2e/default/admin/admin-access.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ describe('Acessing the admin app', () => {

it('should redirect to login when not logged in', async () => {
await browser.url('/admin');
await (await loginPage.loginButton()).waitForDisplayed();
await loginPage.loginButton().waitForDisplayed();

await browser.url('/admin/#/forms');
await (await loginPage.loginButton()).waitForDisplayed();
await loginPage.loginButton().waitForDisplayed();

await browser.url('/medic/_design/medic-admin/_rewrite/');
await (await loginPage.loginButton()).waitForDisplayed();
await loginPage.loginButton().waitForDisplayed();

await browser.url('/medic/_design/medic-admin/_rewrite/#/authorization/permissions');
await (await loginPage.loginButton()).waitForDisplayed();
await loginPage.loginButton().waitForDisplayed();
});

it('should show access error when accessing as an offline user', async () => {
Expand All @@ -36,36 +36,35 @@ describe('Acessing the admin app', () => {

await common.waitForLoaders();
await browser.url('/admin/#/forms');
expect(await (await adminPage.adminNavbarLogo()).isDisplayed()).to.equal(false);
expect(await adminPage.adminNavbarLogo().isDisplayed()).to.equal(false);
expect(await common.jsonError()).to.equal(error);

await browser.url('/admin');
expect(await (await adminPage.adminNavbarLogo()).isDisplayed()).to.equal(false);
expect(await adminPage.adminNavbarLogo().isDisplayed()).to.equal(false);
expect(await common.jsonError()).to.equal(error);

await browser.url('/medic/_design/medic-admin/_rewrite/');
expect(await (await adminPage.adminNavbarLogo()).isDisplayed()).to.equal(false);
expect(await adminPage.adminNavbarLogo().isDisplayed()).to.equal(false);
expect(await common.jsonError()).to.equal(error);

await browser.url('/medic/_design/medic-admin/_rewrite/#/authorization/permissions');
expect(await (await adminPage.adminNavbarLogo()).isDisplayed()).to.equal(false);
expect(await adminPage.adminNavbarLogo().isDisplayed()).to.equal(false);
expect(await common.jsonError()).to.equal(error);
});

it('should allow admins to access the page', async () => {
await loginPage.cookieLogin({ createUser: false });

await browser.url('/admin');
await (await adminPage.adminNavbarLogo()).waitForDisplayed();
expect(await (await adminPage.adminNavbarLogo()).getText()).to.equal('App Management');
expect(await adminPage.adminNavbarLogo().getText()).to.equal('App Management');

await browser.url('/admin#/forms');
await (await adminPage.adminNavbarLogo()).waitForDisplayed();
await adminPage.adminNavbarLogo().waitForDisplayed();

await browser.url('/medic/_design/medic-admin/_rewrite/');
await (await adminPage.adminNavbarLogo()).waitForDisplayed();
await adminPage.adminNavbarLogo().waitForDisplayed();

await browser.url('/medic/_design/medic-admin/_rewrite/#/authorization/permissions');
await (await adminPage.adminNavbarLogo()).waitForDisplayed();
await adminPage.adminNavbarLogo().waitForDisplayed();
});
});
6 changes: 3 additions & 3 deletions tests/e2e/default/analytics/analytics.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Targets', () => {
await sentinelUtils.waitForSentinel();

await loginPage.login(chw);
await (await commonPage.analyticsTab()).waitForDisplayed();
await commonPage.analyticsTab().waitForDisplayed();
});

afterEach(async () => {
Expand Down Expand Up @@ -106,8 +106,8 @@ describe('Targets', () => {
expect(username).to.equal(chw.username);
expect(url).to.equal('localhost');
expect(errorMessage).to.equal('Error fetching targets');
expect(await (await errorStack.isDisplayed())).to.be.true;
expect(await (await errorStack.getText())).to
expect(await errorStack.isDisplayed()).to.be.true;
expect(await errorStack.getText()).to
.include('TypeError: Cannot read properties of undefined (reading \'muted\')');

const feedbackDocs = await chtDbUtils.getFeedbackDocs();
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/default/contacts/add-new-district.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Add new district tests : ', () => {
await contactPage.editPlace('Tudor\'s district', 'At Tudor\'s', 'district_hospital');
await commonPage.waitForPageLoaded();

expect(await (await contactPage.contactCardSelectors.contactCardName()).getText()).to.equal('At Tudor\'s');
expect(await contactPage.contactCardSelectors.contactCardName().getText()).to.equal('At Tudor\'s');

const updatedDistrict = await utils.getDoc(district._id);
expect(updatedDistrict.contact_type).to.equal('not a district_hospital'); // editing didn't overwrite
Expand Down
23 changes: 11 additions & 12 deletions tests/e2e/default/contacts/contact-details.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Contact details page.', () => {
// contact loaded only waits for contact summary (which requires reports)
// tasks are loaded afterwards and there is no visual indication of them being loaded, or still loading
return browser.waitUntil(async () => {
return await (await contactPage.tasksCardSelectors.rhsTaskListElement()).isDisplayed();
return await contactPage.tasksCardSelectors.rhsTaskListElement().isDisplayed();
});
}

Expand Down Expand Up @@ -100,11 +100,11 @@ describe('Contact details page.', () => {

it('should show reports and tasks when permissions are enabled', async () => {
await commonElements.goToPeople(patient._id, true);
expect(await (await contactPage.contactCardSelectors.contactCardName()).getText()).to.equal(patient.name);
expect(await contactPage.contactCardSelectors.contactCardName().getText()).to.equal(patient.name);
await waitForContactLoaded(true);

expect(await (await contactPage.reportsCardSelectors.rhsReportListElement()).isDisplayed()).to.equal(true);
expect(await (await contactPage.tasksCardSelectors.rhsTaskListElement()).isDisplayed()).to.equal(true);
expect(await contactPage.reportsCardSelectors.rhsReportListElement().isDisplayed()).to.equal(true);
expect(await contactPage.tasksCardSelectors.rhsTaskListElement().isDisplayed()).to.equal(true);

expect((await contactPage.getAllRHSReportsNames()).length).to.equal(41);
expect((await contactPage.getAllRHSTaskNames()).length).to.deep.equal(DOCS_DISPLAY_LIMIT);
Expand All @@ -128,8 +128,8 @@ describe('Contact details page.', () => {
await browser.refresh();
await waitForContactLoaded(true);

expect(await (await contactPage.reportsCardSelectors.rhsReportListElement()).isDisplayed()).to.equal(false);
expect(await (await contactPage.tasksCardSelectors.rhsTaskListElement()).isDisplayed()).to.equal(true);
expect(await contactPage.reportsCardSelectors.rhsReportListElement().isDisplayed()).to.equal(false);
expect(await contactPage.tasksCardSelectors.rhsTaskListElement().isDisplayed()).to.equal(true);
expect((await contactPage.getAllRHSTaskNames()).length).to.deep.equal(DOCS_DISPLAY_LIMIT);
});

Expand All @@ -139,8 +139,8 @@ describe('Contact details page.', () => {
await browser.refresh();
await waitForContactLoaded(false);

expect(await (await contactPage.reportsCardSelectors.rhsReportListElement()).isDisplayed()).to.equal(true);
expect(await (await contactPage.tasksCardSelectors.rhsTaskListElement()).isDisplayed()).to.equal(false);
expect(await contactPage.reportsCardSelectors.rhsReportListElement().isDisplayed()).to.equal(true);
expect(await contactPage.tasksCardSelectors.rhsTaskListElement().isDisplayed()).to.equal(false);
expect((await contactPage.getAllRHSReportsNames()).length).to.equal(41);
});
});
Expand Down Expand Up @@ -171,17 +171,16 @@ describe('Contact details page.', () => {

it('should show error log for bad config', async () => {
await loginPage.cookieLogin();
await (await commonPage.goToPeople(patient._id));
await commonPage.goToPeople(patient._id);

const { errorMessage, url, username, errorStack } = await commonPage.getErrorLog();

expect(username).to.equal(constants.USERNAME);
expect(url).to.equal(constants.API_HOST);
expect(errorMessage).to.equal('Error fetching people');
expect(await (await errorStack.isDisplayed())).to.be.true;
expect(await (await errorStack.getText())).to
expect(await errorStack.isDisplayed()).to.be.true;
expect(await errorStack.getText()).to
.include('Error: Configuration error');
});
});
});

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Mute/Unmute contacts using a specific form - ', () => {
await commonPage.waitForPageLoaded();
await commonPage.sync();

expect(await (await contactPage.contactCardSelectors.contactMuted()).isDisplayed()).to.be.true;
expect(await contactPage.contactCardSelectors.contactMuted().isDisplayed()).to.be.true;
});

it('should unmute a contact using the defined unmute_forms (undo_death_report).', async () => {
Expand All @@ -63,7 +63,7 @@ describe('Mute/Unmute contacts using a specific form - ', () => {
await genericForm.submitForm();
await commonPage.sync();

expect(await (await contactPage.contactCardSelectors.contactMuted()).isDisplayed()).to.be.false;
expect(await contactPage.contactCardSelectors.contactMuted().isDisplayed()).to.be.false;
});

it('should show a popup when trying to submit a non-unmuting form against a muted contact', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/default/contacts/search-contacts.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Contact Search', () => {
it('search should clear RHS selected contact', async () => {
await contactPage.selectLHSRowByText(potuHospital.name, false);
await contactPage.waitForContactLoaded();
expect(await (await contactPage.contactCardSelectors.contactCardName()).getText()).to.equal(potuHospital.name);
expect(await contactPage.contactCardSelectors.contactCardName().getText()).to.equal(potuHospital.name);

await searchPage.performSearch('sittu');
await contactPage.waitForContactUnloaded();
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/default/db/db-sync.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('db-sync', () => {
});
await sentinelUtils.waitForSentinel();
await loginPage.login({ username: restrictedUserName, password: restrictedPass });
await (await commonElements.analyticsTab()).waitForDisplayed();
await commonElements.analyticsTab().waitForDisplayed();
});

after(async () => {
Expand Down Expand Up @@ -239,7 +239,7 @@ describe('db-sync', () => {

// if the test fails, it helps to see which reports are read or not in the failpic
await commonElements.goToReports();
await (await reportsPage.leftPanelSelectors.reportList()).waitForDisplayed();
await reportsPage.leftPanelSelectors.reportList().waitForDisplayed();

await browser.waitUntil(async () => await reportsPage.getUnreadCount() === '2');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/default/enketo/death-report.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Submit a death report', () => {

// Verify the patient's card information
expect(await contactPage.getContactDeceasedStatus()).to.equal('Deceased');
expect(await (await contactPage.deathCardSelectors.deathCard()).isDisplayed()).to.be.true;
expect(await contactPage.deathCardSelectors.deathCard().isDisplayed()).to.be.true;
const deathCardInfo = await contactPage.getDeathCardInfo();
expect(Date.parse(deathCardInfo.deathDate)).to.equal(Date.parse(deathDate.format('D MMM, YYYY')));
expect(deathCardInfo.deathPlace).to.equal('Health facility');
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/default/enketo/enketo-widgets.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ describe('Enketo Widgets', () => {
await commonEnketoPage.setInputValue('What is the patient\'s name?', 'Eli');
await commonEnketoPage.setInputValue('What is the patient\'s uuid?', '123 456 789');

expect(await (await enketoWidgetsPage.patientNameErrorLabel()).isExisting()).to.be.true;
expect(await enketoWidgetsPage.patientNameErrorLabel().isExisting()).to.be.true;

await commonEnketoPage.setInputValue('What is the patient\'s name?', 'Elias');
await commonEnketoPage.setInputValue('What is the patient\'s id?', '12345');

expect(await (await enketoWidgetsPage.patientNameErrorLabel()).isExisting()).to.be.false;
expect(await enketoWidgetsPage.patientNameErrorLabel().isExisting()).to.be.false;

await genericForm.submitForm();

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/default/enketo/phone-widget.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Phone widget', () => {
await commonPage.goToPeople(person1._id);
await contactsPage.openEditContactForm();

await (await genericForm.nextPage());
await genericForm.nextPage();
// Try setting phone to number of the other person
await commonEnketoPage.setInputValue('Phone Number', person0.phone);

Expand Down
Loading
Loading