Skip to content

Commit

Permalink
chore: update breaking e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Benmuiruri committed Nov 18, 2024
1 parent 95d5f9c commit 40bee0a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
5 changes: 3 additions & 2 deletions tests/e2e/default/contacts/edit.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Edit ', () => {
roles: ['program_officer'],
contact: onlineUserContact
});
const newPassword = loginPage.NEW_PASSWORD;

before(async () => {
await utils.saveDocs([...places.values()]);
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('Edit ', () => {
});

it('should sync and update the offline user\'s home place', async () => {
await loginPage.login(offlineUser);
await loginPage.login({ username: offlineUser.username, password: newPassword, resetPassword: false });
await commonPage.waitForPageLoaded();
await commonPage.goToPeople();
await commonPage.logout();
Expand All @@ -73,7 +74,7 @@ describe('Edit ', () => {
await commonPage.waitForPageLoaded();
await commonPage.logout();

await loginPage.login(offlineUser);
await loginPage.login({ username: offlineUser.username, password: newPassword, resetPassword: false });
await commonPage.waitForPageLoaded();
await commonPage.goToPeople();

Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/default/login/login-logout.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,13 @@ describe('Login page functionality tests', () => {
});

it('should log in using username and password fields', async () => {
<<<<<<< HEAD
await loginPage.login({ username: auth.username, password: auth.password, resetPassword: false });
=======
await loginPage.login(auth);
>>>>>>> 58dcfb6d746fee5c5640e35ccf16e95b53f3057f
await (await commonPage.tabsSelector.analyticsTab()).waitForDisplayed();
await (await commonPage.tabsSelector.messagesTab()).waitForDisplayed();
});

it('should set correct cookies', async () => {
<<<<<<< HEAD
await loginPage.login({ username: auth.username, password: auth.password, resetPassword: false });
=======
await loginPage.login(auth);
>>>>>>> 58dcfb6d746fee5c5640e35ccf16e95b53f3057f
await (await commonPage.tabsSelector.analyticsTab()).waitForDisplayed();

const cookies = await browser.getCookies();
Expand Down Expand Up @@ -125,11 +117,7 @@ describe('Login page functionality tests', () => {

it('should display the "session expired" modal and redirect to login page', async () => {
// Login and ensure it's redirected to webapp
<<<<<<< HEAD
await loginPage.login({ username: auth.username, password: auth.password, resetPassword: false });
=======
await loginPage.login(auth);
>>>>>>> 58dcfb6d746fee5c5640e35ccf16e95b53f3057f
await (await commonPage.tabsSelector.messagesTab()).waitForDisplayed();
// Delete cookies and trigger a request to the server
await browser.deleteCookies('AuthSession');
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/default/reports/breadcrumbs.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('Reports tab breadcrumbs', () => {
});

it('should not remove facility from breadcrumbs when offline user has many facilities associated', async () => {
await loginPage.login({ password: userWithManyPlacesPass, username: userWithManyPlaces.name });
await loginPage.login({ password: userWithManyPlacesPass, username: userWithManyPlaces.name, resetPassword: false });
await commonElements.waitForPageLoaded();
await commonElements.goToReports();
await (await reportsPage.leftPanelSelectors.firstReport()).waitForDisplayed();
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/default/reports/sidebar-filter.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const personFactory = require('@factories/cht/contacts/person');
const reportFactory = require('@factories/cht/reports/generic-report');

describe('Reports Sidebar Filter', () => {
const newPassword = loginPage.NEW_PASSWORD;
const places = placeFactory.generateHierarchy();

const districtHospital = places.get('district_hospital');
Expand Down Expand Up @@ -113,7 +114,7 @@ describe('Reports Sidebar Filter', () => {
});

it('should filter by form', async () => {
await loginPage.login(districtHospitalUser);
await loginPage.login({ username: districtHospitalUser.username, password: newPassword, resetPassword:false });
await commonPage.waitForPageLoaded();

await commonPage.goToReports();
Expand All @@ -131,7 +132,7 @@ describe('Reports Sidebar Filter', () => {
});

it('should filter by place', async () => {
await loginPage.login(districtHospitalUser);
await loginPage.login({ username: districtHospitalUser.username, password: newPassword, resetPassword:false });
await commonPage.waitForPageLoaded();

await commonPage.goToReports();
Expand All @@ -149,7 +150,7 @@ describe('Reports Sidebar Filter', () => {
});

it('should filter by status', async () => {
await loginPage.login(districtHospitalUser);
await loginPage.login({ username: districtHospitalUser.username, password: newPassword, resetPassword:false });
await commonPage.waitForPageLoaded();

await commonPage.goToReports();
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/default/tasks/tasks-breadcrumbs.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe('Tasks tab breadcrumbs', () => {
});

describe('for chw', () => {
const newPassword = loginPage.NEW_PASSWORD;
afterEach(async () => await commonElements.logout());

after(async () => {
Expand All @@ -99,7 +100,7 @@ describe('Tasks tab breadcrumbs', () => {
});

it('should not remove facility from breadcrumbs when offline user has many facilities associated', async () => {
await loginPage.login({ password: userWithManyPlacesPass, username: userWithManyPlaces.name });
await loginPage.login({ password: userWithManyPlacesPass, username: userWithManyPlaces.name, resetPassword: false });
await commonPage.waitForPageLoaded();
await commonPage.goToTasks();
const infos = await tasksPage.getTasksListInfos(await tasksPage.getTasks());
Expand Down Expand Up @@ -161,7 +162,7 @@ describe('Tasks tab breadcrumbs', () => {
});

it('should open task with expression', async () => {
await loginPage.login(chw);
await loginPage.login({ username: chw.username, password: newPassword, resetPassword: false });
await commonPage.waitForPageLoaded();
await commonPage.goToTasks();
const task = await tasksPage.getTaskByContactAndForm('patient1', 'person_create');
Expand Down

0 comments on commit 40bee0a

Please sign in to comment.