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: adding new e2e test to old navigation #9360

Merged
merged 33 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
16f5eb2
chore: hide old nav
Benmuiruri Aug 14, 2024
09051ab
chore: add test
Benmuiruri Aug 14, 2024
2c60137
chore: add translations
Benmuiruri Aug 14, 2024
da89e09
chore: add translations
Benmuiruri Aug 15, 2024
5a8f8b9
chore: add translations
Benmuiruri Aug 15, 2024
a609278
chore: correct logic
Benmuiruri Aug 15, 2024
3e34c18
chore: update test
Benmuiruri Aug 15, 2024
9643f73
chore: update css
Benmuiruri Aug 19, 2024
dd4e333
chore: skipped admin tests
Benmuiruri Aug 19, 2024
2bb3596
chore: update mobile tests
Benmuiruri Aug 19, 2024
a283af9
chore: update e2e tests
Benmuiruri Aug 19, 2024
023b487
chore: update e2e tests
Benmuiruri Aug 19, 2024
64f2ae8
Revert "chore: update e2e tests"
Benmuiruri Aug 19, 2024
9ad1095
Revert "chore: update e2e tests"
Benmuiruri Aug 19, 2024
58e8538
Revert "chore: update mobile tests"
Benmuiruri Aug 19, 2024
a246da1
Revert "chore: skipped admin tests"
Benmuiruri Aug 19, 2024
20829d7
chore: revert
Benmuiruri Aug 19, 2024
0909716
adding new test to old navigation
tatilepizs Aug 20, 2024
a5a47ac
create individual tests for each module and add a new page-object fil…
tatilepizs Aug 21, 2024
2d380d2
[test] revert wdio.conf.js for default-mobile
tatilepizs Aug 21, 2024
ea9bc5a
[test] revert wdio.conf.js for default
tatilepizs Aug 21, 2024
fd67b1c
test
tatilepizs Aug 21, 2024
384cb4b
adding one test to the default-mobile wdio config
tatilepizs Aug 21, 2024
185f5ba
chore: disable tests in suite.js
Aug 22, 2024
7d34df7
chore: address PR comments
Aug 22, 2024
4fd8617
chore: skip check that tests belong to test spec
Aug 22, 2024
fc88756
chore: update old nav test path
Aug 22, 2024
5976bd8
chore: update old nav test path 2
Aug 22, 2024
b6d5c06
chore: update mobile config to include old nav test
Aug 22, 2024
d9b0120
chore: update mobile config to include old nav test
Aug 22, 2024
01773ef
chore: add mobile old nav test - draft
Aug 22, 2024
0744836
chore: add mobile old nav test - draft
Aug 22, 2024
3fb9daf
chore: comment admin upgade tests
Aug 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/resources/translations/messages-en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ permission.description.can_view_uhc_stats = Allowed to view UHC stats in the Con
permission.description.can_view_message_action = Display a button to send a message to the selected person.
permission.description.can_view_messages = Allowed to view Messages.
permission.description.can_view_messages_tab = Display the Messages tab in the app. If not set it a menu item will be shown in the app menu instead.
permission.description.can_view_old_navigation = Allowed to view old Navigation bar.
permission.description.can_view_outgoing_messages = Allowed to view the Outgoing Messages screen in the admin app.
permission.description.can_view_reports = Allowed to view Reports.
permission.description.can_view_reports_tab = Display the Reports tab in the app. If not set it a menu item will be shown in the app menu instead.
Expand Down
1 change: 1 addition & 0 deletions api/resources/translations/messages-es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ permission.description.can_view_uhc_stats = Ver las estadísticas de UHC en la s
permission.description.can_view_message_action = Mostrar el botón para enviar un mensaje a la persona seleccionada.
permission.description.can_view_messages = Ver Mensajes.
permission.description.can_view_messages_tab = Mostrar la pestaña de Mensajes en la aplicación. Si no lo configura, se mostrará en el menú de la aplicación.
permission.description.can_view_old_navigation = Mostrar la barra de navegación antigua.
permission.description.can_view_outgoing_messages = Ver la página de mensajes salientes en la Gestión de la Aplicación.
permission.description.can_view_reports = Ver Informes.
permission.description.can_view_reports_tab = Mostrar la pestaña de Informes en la aplicación. Si no lo configura, se mostrará en el menú de la aplicación.
Expand Down
1 change: 1 addition & 0 deletions api/resources/translations/messages-fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ permission.description.can_view_uhc_stats = Autorisé à afficher les statistiqu
permission.description.can_view_message_action = Afficher un bouton pour envoyer un message à la personne sélectionnée.
permission.description.can_view_messages = Autorisé à afficher les Messages.
permission.description.can_view_messages_tab = Affichez l'onglet Messages dans l'application. S'il n'est pas défini, un élément de menu sera affiché dans le menu de l'application à la place.
permission.description.can_view_old_navigation = Autorisé à afficher l'ancienne Barre de Navigation.
permission.description.can_view_outgoing_messages = Autorisé à afficher l'écran des messages sortants dans l'application d'administration.
permission.description.can_view_reports = Autorisé à afficher les rapports.
permission.description.can_view_reports_tab = Affichez l'onglet Rapports dans l'application. S'il n'est pas défini, un élément de menu sera affiché dans le menu de l'application à la place.
Expand Down
1 change: 1 addition & 0 deletions api/resources/translations/messages-id.properties
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ permission.description.can_view_last_visited_date =
permission.description.can_view_message_action =
permission.description.can_view_messages =
permission.description.can_view_messages_tab =
permission.description.can_view_old_navigation = Tampilkan bilah navigasi lama
permission.description.can_view_outgoing_messages =
permission.description.can_view_reports =
permission.description.can_view_reports_tab =
Expand Down
1 change: 1 addition & 0 deletions api/resources/translations/messages-ne.properties
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ permission.description.can_view_message_action =
permission.description.can_view_messages =
permission.description.can_view_messages_tab =
permission.description.can_view_outgoing_messages =
permission.description.can_view_old_navigation = पुरानो नेभिगेशन बार हेर्न अनुमति दिइयो
permission.description.can_view_reports =
permission.description.can_view_reports_tab =
permission.description.can_view_tasks =
Expand Down
1 change: 1 addition & 0 deletions api/resources/translations/messages-sw.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ permission.description.can_view_uhc_stats = Inaruhusiwa kutazama takwimu za UHC
permission.description.can_view_message_action = Onyesha kitufe ili kutuma ujumbe kwa mtu aliyechaguliwa.
permission.description.can_view_messages = Inaruhusiwa kutazama jumbe.
permission.description.can_view_messages_tab = Onyesha kichupo cha ujumbe kwenye programu. Ikiwa haijawekwa, kipengee cha menyu kitaonyeshwa kwenye menyu ya programu badala yake.
permission.description.can_view_old_navigation = Inaruhusiwa kutazama Uabiri wa zamani.
permission.description.can_view_outgoing_messages = Inaruhusiwa kutazama skrini ya ujumbe unaotoka katika programu ya msimamizi.
permission.description.can_view_reports = Inaruhusiwa kutazama Ripoti.
permission.description.can_view_reports_tab = Onyesha kichupo cha Ripoti kwenye programu. Ikiwa haijawekwa, kipengee cha menyu kitaonyeshwa kwenye menyu ya programu badala yake.
Expand Down
1 change: 1 addition & 0 deletions config/default/app_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
"can_upgrade": [
"program_officer"
],
"can_view_old_navigation": [],
"can_default_facility_filter": [],
"can_have_multiple_places": [],
"can_export_devices_details": [
Expand Down
3 changes: 2 additions & 1 deletion config/demo/app_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@
],
"can_upgrade": [
"program_officer"
]
],
"can_view_old_navigation": []
},
"uhc": {
"contacts_default_sort": "",
Expand Down
109 changes: 109 additions & 0 deletions tests/e2e/default-mobile/old-navigation/old-navigation.wdio-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
const utils = require('@utils');
const placeFactory = require('@factories/cht/contacts/place');
const userFactory = require('@factories/cht/users/users');
const personFactory = require('@factories/cht/contacts/person');
const pregnancyFactory = require('@factories/cht/reports/pregnancy');
const loginPage = require('@page-objects/default/login/login.wdio.page');
// const oldNavigationPage = require('@page-objects/default/old-navigation/old-navigation.wdio.page');
// const messagesPage = require('@page-objects/default/sms/messages.wdio.page');
// const taskPage = require('@page-objects/default/tasks/tasks.wdio.page');
// const genericForm = require('@page-objects/default/enketo/generic-form.wdio.page');
// const reportsPage = require('@page-objects/default/reports/reports.wdio.page');
// const contactPage = require('@page-objects/default/contacts/contacts.wdio.page');
// const targetAggregatesPage = require('@page-objects/default/targets/target-aggregates.wdio.page');
// const { waitForPageLoaded } = require('@page-objects/default/common/common.wdio.page');

describe('Old Navigation', () => {
const places = placeFactory.generateHierarchy();
const healthCenter = places.get('health_center');

const offlineUser = userFactory.build({ place: healthCenter._id });

const person = personFactory.build({
phone: '+50689999999',
parent: { _id: healthCenter._id, parent: healthCenter.parent }
});

const pregnancyReport = pregnancyFactory.build({
contact: offlineUser.contact,
fields: { patient_id: person._id }
});

const targetsConfig = [{ id: 'test_target', type: 'count', title: 'Test target', aggregate: true }];

before(async () => {
await utils.saveDocs([...places.values(), person, pregnancyReport]);
await utils.createUsers([offlineUser]);

const settings = await utils.getSettings();
const tasks = settings.tasks;
tasks.targets.items = targetsConfig;
const permissions = settings.permissions;
permissions.can_aggregate_targets = offlineUser.roles;
permissions.can_view_old_navigation = offlineUser.roles;
await utils.updateSettings({ tasks, permissions }, true);

await loginPage.login(offlineUser);
});

after(async () => {
await utils.revertSettings(true);
await utils.deleteUsers([offlineUser]);
});

it('should navigate to the Messages section and open a sent message', async () => {
await browser.pause(100);
/* const message = 'Navigations test';
await oldNavigationPage.goToMessages();
await messagesPage.sendMessage(message, person.name, person.phone );
await messagesPage.openMessage(person._id);

const { name, phone } = await messagesPage.getMessageHeader();
expect(name).to.equal(person.name);
expect(phone).to.equal(person.phone);

const messages = await messagesPage.getAmountOfMessagesByPhone();
const { content, state } = await messagesPage.getMessageContent(messages);
expect(content).to.equal(message);
expect(state).to.equal('pending'); */
});

it('should navigate to the Task section and open the first task listed', async () => {
await browser.pause(100);
/* await oldNavigationPage.goToTasks();
await taskPage.openTaskById(
pregnancyReport._id,
'~pregnancy-danger-sign-follow-up~anc.pregnancy_danger_sign_followup'
);
expect(await genericForm.getFormTitle()).to.equal('Pregnancy danger sign follow-up'); */
});

it('should navigate to the Reports section and open the first report listed', async () => {
await browser.pause(100);
/* await oldNavigationPage.goToReports();
await reportsPage.openSelectedReport(await reportsPage.firstReport());
await waitForPageLoaded();
const openReportInfo = await reportsPage.getOpenReportInfo();
expect(openReportInfo.patientName).to.equal(person.name);
expect(openReportInfo.reportName).to.equal('Pregnancy registration'); */
});

it('should navigate to the People section and open the created Health Center', async () => {
await browser.pause(100);
/* await oldNavigationPage.goToPeople();
await contactPage.selectLHSRowByText(healthCenter.name);
expect(await contactPage.getContactInfoName()).to.equal(healthCenter.name); */
});

it('should navigate to the Targets section, and open a target aggregate', async () => {
await browser.pause(100);
/* await oldNavigationPage.goToAnalytics();
await targetAggregatesPage.goToTargetAggregates(true);
await targetAggregatesPage.openTargetDetails(targetsConfig[0]); */
});

it('should successfully sync', async () => {
await browser.pause(100);
// await oldNavigationPage.sync();
});
});
5 changes: 3 additions & 2 deletions tests/e2e/default-mobile/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ chai.use(require('chai-exclude'));
exports.config = Object.assign(wdioBaseConfig.config, {
suites: {
all: [
'./**/*.wdio-spec.js',
'**/old-navigation.wdio-spec.js',
/*'./!**!/!*.wdio-spec.js',
'../default/login/login-logout.wdio-spec.js',
'../default/navigation/navigation.wdio-spec.js',
'../default/navigation/hamburger-menu.wdio-spec.js',
'../default/navigation/hamburger-menu.wdio-spec.js',*/
]
},
beforeSuite: async () => {
Expand Down
103 changes: 103 additions & 0 deletions tests/e2e/default/old-navigation/old-navigation.wdio-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
const utils = require('@utils');
const placeFactory = require('@factories/cht/contacts/place');
const userFactory = require('@factories/cht/users/users');
const personFactory = require('@factories/cht/contacts/person');
const pregnancyFactory = require('@factories/cht/reports/pregnancy');
const loginPage = require('@page-objects/default/login/login.wdio.page');
const oldNavigationPage = require('@page-objects/default/old-navigation/old-navigation.wdio.page');
const messagesPage = require('@page-objects/default/sms/messages.wdio.page');
const taskPage = require('@page-objects/default/tasks/tasks.wdio.page');
const genericForm = require('@page-objects/default/enketo/generic-form.wdio.page');
const reportsPage = require('@page-objects/default/reports/reports.wdio.page');
const contactPage = require('@page-objects/default/contacts/contacts.wdio.page');
const targetAggregatesPage = require('@page-objects/default/targets/target-aggregates.wdio.page');
const { waitForPageLoaded } = require('@page-objects/default/common/common.wdio.page');

describe('Old Navigation', () => {
const places = placeFactory.generateHierarchy();
const healthCenter = places.get('health_center');

const offlineUser = userFactory.build({ place: healthCenter._id });

const person = personFactory.build({
phone: '+50689999999',
parent: { _id: healthCenter._id, parent: healthCenter.parent }
});

const pregnancyReport = pregnancyFactory.build({
contact: offlineUser.contact,
fields: { patient_id: person._id }
});

const targetsConfig = [{ id: 'test_target', type: 'count', title: 'Test target', aggregate: true }];

before(async () => {
await utils.saveDocs([...places.values(), person, pregnancyReport]);
await utils.createUsers([offlineUser]);

const settings = await utils.getSettings();
const tasks = settings.tasks;
tasks.targets.items = targetsConfig;
const permissions = settings.permissions;
permissions.can_aggregate_targets = offlineUser.roles;
permissions.can_view_old_navigation = offlineUser.roles;
await utils.updateSettings({ tasks, permissions }, true);

await loginPage.login(offlineUser);
});

after(async () => {
await utils.revertSettings(true);
await utils.deleteUsers([offlineUser]);
});

it('should navigate to the Messages section and open a sent message', async () => {
const message = 'Navigations test';
await oldNavigationPage.goToMessages();
await messagesPage.sendMessage(message, person.name, person.phone );
await messagesPage.openMessage(person._id);

const { name, phone } = await messagesPage.getMessageHeader();
expect(name).to.equal(person.name);
expect(phone).to.equal(person.phone);

const messages = await messagesPage.getAmountOfMessagesByPhone();
const { content, state } = await messagesPage.getMessageContent(messages);
expect(content).to.equal(message);
expect(state).to.equal('pending');
});

it('should navigate to the Task section and open the first task listed', async () => {
await oldNavigationPage.goToTasks();
await taskPage.openTaskById(
pregnancyReport._id,
'~pregnancy-danger-sign-follow-up~anc.pregnancy_danger_sign_followup'
);
expect(await genericForm.getFormTitle()).to.equal('Pregnancy danger sign follow-up');
});

it('should navigate to the Reports section and open the first report listed', async () => {
await oldNavigationPage.goToReports();
await reportsPage.openSelectedReport(await reportsPage.firstReport());
await waitForPageLoaded();
const openReportInfo = await reportsPage.getOpenReportInfo();
expect(openReportInfo.patientName).to.equal(person.name);
expect(openReportInfo.reportName).to.equal('Pregnancy registration');
});

it('should navigate to the People section and open the created Health Center', async () => {
await oldNavigationPage.goToPeople();
await contactPage.selectLHSRowByText(healthCenter.name);
expect(await contactPage.getContactInfoName()).to.equal(healthCenter.name);
});

it('should navigate to the Targets section, and open a target aggregate', async () => {
await oldNavigationPage.goToAnalytics();
await targetAggregatesPage.goToTargetAggregates(true);
await targetAggregatesPage.openTargetDetails(targetsConfig[0]);
});

it('should successfully sync', async () => {
await oldNavigationPage.sync();
});
});
50 changes: 27 additions & 23 deletions tests/e2e/default/suites.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
const SUITES = {
core: [
'./admin/**/*.wdio-spec.js',
'./login/**/*.wdio-spec.js',
'./translations/**/*.wdio-spec.js',
'./more-options-menu/**/*.wdio-spec.js',
'./users/**/*.wdio-spec.js',
'./about/**/*.wdio-spec.js',
'./navigation/**/*.wdio-spec.js',
'./privacy-policy/**/*.wdio-spec.js',
// './admin/**/*.wdio-spec.js',
// './login/**/*.wdio-spec.js',
// './translations/**/*.wdio-spec.js',
// './more-options-menu/**/*.wdio-spec.js',
// './users/**/*.wdio-spec.js',
// './about/**/*.wdio-spec.js',
// './navigation/**/*.wdio-spec.js',
'./old-navigation/**/*.wdio-spec.js',
// './privacy-policy/**/*.wdio-spec.js',
],
workflows: [
'./analytics/**/*.wdio-spec.js',
'./contacts/**/*.wdio-spec.js',
'./reports/**/*.wdio-spec.js',
'./targets/**/*.wdio-spec.js',
'./tasks/**/*.wdio-spec.js',
'./sms/**/*.wdio-spec.js',
'./old-navigation/**/*.wdio-spec.js'
// './analytics/**/*.wdio-spec.js',
// './contacts/**/*.wdio-spec.js',
// './reports/**/*.wdio-spec.js',
// './targets/**/*.wdio-spec.js',
// './tasks/**/*.wdio-spec.js',
// './sms/**/*.wdio-spec.js',
],
data: [
'./db/**/*.wdio-spec.js',
'./purge/**/*.wdio-spec.js',
'./telemetry/**/*.wdio-spec.js'
'./old-navigation/**/*.wdio-spec.js'
// './db/**/*.wdio-spec.js',
// './purge/**/*.wdio-spec.js',
// './telemetry/**/*.wdio-spec.js'
],
lowLevel: [
'./pwa/**/*.wdio-spec.js',
'./service-worker/**/*.wdio-spec.js',
'./transitions/**/*.wdio-spec.js',
'./logging/**/*.wdio-spec.js'
'./old-navigation/**/*.wdio-spec.js'
// './pwa/**/*.wdio-spec.js',
// './service-worker/**/*.wdio-spec.js',
// './transitions/**/*.wdio-spec.js',
// './logging/**/*.wdio-spec.js'
],
enketo: [
'./enketo/**/*.wdio-spec.js',
'./old-navigation/**/*.wdio-spec.js'
// './enketo/**/*.wdio-spec.js',
]
};

exports.suites = SUITES;

2 changes: 1 addition & 1 deletion tests/e2e/default/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { suites } = require('./suites');
// Override specific properties from wdio base config
const defaultConfig = Object.assign(wdioBaseConfig.config, {
suites,
specs: ['**/*.wdio-spec.js'],
specs: ['**/old-navigation.wdio-spec.js'],
});

exports.config = defaultConfig;
6 changes: 3 additions & 3 deletions tests/e2e/upgrade/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ const upgradeConfig = Object.assign(wdioBaseConfig.config, {
// order is important, because we want to upgrade from an older version to current version. validate the upgrade
// and then upgrade to master
[
'upgrade.wdio-spec.js',
// 'upgrade.wdio-spec.js',
'admin-user.wdio-spec.js',
'webapp.wdio-spec.js',
'upgrade-master.wdio-spec.js',
// 'webapp.wdio-spec.js',
// 'upgrade-master.wdio-spec.js',
],
exclude: [],

Expand Down
Loading
Loading