Skip to content

Commit

Permalink
Update selectors in Update plan
Browse files Browse the repository at this point in the history
  • Loading branch information
mutuajames committed Jun 22, 2023
1 parent e19c68c commit 922aec6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
28 changes: 14 additions & 14 deletions packages/opensrp-plans/src/containers/NewPlan/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,42 +78,42 @@ describe('Create Plan Page', () => {
// testing implementation details at its best.
// date range field has not initial value

console.log("Question! does this work")
// expect(wrapper.find('.ant-form-item #dateRange').props().value).toEqual([
console.log("does not work")
// expect(wrapper.find('#dateRange FormItemInput').props().value).toEqual([
// undefined,
// undefined,
// ]);
expect(wrapper.find('.ant-form-item #dateRange').first().props().value).toEqual(undefined);
expect(wrapper.find('.ant-form-item #dateRange').last().props().value).toEqual(undefined);
expect(wrapper.find('#dateRange .ant-form-item').at(0).props().value).toEqual(undefined);
// expect(wrapper.find('#dateRange RangePicker').at(1).props().value).toEqual(undefined);

// check interventionType hidden
expect(wrapper.find('.ant-form-item #interventionType').first().props().hidden).toBeTruthy();
expect(wrapper.find('#interventionType FormItemInput').first().props().hidden).toBeTruthy();

// check title are hidden
expect(wrapper.find('.ant-form-item #title').first().props().hidden).toBeTruthy();
expect(wrapper.find('#title FormItemInput').first().props().hidden).toBeTruthy();

// name is hidden by default
expect(wrapper.find('.ant-form-item #name').first().props().hidden).toBeTruthy();
expect(wrapper.find('#name FormItemInput').first().props().hidden).toBeTruthy();

// identifier is hidden by default
expect(wrapper.find('.ant-form-item #identifier').first().props().hidden).toBeTruthy();
expect(wrapper.find('#identifier FormItemInput').first().props().hidden).toBeTruthy();

// version is hidden by default
expect(wrapper.find('.ant-form-item #version').first().props().hidden).toBeTruthy();
expect(wrapper.find('#version FormItemInput').first().props().hidden).toBeTruthy();

// taskGenerationStatus is hidden by default
expect(wrapper.find('.ant-form-item #taskGenerationStatus').first().props().hidden).toBeTruthy();
expect(wrapper.find('#taskGenerationStatus FormItemInput').first().props().hidden).toBeTruthy();

// status is not hidden
expect(wrapper.find('.ant-form-item #status').first().props().hidden).toBeFalsy();
expect(wrapper.find('#status FormItemInput').first().props().hidden).toBeFalsy();

// dateRange is not hidden
expect(wrapper.find('.ant-form-item #dateRange').first().props().hidden).toBeFalsy();
expect(wrapper.find('#dateRange FormItemInput').first().props().hidden).toBeFalsy();

// date is hidden by default
expect(wrapper.find('.ant-form-item #date').first().props().hidden).toBeTruthy();
expect(wrapper.find('#date FormItemInput').first().props().hidden).toBeTruthy();

// date is hidden by default
expect(wrapper.find('.ant-form-item #description').first().props().hidden).toBeFalsy();
expect(wrapper.find('#description FormItemInput').first().props().hidden).toBeFalsy();
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Update plan Page planform is configured correctly: full text snapshot 1`] = `"Edit missionIntervention TypeSupply ManagementPlan TitleStatusactivecompleteretiredActive date rangeDescriptionAdd JurisdictionActivitiesProduct CheckActionDescriptionCheck for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsFix Product ProblemActionDescriptionFix problems for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsRecord GPSActionDescriptionRecord GPS for all service points (100%) without GPS within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsService Point CheckActionDescriptionConduct checkfor all service points (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsSave PlanCancel"`;
exports[`Update plan Page planform is configured correctly: full text snapshot 1`] = `"Edit missionIntervention TypeSupply ManagementPlan TitleStatusactivecompleteretiredActive date rangeDescription0 / 200Add JurisdictionActivitiesProduct CheckActionDescriptionCheck for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsFix Product ProblemActionDescriptionFix problems for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsRecord GPSActionDescriptionRecord GPS for all service points (100%) without GPS within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsService Point CheckActionDescriptionConduct checkfor all service points (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsSave PlanCancel"`;

exports[`Update plan Page renders correctly with store(for editing plans): full text snapshot 1`] = `"Edit missionIntervention TypeSupply ManagementPlan TitleStatusactivecompleteretiredActive date rangeDescriptionAdd JurisdictionActivitiesProduct CheckActionDescriptionCheck for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsFix Product ProblemActionDescriptionFix problems for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsRecord GPSActionDescriptionRecord GPS for all service points (100%) without GPS within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsService Point CheckActionDescriptionConduct checkfor all service points (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsSave PlanCancel"`;
exports[`Update plan Page renders correctly with store(for editing plans): full text snapshot 1`] = `"Edit missionIntervention TypeSupply ManagementPlan TitleStatusactivecompleteretiredActive date rangeDescription0 / 200Add JurisdictionActivitiesProduct CheckActionDescriptionCheck for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsFix Product ProblemActionDescriptionFix problems for all products (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsRecord GPSActionDescriptionRecord GPS for all service points (100%) without GPS within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsService Point CheckActionDescriptionConduct checkfor all service points (100%) within the jurisdictionReasonRoutineGoalQuantityunknownStart DateEnd DatePriorityMedium PriorityTriggers and ConditionsSave PlanCancel"`;
Original file line number Diff line number Diff line change
Expand Up @@ -146,36 +146,36 @@ describe('Update plan Page', () => {

// check if form is rendered on the page
expect(wrapper.find('form')).toHaveLength(1);

// check interventionType hidden
expect(wrapper.find('FormItem#interventionType').props().hidden).toBeTruthy();
expect(wrapper.find('#interventionType FormItemInput').props().hidden).toBeTruthy();

// check title is shown
expect(wrapper.find('FormItem#title').props().hidden).toBeFalsy();
expect(wrapper.find('#title FormItemInput').props().hidden).toBeFalsy();

// name is hidden by default
expect(wrapper.find('FormItem#name').props().hidden).toBeTruthy();
expect(wrapper.find('#name FormItemInput').props().hidden).toBeTruthy();

// identifier is hidden by default
expect(wrapper.find('FormItem#identifier').props().hidden).toBeTruthy();
expect(wrapper.find('#identifier FormItemInput').props().hidden).toBeTruthy();

// version is hidden by default
expect(wrapper.find('FormItem#version').props().hidden).toBeTruthy();
expect(wrapper.find('#version FormItemInput').props().hidden).toBeTruthy();

// taskGenerationStatus is hidden by default
expect(wrapper.find('FormItem#taskGenerationStatus').props().hidden).toBeTruthy();
expect(wrapper.find('#taskGenerationStatus FormItemInput').props().hidden).toBeTruthy();

// status is not hidden
expect(wrapper.find('FormItem#status').props().hidden).toBeFalsy();
expect(wrapper.find('#status FormItemInput').props().hidden).toBeFalsy();

// dateRange is not hidden
expect(wrapper.find('FormItem#dateRange').props().hidden).toBeFalsy();
expect(wrapper.find('#dateRange FormItemInput').props().hidden).toBeFalsy();

// date is hidden by default
expect(wrapper.find('FormItem#date').props().hidden).toBeTruthy();
expect(wrapper.find('#date FormItemInput').props().hidden).toBeTruthy();

// date is hidden by default
expect(wrapper.find('FormItem#description').props().hidden).toBeFalsy();
expect(wrapper.find('#description FormItemInput').props().hidden).toBeFalsy();
});

it('shows broken page', async () => {
Expand Down

0 comments on commit 922aec6

Please sign in to comment.