Skip to content

Commit

Permalink
chore(#9594): add remaining e2e test to tasks for offline user (#9640)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafa <[email protected]>
  • Loading branch information
ralfudx and Rafa authored Nov 14, 2024
1 parent a9aea1e commit df74663
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
33 changes: 32 additions & 1 deletion tests/e2e/default/tasks/config/tasks-breadcrumbs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = [
],
events: [
{
id: 'person-creation-follow-up',
id: 'person-creation',
start: 3,
end: 7,
dueDate: function (event, contact) {
Expand All @@ -47,4 +47,35 @@ module.exports = [
}
]
},

{
name: 'person_create_follow_up',
icon: 'icon-person',
title: 'person_create_follow_up',
appliesTo: 'reports',
appliesToType: ['home_visit'],
appliesIf: function () {
return true;
},
resolvedIf: function (contact) {
return isFormArraySubmittedInWindow(contact.reports, ['home_visit'], contact.contact.reported_date);
},
actions: [
{
type: 'report',
form: 'home_visit'
}
],
events: [
{
id: 'person-creation-follow-up',
start: 3,
end: 1,
dueDate: function (event, contact) {
return contact.contact.reported_date;
}
}
]
},

];
18 changes: 18 additions & 0 deletions tests/e2e/default/tasks/tasks.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ describe('Tasks', () => {
expect(list).to.have.length(2);
});

it('should add a task when CHW completes a task successfully, and that task creates another task', async () => {
await tasksPage.compileTasks('tasks-breadcrumbs-config.js', false);

await commonPage.goToTasks();
let list = await tasksPage.getTasks();
expect(list).to.have.length(2);
let task = await tasksPage.getTaskByContactAndForm('Megan Spice', 'person_create');
await task.click();
await tasksPage.waitForTaskContentLoaded('Home Visit');
const taskElement = await tasksPage.getOpenTaskElement();
await genericForm.submitForm();
await taskElement.waitForDisplayed();
await commonPage.sync(true);
task = await tasksPage.getTaskByContactAndForm('Megan Spice', 'person_create_follow_up');
list = await tasksPage.getTasks();
expect(list).to.have.length(3);
});

it('should load multiple pages of tasks on infinite scrolling', async () => {
await tasksPage.compileTasks('tasks-multiple-config.js', true);

Expand Down

0 comments on commit df74663

Please sign in to comment.