-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: planningcalender special case (#371)
* feat(test): add test for planningCalendar * test(planningcalendar): create working test * fix(js-app): numer of expected buttons Co-authored-by: dominikfeininger <[email protected]>
- Loading branch information
1 parent
e230423
commit 0258d71
Showing
9 changed files
with
670 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
478 changes: 478 additions & 0 deletions
478
examples/ui5-js-app/webapp/controller/Calendar.controller.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
examples/ui5-js-app/webapp/test/e2e/pageObjects/ComponentLocator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { wdi5 } = require("wdio-ui5-service") | ||
const Page = require("./Page") | ||
|
||
// const planningCalendarRow = { | ||
// selector: { | ||
// controlType: "sap.m.internal.PlanningCalendarRowListItem", | ||
// id: /__row0-__xmlview0--schedulePlanningCalendar-0-CLI$/ | ||
// } | ||
// } | ||
|
||
class ComponentLocator extends Page { | ||
async open(path) { | ||
wdi5.goTo(path) | ||
} | ||
|
||
async open() { | ||
await super.open(`#/Calendar`) | ||
} | ||
|
||
async getShowButton() { | ||
const showSummary = { | ||
selector: { | ||
controlType: "sap.m.Button", | ||
id: /TodayBtn$/ | ||
} | ||
} | ||
|
||
return await browser.asControl(showSummary) | ||
} | ||
|
||
async getCloseSummaryButton() { | ||
const closeSummary = { | ||
selector: { | ||
controlType: "sap.m.Button", | ||
id: /closeSummaryButton$/ | ||
} | ||
} | ||
|
||
return await browser.asControl(closeSummary) | ||
} | ||
|
||
async getPlanningCalendar() { | ||
const planningCalendar = { | ||
selector: { | ||
controlType: "sap.m.PlanningCalendar", | ||
id: /PC1/ | ||
} | ||
} | ||
|
||
return await browser.asControl(planningCalendar) | ||
} | ||
} | ||
|
||
module.exports = new ComponentLocator() |
44 changes: 44 additions & 0 deletions
44
examples/ui5-js-app/webapp/test/e2e/planningCalendar.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const CL = require("./pageObjects/ComponentLocator") | ||
|
||
describe("Planning Calendar test spec", () => { | ||
before(async () => { | ||
await CL.open() | ||
}) | ||
|
||
it("should show aggreates of planning calendar", async () => { | ||
// I wait for a button to be clickable (which means that my app has loaded | ||
const showBtn = await CL.getShowButton() | ||
await browser.waitUntil(() => showBtn.$().isClickable()) | ||
// I get the planning calendar | ||
const pc = await CL.getPlanningCalendar() | ||
// I get aggregated rows | ||
const rows = await pc.getRows() | ||
// each people has a row | ||
|
||
const cells0 = await rows[0].getCells() | ||
// the first two rows have two cell which are the the reminders and the appointments, third row does not have reminders! | ||
const appointments0 = await cells0[1].getAppointments() | ||
expect(appointments0.length).toBeGreaterThan(4) // four appointments visible on the selected date, but 22 in total | ||
|
||
// every first appointment is a meeting | ||
// the first three appointment are in the past and not visible -> not in DOM -> see error logs | ||
const appointments0Text = await appointments0[3].getTitle() | ||
expect(appointments0Text).toContain("Meet Max Mustermann") | ||
|
||
const cells1 = await rows[1].getCells() | ||
// the first two rows have two cell which are the the reminders and the appointments, third row does not have reminders! | ||
const appointments1 = await cells1[1].getAppointments() | ||
expect(appointments1.length).toBeGreaterThan(4) // three appointments visible on the selected date, but 11 in total | ||
|
||
// every first appointment is a meeting | ||
// the first three appointment are in the past and not visible -> not in DOM -> see error logs | ||
const appointments1Text = await appointments1[3].getTitle() | ||
expect(appointments1Text).toContain("Team meeting") | ||
|
||
// test in all rows | ||
for (const row of rows) { | ||
const rowInfo = await row.getControlInfo() | ||
expect(rowInfo.className).toBe("sap.m.internal.PlanningCalendarRowListItem") | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<mvc:View controllerName="test.Sample.controller.Calendar" displayBlock="true" | ||
xmlns="sap.m" | ||
xmlns:mvc="sap.ui.core.mvc" | ||
xmlns:core="sap.ui.core" | ||
xmlns:unified="sap.ui.unified"> | ||
|
||
<Page title="Planning Calendar"> | ||
<content> | ||
<VBox class="sapUiSmallMargin"> | ||
<PlanningCalendar id="PC1" startDate="{path: '/startDate'}" rows="{path: '/people'}" appointmentsVisualization="Filled" appointmentSelect="handleAppointmentSelect" showEmptyIntervalHeaders="false" showWeekNumbers="true"> | ||
<toolbarContent> | ||
<Title text="Title" titleStyle="H4"/> | ||
</toolbarContent> | ||
<rows> | ||
<PlanningCalendarRow icon="{pic}" title="{name}" text="{role}" appointments="{path : 'appointments', templateShareable: false}" intervalHeaders="{path: 'headers', templateShareable: false}"> | ||
<customData> | ||
<core:CustomData key="emp-name" value="{name}" writeToDom="true"/> | ||
</customData> | ||
<appointments> | ||
<unified:CalendarAppointment startDate="{start}" endDate="{end}" icon="{pic}" title="{title}" text="{info}" type="{type}" tentative="{tentative}"> | ||
</unified:CalendarAppointment> | ||
</appointments> | ||
<intervalHeaders> | ||
<unified:CalendarAppointment startDate="{start}" endDate="{end}" icon="{pic}" title="{title}" type="{type}"> | ||
</unified:CalendarAppointment> | ||
</intervalHeaders> | ||
</PlanningCalendarRow> | ||
</rows> | ||
</PlanningCalendar> | ||
<Label text="Add available built-in views to the example:"/> | ||
<MultiComboBox selectionFinish="handleSelectionFinish" width="230px" placeholder="Choose built-in views"> | ||
<items> | ||
<core:Item key="Hour" text="Hour" /> | ||
<core:Item key="Day" text="Day" /> | ||
<core:Item key="Month" text="Month" /> | ||
<core:Item key="Week" text="1 week" /> | ||
<core:Item key="One Month" text="1 month" /> | ||
</items> | ||
</MultiComboBox> | ||
</VBox> | ||
</content> | ||
</Page> | ||
|
||
</mvc:View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters