Skip to content

Commit

Permalink
added and updated test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Gulshan Mishra authored and ci-build committed Jan 12, 2024
1 parent d67a467 commit b77491d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
Expand Up @@ -58,7 +58,8 @@ describe("Form Runtime with Date Picker", () => {
});

// choose a different date and check if its persisted
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => {
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").eq(0)
.click({force: true}).then(() => {
cy.get("#li-day-3").should("be.visible").click(); // clicking on the 2nd day of the month of October 2023
cy.get(`#${datePicker7}`).find("input").blur().should("have.value","mercredi, 2 août, 2023");
cy.get(`#${datePicker7}`).find("input").focus().should("have.value","02/08/2023");
Expand All @@ -68,14 +69,16 @@ describe("Form Runtime with Date Picker", () => {

it("Test order of the days", () => {
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[6];
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => {
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible")
.eq(0).click({force: true}).then(() => {
cy.get(".header").invoke("text").should("eq", 'dim.lun.mar.mer.jeu.ven.sam.');
});
});

it("Test localisation for date picker", () => {
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[6];
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => {
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible")
.eq(0).click({force: true}).then(() => {
cy.get(".header").invoke("text").should("eq", 'dim.lun.mar.mer.jeu.ven.sam.');
cy.get(".dp-clear").invoke("text").should("eq", 'Effacer');
});
Expand Down
22 changes: 20 additions & 2 deletions ui.tests/test-module/specs/datepicker/datepicker.runtime.spec.js
Expand Up @@ -221,8 +221,8 @@ describe("Form Runtime with Date Picker", () => {
});
});

it.only("input given as per edit pattern should be valid", () => {
const [datePicker8, fieldView] = Object.entries(formContainer._fields)[7]
it("input given as per edit pattern should be valid", () => {
const [datePicker8] = Object.entries(formContainer._fields)[7]
const incorrectInput = "01-01-2023";
const correctInput = "25/2/2023";
cy.get(`#${datePicker8}`).find("input").clear().type(incorrectInput).blur().then(x => {
Expand All @@ -246,4 +246,22 @@ describe("Form Runtime with Date Picker", () => {
});
});

it("Test changing dates in datePicker then typing manually updates model", () => {
const [datePicker7] = Object.entries(formContainer._fields)[6];

cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible")
.eq(0).click({force: true}).then(() => {
cy.get("#li-day-3").should("be.visible").click(); // clicking on the 2nd day of the month of October 2023
cy.get(`#${datePicker7}`).find("input").blur().should("have.value","Tuesday, 2 January, 2024");
cy.get(`#${datePicker7}`).find("input").focus().should("have.value","2/1/2024");
});

// choose a different date and check if its persisted
const date = '23/1/2024';
cy.get(`#${datePicker7}`).find("input").clear().type(date).then(() => {
cy.get(`#${datePicker7}`).find("input").blur().should("have.value", "Tuesday, 23 January, 2024");
cy.get(`#${datePicker7}`).find("input").focus().should("have.value",date);
});
});

})
Expand Up @@ -29,7 +29,8 @@ describe("Form Runtime with Date Picker", () => {
// Year should be in Buddhist calendar year for Thai language
it("Test localisation for date picker for thai", () => {
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[6];
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => {
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible")
.eq(0).click({force: true}).then(() => {
let todayDate = new Date();

const dateFormat = new Intl.DateTimeFormat('th', {
Expand Down

0 comments on commit b77491d

Please sign in to comment.