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 18 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
6 changes: 3 additions & 3 deletions tests/e2e/default-mobile/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ chai.use(require('chai-exclude'));
// Override specific properties from wdio base config
exports.config = Object.assign(wdioBaseConfig.config, {
suites: {
all: [
'./**/*.wdio-spec.js',
/*all: [
'./!**!/!*.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,
Expand Down
76 changes: 76 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,76 @@
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 utils = require('@utils');
const loginPage = require('@page-objects/default/login/login.wdio.page');
const commonPage = require('@page-objects/default/common/common.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');

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 }
});

before(async () => {
await utils.saveDocs([...places.values(), person, pregnancyReport]);
await utils.createUsers([offlineUser]);
await utils.updatePermissions(['chw'], ['can_view_old_navigation'], [], true);
await loginPage.login(offlineUser);
});

it('should navigate through the old layout, including messages, tasks, reports and targets', async () => {
await commonPage.goToMessages();
await messagesPage.sendMessage('Navigations test', person.name, person.phone );
tatilepizs marked this conversation as resolved.
Show resolved Hide resolved
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('Navigations test');
expect(state).to.equal('pending');

await commonPage.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');

await commonPage.goToReports();
await reportsPage.openSelectedReport(await reportsPage.firstReport());
await commonPage.waitForPageLoaded();
const openReportInfo = await reportsPage.getOpenReportInfo();
expect(openReportInfo.patientName).to.equal(person.name);
expect(openReportInfo.reportName).to.equal('Pregnancy registration');

await commonPage.goToPeople();
await contactPage.selectLHSRowByText(healthCenter.name);
expect((await contactPage.getContactInfoName())).to.equal(healthCenter.name);
tatilepizs marked this conversation as resolved.
Show resolved Hide resolved
/*await contactPage.selectLHSRowByText(BABY_NAME);
expect((await contactPage.getContactInfoName())).to.equal(BABY_NAME);*/
tatilepizs marked this conversation as resolved.
Show resolved Hide resolved

await commonPage.goToAnalytics();
await browser.pause(1000);
tatilepizs marked this conversation as resolved.
Show resolved Hide resolved
});


tatilepizs marked this conversation as resolved.
Show resolved Hide resolved
tatilepizs marked this conversation as resolved.
Show resolved Hide resolved
});
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;
Loading
Loading