diff --git a/api/tests/mocha/services/branding.spec.js b/api/tests/mocha/services/branding.spec.js index 9a4a594011e..5156963f497 100644 --- a/api/tests/mocha/services/branding.spec.js +++ b/api/tests/mocha/services/branding.spec.js @@ -15,7 +15,7 @@ describe('branding service', () => { sinon.restore(); }); - describe('get', async() => { + describe('get', () => { it('returns default when missing doc', async () => { const get = sinon.stub(db, 'get').rejects({}); @@ -84,7 +84,7 @@ describe('branding service', () => { }); - describe('getFavicon', async() => { + describe('getFavicon', () => { it('returns default when missing doc', async () => { const get = sinon.stub(db, 'get').rejects({}); diff --git a/tests/e2e/default-mobile/reports/search.wdio-spec.js b/tests/e2e/default-mobile/reports/search.wdio-spec.js index 8fd871edec3..a989fa61283 100644 --- a/tests/e2e/default-mobile/reports/search.wdio-spec.js +++ b/tests/e2e/default-mobile/reports/search.wdio-spec.js @@ -10,7 +10,7 @@ const personFactory = require('@factories/cht/contacts/person'); const pregnancyFactory = require('@factories/cht/reports/pregnancy'); const smsPregnancyFactory = require('@factories/cht/reports/sms-pregnancy'); -describe('Search Reports', async () => { +describe('Search Reports', () => { const places = placeFactory.generateHierarchy(); const districtHospitalPatient = personFactory.build({ parent: places.get('district_hospital'), patient_id: '1a' }); const healthCenterPatient = personFactory.build({ parent: places.get('health_center'), patient_id: '2a' }); diff --git a/tests/e2e/default-mobile/wdio.conf.js b/tests/e2e/default-mobile/wdio.conf.js index c4f041814f0..bf84c9083ec 100644 --- a/tests/e2e/default-mobile/wdio.conf.js +++ b/tests/e2e/default-mobile/wdio.conf.js @@ -8,12 +8,11 @@ exports.config = Object.assign(wdioBaseConfig.config, { suites: { all: [ './**/*.wdio-spec.js', - [ - '../default/login/login-logout.wdio-spec.js', - '../default/navigation/navigation.wdio-spec.js', - '../default/navigation/hamburger-menu.wdio-spec.js', - ], - ]}, + '../default/login/login-logout.wdio-spec.js', + '../default/navigation/navigation.wdio-spec.js', + '../default/navigation/hamburger-menu.wdio-spec.js', + ] + }, beforeSuite: async () => { // We tried the browser.emulateDevice('...') function but it's not stable enough, // it looses the mobile view and switches back to desktop diff --git a/tests/e2e/default/about/about.wdio-spec.js b/tests/e2e/default/about/about.wdio-spec.js index 7d9ad3a45f7..2d43e4c64c5 100644 --- a/tests/e2e/default/about/about.wdio-spec.js +++ b/tests/e2e/default/about/about.wdio-spec.js @@ -4,7 +4,7 @@ const loginPage = require('@page-objects/default/login/login.wdio.page'); const aboutPage = require('@page-objects/default/about/about.wdio.page'); const partnersFactory = require('@factories/cht/config/partners'); -describe('About page', async () => { +describe('About page', () => { beforeEach(async () => { await loginPage.cookieLogin(); }); diff --git a/tests/e2e/default/contacts/person-under-area.wdio-spec.js b/tests/e2e/default/contacts/person-under-area.wdio-spec.js index 930c4713efa..a0c0dbbaf1e 100644 --- a/tests/e2e/default/contacts/person-under-area.wdio-spec.js +++ b/tests/e2e/default/contacts/person-under-area.wdio-spec.js @@ -45,7 +45,7 @@ const person2 = personFactory.build( const docs = [...places.values(), healthCenter2, person1, person2]; -describe('Create Person Under Area', async () => { +describe('Create Person Under Area', () => { beforeEach(async () => { await utils.saveDocs(docs); await loginPage.cookieLogin(); diff --git a/tests/e2e/default/contacts/search-contacts.wdio-spec.js b/tests/e2e/default/contacts/search-contacts.wdio-spec.js index 63dceb63575..9789e26f80f 100644 --- a/tests/e2e/default/contacts/search-contacts.wdio-spec.js +++ b/tests/e2e/default/contacts/search-contacts.wdio-spec.js @@ -51,7 +51,7 @@ const potuPerson = personFactory.build( const docs = [...places.values(), sittuHospital, sittuPerson, potuHospital, potuPerson]; -describe('Test Contact Search Functionality', async () => { +describe('Test Contact Search Functionality', () => { before(async () => { await utils.saveDocs(docs); await loginPage.cookieLogin(); diff --git a/tests/e2e/default/login/renew-token.wdio-spec.js b/tests/e2e/default/login/renew-token.wdio-spec.js index d8641195154..dc752117899 100644 --- a/tests/e2e/default/login/renew-token.wdio-spec.js +++ b/tests/e2e/default/login/renew-token.wdio-spec.js @@ -4,7 +4,7 @@ const commonPage = require('@page-objects/default/common/common.wdio.page'); const moment = require('moment'); const utils = require('@utils'); -describe('should renew token', async () => { +describe('should renew token', () => { beforeEach(async () => { await loginPage.cookieLogin(); diff --git a/tests/e2e/default/more-options-menu/offline-user/all-permissions.wdio-spec.js b/tests/e2e/default/more-options-menu/offline-user/all-permissions.wdio-spec.js index 561cf6194f0..0e88a620ff1 100644 --- a/tests/e2e/default/more-options-menu/offline-user/all-permissions.wdio-spec.js +++ b/tests/e2e/default/more-options-menu/offline-user/all-permissions.wdio-spec.js @@ -53,7 +53,7 @@ const smsReport = reportFactory { patient, submitter: offlineUser.contact, fields: { lmp_date: 'Feb 3, 2022', patient_id: patient._id }, }, ); -describe('More Options Menu - Offline User', async () => { +describe('More Options Menu - Offline User', () => { let xmlReportId; let smsReportId; before(async () => { @@ -68,7 +68,7 @@ describe('More Options Menu - Offline User', async () => { afterEach(async () => await commonPage.goToBase()); - describe('all permissions enabled', async () => { + describe('all permissions enabled', () => { it('- Message tab', async () => { await commonPage.goToMessages(); await sms.sendSms('testing', contact.phone); @@ -118,7 +118,7 @@ describe('More Options Menu - Offline User', async () => { }); }); - describe('all permissions disabled', async () => { + describe('all permissions disabled', () => { before(async () => { const allPermissions = ['can_edit', 'can_delete_contacts', 'can_export_all', 'can_export_contacts', 'can_export_messages', diff --git a/tests/e2e/default/more-options-menu/offline-user/delete-permission-disabled.wdio-spec.js b/tests/e2e/default/more-options-menu/offline-user/delete-permission-disabled.wdio-spec.js index cd0a6f6f15e..823f269a7d3 100644 --- a/tests/e2e/default/more-options-menu/offline-user/delete-permission-disabled.wdio-spec.js +++ b/tests/e2e/default/more-options-menu/offline-user/delete-permission-disabled.wdio-spec.js @@ -51,7 +51,7 @@ const smsReport = reportFactory { patient, submitter: offlineUser.contact, fields: { lmp_date: 'Feb 3, 2022', patient_id: patient._id }, }, ); -describe('- DELETE permissions disabled', async () => { +describe('- DELETE permissions disabled', () => { let xmlReportId; let smsReportId; before(async () => { diff --git a/tests/e2e/default/more-options-menu/offline-user/edit-permission-disabled.wdio-spec.js b/tests/e2e/default/more-options-menu/offline-user/edit-permission-disabled.wdio-spec.js index c0936d455f0..2c4d36a1e81 100644 --- a/tests/e2e/default/more-options-menu/offline-user/edit-permission-disabled.wdio-spec.js +++ b/tests/e2e/default/more-options-menu/offline-user/edit-permission-disabled.wdio-spec.js @@ -51,7 +51,7 @@ const smsReport = reportFactory { patient, submitter: offlineUser.contact, fields: { lmp_date: 'Feb 3, 2022', patient_id: patient._id}, }, ); -describe('- EDIT permissions disabled', async () => { +describe('- EDIT permissions disabled', () => { let xmlReportId; let smsReportId; before(async () => { diff --git a/tests/e2e/default/more-options-menu/online-user/permissions-disabled.wdio-spec.js b/tests/e2e/default/more-options-menu/online-user/permissions-disabled.wdio-spec.js index 5dec3c194c3..8822c574355 100644 --- a/tests/e2e/default/more-options-menu/online-user/permissions-disabled.wdio-spec.js +++ b/tests/e2e/default/more-options-menu/online-user/permissions-disabled.wdio-spec.js @@ -41,7 +41,7 @@ const reports = [ reportFactory.report().build({ form: 'home_visit', content_type: 'xml' }, { patient, submitter: contact }) ]; -describe('- permissions disabled', async () => { +describe('- permissions disabled', () => { before(async () => { await utils.saveDocs([ ...places.values(), contact, patient, ...reports ]); await sms.sendSms('testing', contact.phone); @@ -53,7 +53,7 @@ describe('- permissions disabled', async () => { after(async () => await utils.revertSettings(true)); - describe('- export permissions disabled', async () => { + describe('- export permissions disabled', () => { before(async () => { const exportPermissions = ['can_export_all', 'can_export_contacts', 'can_export_messages']; await utils.updatePermissions(onlineUser.roles, [], exportPermissions); @@ -87,7 +87,7 @@ describe('- permissions disabled', async () => { }); }); - describe('- DELETE permissions disabled', async () => { + describe('- DELETE permissions disabled', () => { before(async () => { await utils.updatePermissions(onlineUser.roles, [], ['can_delete_contacts', 'can_delete_reports']); await commonPage.closeReloadModal(); @@ -109,7 +109,7 @@ describe('- permissions disabled', async () => { }); }); - describe('- EDIT permissions disabled', async () => { + describe('- EDIT permissions disabled', () => { before(async () => { await utils.updatePermissions(onlineUser.roles, [], ['can_edit']); await commonPage.closeReloadModal(); diff --git a/tests/e2e/default/more-options-menu/online-user/permissions-enabled.wdio-spec.js b/tests/e2e/default/more-options-menu/online-user/permissions-enabled.wdio-spec.js index 8935da80c48..8a2c37fd354 100644 --- a/tests/e2e/default/more-options-menu/online-user/permissions-enabled.wdio-spec.js +++ b/tests/e2e/default/more-options-menu/online-user/permissions-enabled.wdio-spec.js @@ -50,11 +50,11 @@ const smsReport = reportFactory { patient, submitter: contact, fields: { lmp_date: 'Dec 3, 2022', patient_id: patient._id}, }, ); -describe('Online User', async () => { +describe('Online User', () => { afterEach(async () => await commonPage.goToBase()); - describe('Options disabled when no items - messages, contacts, people', async () => { + describe('Options disabled when no items - messages, contacts, people', () => { before(async () => await loginPage.cookieLogin()); it('- Message tab', async () => { @@ -80,7 +80,7 @@ describe('Online User', async () => { }); }); - describe(' - Contact tab - user has no contact ', async () => { + describe(' - Contact tab - user has no contact ', () => { before(async () => await utils.saveDocs([ ...places.values(), contact, patient])); it(' - no contact selected', async () => { @@ -92,7 +92,7 @@ describe('Online User', async () => { }); }); - describe(' - Options enabled when there are items', async () => { + describe(' - Options enabled when there are items', () => { let xmlReportId; let smsReportId; diff --git a/tests/e2e/default/navigation/bfcache.wdio-spec.js b/tests/e2e/default/navigation/bfcache.wdio-spec.js index d659cb1e88f..c5c20a466e7 100644 --- a/tests/e2e/default/navigation/bfcache.wdio-spec.js +++ b/tests/e2e/default/navigation/bfcache.wdio-spec.js @@ -4,7 +4,7 @@ const loginPage = require('@page-objects/default/login/login.wdio.page'); const usersAdminPage = require('@page-objects/default/users/user.wdio.page'); const constants = require('@constants'); -describe('bfcache', async () => { +describe('bfcache', () => { beforeEach(async () => { await loginPage.login({ username: constants.USERNAME, diff --git a/tests/e2e/default/navigation/hamburger-menu.wdio-spec.js b/tests/e2e/default/navigation/hamburger-menu.wdio-spec.js index 920b9981d26..d437c63616b 100644 --- a/tests/e2e/default/navigation/hamburger-menu.wdio-spec.js +++ b/tests/e2e/default/navigation/hamburger-menu.wdio-spec.js @@ -1,12 +1,12 @@ const commonPage = require('@page-objects/default/common/common.wdio.page'); const loginPage = require('@page-objects/default/login/login.wdio.page'); -describe('Hamburger Menu tests', async () => { +describe('Hamburger Menu tests', () => { before(async () => { await loginPage.cookieLogin(); }); - beforeEach(async () => { + afterEach(async () => { await commonPage.goToReports(); }); diff --git a/tests/e2e/default/navigation/navigation.wdio-spec.js b/tests/e2e/default/navigation/navigation.wdio-spec.js index 80c536e112e..379ad76a14c 100644 --- a/tests/e2e/default/navigation/navigation.wdio-spec.js +++ b/tests/e2e/default/navigation/navigation.wdio-spec.js @@ -5,8 +5,8 @@ const userFactory = require('@factories/cht/users/users'); const placeFactory = require('@factories/cht/contacts/place'); -describe('Navigation tests', async () => { - describe('Navigation functionality', async () => { +describe('Navigation tests', () => { + describe('Navigation functionality', () => { before(async () => { await loginPage.cookieLogin(); }); @@ -42,7 +42,7 @@ describe('Navigation tests', async () => { }); }); - describe('Navigation view', async () => { + describe('Navigation view', () => { const places = placeFactory.generateHierarchy(); const districtHospital = places.get('district_hospital'); const user = userFactory.build({ place: districtHospital._id, roles: ['chw'] }); diff --git a/tests/e2e/default/reports/search-reports.wdio-spec.js b/tests/e2e/default/reports/search-reports.wdio-spec.js index a61a6a0f4d6..616b4e7b49c 100644 --- a/tests/e2e/default/reports/search-reports.wdio-spec.js +++ b/tests/e2e/default/reports/search-reports.wdio-spec.js @@ -10,7 +10,7 @@ const personFactory = require('@factories/cht/contacts/person'); const pregnancyFactory = require('@factories/cht/reports/pregnancy'); const smsPregnancyFactory = require('@factories/cht/reports/sms-pregnancy'); -describe('Reports Search', async () => { +describe('Reports Search', () => { const sittuHospital = placeFactory.place().build({ name: 'Sittu Hospital', type: 'district_hospital' }); const potuHospital = placeFactory.place().build({ name: 'Potu Hospital', type: 'district_hospital' }); diff --git a/tests/e2e/standard/sms/registration-by-sms.wdio-spec.js b/tests/e2e/standard/sms/registration-by-sms.wdio-spec.js index 8e6b2841d77..d8fbb12e054 100644 --- a/tests/e2e/standard/sms/registration-by-sms.wdio-spec.js +++ b/tests/e2e/standard/sms/registration-by-sms.wdio-spec.js @@ -7,7 +7,7 @@ const userFactory = require('@factories/cht/users/users'); const gatewayApiUtils = require('@utils/gateway-api'); const reportsPage = require('@page-objects/default/reports/reports.wdio.page'); -describe('Registration by SMS', async () => { +describe('Registration by SMS', () => { const district_hospital = placeFactory.generateHierarchy(['district_hospital']).get('district_hospital'); const user = userFactory.build({ place: district_hospital._id }); diff --git a/tests/e2e/upgrade/upgrade.wdio-spec.js b/tests/e2e/upgrade/upgrade.wdio-spec.js index 0d4660ca8d5..29430e949ed 100644 --- a/tests/e2e/upgrade/upgrade.wdio-spec.js +++ b/tests/e2e/upgrade/upgrade.wdio-spec.js @@ -45,41 +45,13 @@ const deleteUpgradeLogs = async () => { await utils.logsDb.bulkDocs(logs); }; -// ToDo: Remove once 4.4 is released. Because it needs selectors targeting the previous cht version. -const oldLogout = async () => { - await commonPage.openHamburgerMenu(); - await (await commonPage.logoutButton()).waitForClickable(); - await (await commonPage.logoutButton()).click(); - $('.modal-dialog .modal-body').waitForDisplayed(); - const submitBtn = $('.modal-dialog a.btn.submit'); - await (await submitBtn).waitForClickable(); - await (await submitBtn).click(); - await browser.pause(100); // Wait for login page js to execute -}; - -// ToDo: Remove once 4.4 is released. Because it needs selectors targeting the previous cht version. -const oldCloseReloadModal = async () => { - try { - const reloadModalUpdate = $('#update-available [test-id="Update"]'); - await browser.waitUntil(async () => await (await reloadModalUpdate).waitForExist({ timeout: 5000 })); - // Wait for the animation to complete - await browser.pause(500); - await (await reloadModalUpdate).click(); - await browser.pause(500); - return true; - } catch (err) { - console.error('Reload modal not showed up'); - return false; - } -}; - describe('Performing an upgrade', () => { before(async () => { await utils.saveDocs([...docs.places, ...docs.clinics, ...docs.persons, ...docs.reports]); await utils.createUsers([docs.user]); await loginPage.login(docs.user); - await oldLogout; + await commonPage.logout(); await loginPage.cookieLogin({ username: constants.USERNAME, @@ -136,8 +108,10 @@ describe('Performing an upgrade', () => { await adminPage.logout(); await loginPage.login(docs.user); - await oldCloseReloadModal(); + await commonPage.sync(true); + await browser.refresh(); + await commonPage.waitForPageLoaded(); await commonPage.goToAboutPage(); expect(await upgradePage.getCurrentVersion()).to.include(TAG ? TAG : `${BRANCH} (`); await commonPage.logout(); diff --git a/tests/integration/sentinel/transitions/sentinel-transition-error-log.spec.js b/tests/integration/sentinel/transitions/sentinel-transition-error-log.spec.js index 0d401d945a3..f1f78f6404f 100644 --- a/tests/integration/sentinel/transitions/sentinel-transition-error-log.spec.js +++ b/tests/integration/sentinel/transitions/sentinel-transition-error-log.spec.js @@ -1,6 +1,6 @@ const utils = require('@utils'); -describe('Sentinel transition error log', async function() { +describe('Sentinel transition error log', function() { after(async () => await utils.revertSettings(true)); diff --git a/tests/page-objects/default/about/about.wdio.page.js b/tests/page-objects/default/about/about.wdio.page.js index 0045eed95da..86c09096bf9 100644 --- a/tests/page-objects/default/about/about.wdio.page.js +++ b/tests/page-objects/default/about/about.wdio.page.js @@ -1,5 +1,7 @@ const userName = () => $('dt=User name'); const partners = () => $('.partners'); +const version = () => $('[test-id="about-version"]'); +const RELOAD_BUTTON = '.about.page .mat-primary'; const getPartnerImage = async (name) => { await (await partners()).waitForDisplayed(); @@ -9,8 +11,15 @@ const getPartnerImage = async (name) => { return partnerImage.getAttribute('src'); }; +const getVersion = async () => { + await (await version()).waitForDisplayed(); + return await (await version()).getText(); +}; + module.exports = { userName, partners, getPartnerImage, + getVersion, + RELOAD_BUTTON, }; diff --git a/tests/page-objects/default/common/common.wdio.page.js b/tests/page-objects/default/common/common.wdio.page.js index b7f60ba2f13..1b500994704 100644 --- a/tests/page-objects/default/common/common.wdio.page.js +++ b/tests/page-objects/default/common/common.wdio.page.js @@ -1,5 +1,6 @@ const modalPage = require('./modal.wdio.page'); const constants = require('@constants'); +const aboutPage = require('@page-objects/default/about/about.wdio.page'); const hamburgerMenu = () => $('#header-dropdown-link'); const userSettingsMenuOption = () => $('[test-id="user-settings-menu-option"]'); @@ -44,7 +45,6 @@ const FEEDBACK_MENU = '#header-dropdown i.fa-bug'; const FEEDBACK = '#feedback'; //About menu const ABOUT_MENU = '#header-dropdown i.fa-question'; -const RELOAD_BUTTON = '.about.page .btn-primary'; //Configuration App const CONFIGURATION_APP_MENU = '#header-dropdown i.fa-cog'; @@ -360,7 +360,7 @@ const closeReportBug = async () => { const openAboutMenu = async () => { await (await $(ABOUT_MENU)).waitForClickable(); await (await $(ABOUT_MENU)).click(); - await (await $(RELOAD_BUTTON)).waitForDisplayed(); + await (await $(aboutPage.RELOAD_BUTTON)).waitForDisplayed(); }; const openUserSettings = async () => { diff --git a/tests/utils/index.js b/tests/utils/index.js index 5dff3a4b0b6..b8c1e43b6d9 100644 --- a/tests/utils/index.js +++ b/tests/utils/index.js @@ -1078,7 +1078,7 @@ const waitForDockerLogs = (container, ...regex) => { const promise = new Promise((resolve, reject) => { timeout = setTimeout(() => { - console.log('Found logs', logs, 'watched for', ...regex); + console.log('Found logs', logs, 'did not match expected regex:', ...regex); reject(new Error('Timed out looking for details in logs.')); killSpawnedProcess(proc); }, 20000); diff --git a/webapp/src/ts/modules/about/about.component.html b/webapp/src/ts/modules/about/about.component.html index c961bd2dc4d..ae3933de591 100644 --- a/webapp/src/ts/modules/about/about.component.html +++ b/webapp/src/ts/modules/about/about.component.html @@ -11,7 +11,7 @@