Skip to content

Commit

Permalink
Merge #4890
Browse files Browse the repository at this point in the history
4890: Test(Component Date Editor) r=jniles a=lomamech

- Addition of a new parameter to solve the problem of the date editor
component for forms whose .header-image is not visible by adding a new
component
- Use bhDateEdit in Off Days E2E test

closes #4889

Co-authored-by: Chris Lomame <lomamech@gmail.com>
  • Loading branch information
bors[bot] and lomamech authored Sep 9, 2020
2 parents 58a8666 + 262a052 commit 781a922
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions test/end-to-end/fillForm/fillForm.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class FillFormManagementPage {
await browser.findElement(by.css('[name="poids"]')).sendKeys(fillForm.poids);
await browser.findElement(by.css('[name="dosekilos"]')).sendKeys(fillForm.dosekilos);
await browser.findElement(by.css('[name="nombreFois"]')).sendKeys(fillForm.nombreFois);
await components.dateEditor.set(new Date(fillForm.date), null, '.title');
await browser.findElement(by.css('[name="voie"]')).sendKeys(fillForm.voie);
await browser.findElement(by.css('[ng-model="hours"]')).sendKeys(fillForm.hours);
await browser.findElement(by.css('[ng-model="minutes"]')).sendKeys(fillForm.minutes);
Expand All @@ -55,6 +56,7 @@ class FillFormManagementPage {
await browser.findElement(by.css('[name="poids"]')).sendKeys(fillForm.poids);
await browser.findElement(by.css('[name="dosekilos"]')).sendKeys(fillForm.dosekilos);
await browser.findElement(by.css('[name="nombreFois"]')).sendKeys(fillForm.nombreFois);
await components.dateEditor.set(new Date(fillForm.date), null, '.title');
await browser.findElement(by.css('[name="voie"]')).sendKeys(fillForm.voie);
await browser.findElement(by.css('[ng-model="hours"]')).sendKeys(fillForm.hours);
await browser.findElement(by.css('[ng-model="minutes"]')).sendKeys(fillForm.minutes);
Expand Down
6 changes: 2 additions & 4 deletions test/end-to-end/offdays/offdays.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class OffdayPage {
await FU.buttons.create();
await FU.input('OffdayModalCtrl.offday.label', offday.label);

// FIX ME TO SET OFFDAY DATE WITH COMPONENTS DATE EDITOR
// components.dateEditor.set(new Date(offday.date));
components.dateEditor.set(new Date(offday.date), null, '.title');

await FU.input('OffdayModalCtrl.offday.percent_pay', offday.percent_pay);

Expand Down Expand Up @@ -66,8 +65,7 @@ class OffdayPage {

await FU.input('OffdayModalCtrl.offday.label', updateOffday.label);

// FIX ME TO SET OFFDAY DATE WITH COMPONENTS DATE EDITOR
// components.dateEditor.set(new Date(updateOffday.date));
components.dateEditor.set(new Date(updateOffday.date), null, '.title');

await FU.input('OffdayModalCtrl.offday.percent_pay', updateOffday.percent_pay);

Expand Down
7 changes: 5 additions & 2 deletions test/end-to-end/shared/components/bhDateEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = {
* @param {String} elementClick - determine a css class that will clicked to
* close the selection component Dates.
*/
set : async function set(date, id, elementClick = '.header-image') {
set : async function set(date, id, elementClick) {
const elementCloseComponent = elementClick || '.header-image';

// fail hard if the user did not pass into
/* if (!(date instanceof Date)) {
Expand Down Expand Up @@ -49,7 +50,9 @@ module.exports = {
// at this point, the datepicker is still open, and will intercept all
// clicks that are made to any elements it is covering. In order to make
// the dropdown go away, we will click on the top-left bhima logo to blur
// in default option, If not, the click will be on an element of the form,
// if and only if the logo is not visible, for example for the modal window
// the dropdown and remove it.
await element(by.css(elementClick)).click();
await element(by.css(elementCloseComponent)).click();
},
};

0 comments on commit 781a922

Please sign in to comment.