Skip to content

feat. add new UI element for picking date time simultaneously #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 75 additions & 12 deletions README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
182 changes: 103 additions & 79 deletions demo-angular/e2e/tests.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ describe("DateTimePicker", () => {
expect(title).to.exist;
});

it("Should expand date picker field examples", async () => {
const dateFieldTitle = await driver.findElementByText("DatePickerField", SearchOptions.contains);
expect(dateFieldTitle).to.exist;
await dateFieldTitle.click();
});

it("Should select date and verify value of picker field", async () => {
const selectDateField = await driver.findElementByText("select date", SearchOptions.contains);
await selectDateField.click();
Expand All @@ -74,15 +80,6 @@ describe("DateTimePicker", () => {
expect(dateSelected).to.exist;
});

it("Should select time and verify value of picker field", async () => {
const selectTimeField = await driver.findElementByText("select time", SearchOptions.contains);
await selectTimeField.click();
const timeString = await getPickerTime(driver, 12);
await clickOkBtn(driver);
const timeSelected = await driver.findElementByText(timeString, SearchOptions.contains);
expect(timeSelected).to.exist;
});

it("Should select date from min/max limited field", async () => {
const minMaxDatePicker = await driver.findElementByText("tap to select", SearchOptions.contains);
await minMaxDatePicker.click();
Expand All @@ -93,22 +90,6 @@ describe("DateTimePicker", () => {
expect(dateSelected).to.exist;
});

it("Should open 12h time format and verify wheelers values", async () => {
const twelveHourFormat = await driver.findElementByText("4:00 PM", SearchOptions.contains);
await twelveHourFormat.click();
const timeString = await getPickerTime(driver, 12);
await clickOkBtn(driver);
expect(timeString).to.equal("4:00 PM");
});

it("Should open 24h format and verify wheeler value", async () => {
const twentyFourFormat = await scrollToElement(driver, "16:00", Direction.down);
await twentyFourFormat.click();
const timeString = await getPickerTime(driver, 24);
await clickOkBtn(driver);
expect(timeString).to.equal("16:00");
});

it("Should verify modified texts field for date picker", async () => {
await scrollToElement(driver, "preferred locale: en_US", Direction.down);
const pickers = await driver.findElementsByText("tap to choose");
Expand All @@ -126,23 +107,8 @@ describe("DateTimePicker", () => {
expect(dateString).to.exist;
});

it("Should verify modified texts field for time picker", async () => {
const datePicker = await driver.findElementByText("tap to choose");
await datePicker.click();
const time = await getPickerTime(driver, 12);
const approveBtn = await driver.findElementByText("Approve", SearchOptions.contains);
const rejectBtn = await driver.findElementByText("Reject", SearchOptions.contains);
const title = await driver.findElementByText("Confirm predefined time selection", SearchOptions.contains);
expect(approveBtn).to.exist;
expect(rejectBtn).to.exist;
expect(title).to.exist;
await approveBtn.click();
const dateString = await driver.findElementByText(time);
expect(dateString).to.exist;
});

it("Should select date from de_De locale picker and verify format", async () => {
await scrollToElement(driver, "zeit wählen", Direction.down);
await scrollToElement(driver, "datum auswählen", Direction.down);
const deLocale = await driver.findElementByText("preferred locale: de_DE");
expect(deLocale).to.exist;
const datePicker = await driver.findElementByText("datum auswählen", SearchOptions.contains);
Expand Down Expand Up @@ -181,56 +147,35 @@ describe("DateTimePicker", () => {
expect(dateString).to.exist;
});

it("Should select time from de_DE locale picker and verify format", async () => {
const timePicker = await driver.findElementByText("zeit wählen", SearchOptions.contains);
await timePicker.click();
const time = await getPickerTime(driver, 24);
let acceptBtn;
let rejectBtn;
if(driver.isAndroid){
let buttons = await driver.findElementsByClassName("android.widget.Button");
acceptBtn = buttons[5];
rejectBtn = buttons[4];
}
else{
acceptBtn = await driver.findElementByText("Bestätigen", SearchOptions.exact);
rejectBtn = await driver.findElementByText("Stornieren", SearchOptions.exact);
}
const title = await driver.findElementByText("Zeit wählen", SearchOptions.exact);
expect(acceptBtn).to.exist;
expect(rejectBtn).to.exist;
expect(title).to.exist;
await acceptBtn.click();
const dateField = await driver.findElementByText(time);
expect(time).to.exist;
});

it("Should scroll to custom format and verify values", async () => {
await scrollToElement(driver, "binding", Direction.down);
const customFromatLabel = await driver.findElementByText("custom format");
expect(customFromatLabel).to.exist;
const customFormatDate = await driver.findElementByText("date: 24 February 2019", SearchOptions.exact);
expect(customFormatDate).to.exist;
const customFormatTime = await driver.findElementByText("time: 01:00", SearchOptions.exact);
expect(customFormatTime).to.exist;
});

it("Should scroll to css styled DatePicker and verify picker style", async () => {
let cssPickers = await driver.findElementsByText("Feb 24, 2019", SearchOptions.exact);
await cssPickers[cssPickers.length - 1].click();
await getPickerDate(driver);
await driver.compareScreen("cssDatePicker");
await clickOkBtn(driver);
});

it("Should scroll to binding example and verify picker and label values", async () => {
await scrollToElement(driver, "css applied", Direction.down);
await scrollToElement(driver, "TimePickerField", Direction.down);
const bindingLabel = await driver.findElementByText("binding", SearchOptions.exact);
expect(bindingLabel).to.exist;
let selector = driver.isAndroid ? "android.widget.EditText" : "XCUIElementTypeTextField"
let fields = await driver.findElementsByClassName(selector);
let timeField;
let dateField;
if(driver.isAndroid){
timeField = fields[2];
dateField = fields[1];
dateField = fields[3];
}
else{
let index = fields.length - 3;
let index = fields.length;
console.log("index: " + index);
timeField = fields[index];
dateField = fields[index - 1];
}
await dateField.click();
Expand All @@ -243,13 +188,84 @@ describe("DateTimePicker", () => {
let bindingDate = await driver.findElementByText(dateLabel, SearchOptions.contains);
});

it("Should scroll to css styled DatePicker and verify picker style", async () => {
await scrollToElement(driver, "tap to select time", Direction.down);
let cssPickers = await driver.findElementsByText("Feb 24, 2019", SearchOptions.exact);
await cssPickers[cssPickers.length - 1].click();
await getPickerDate(driver);
await driver.compareScreen("cssDatePicker");
it("Should expand time picker field examples", async () => {
const timeFieldTitle = await driver.findElementByText("TimePickerField", SearchOptions.contains);
expect(timeFieldTitle).to.exist;
await timeFieldTitle.click();
});

it("Should select time and verify value of picker field", async () => {
const selectTimeField = await driver.findElementByText("select time", SearchOptions.contains);
await selectTimeField.click();
const timeString = await getPickerTime(driver, 12);
await clickOkBtn(driver);
const timeSelected = await driver.findElementByText(timeString, SearchOptions.contains);
expect(timeSelected).to.exist;
});

it("Should open 12h time format and verify wheelers values", async () => {
const twelveHourFormat = await driver.findElementByText("4:00 PM", SearchOptions.contains);
await twelveHourFormat.click();
const timeString = await getPickerTime(driver, 12);
await clickOkBtn(driver);
expect(timeString).to.equal("4:00 PM");
});

it("Should open 24h format and verify wheeler value", async () => {
const twentyFourFormat = await scrollToElement(driver, "16:00", Direction.down);
await twentyFourFormat.click();
const timeString = await getPickerTime(driver, 24);
await clickOkBtn(driver);
expect(timeString).to.equal("16:00");
});

it("Should verify modified texts field for time picker", async () => {
await scrollToElement(driver, "tap to choose", Direction.down);
const datePicker = await driver.findElementByText("tap to choose");
await datePicker.click();
const time = await getPickerTime(driver, 12);
const approveBtn = await driver.findElementByText("Approve", SearchOptions.contains);
const rejectBtn = await driver.findElementByText("Reject", SearchOptions.contains);
const title = await driver.findElementByText("Confirm predefined time selection", SearchOptions.contains);
expect(approveBtn).to.exist;
expect(rejectBtn).to.exist;
expect(title).to.exist;
await approveBtn.click();
const dateString = await driver.findElementByText(time);
expect(dateString).to.exist;
});

it("Should select time from de_DE locale picker and verify format", async () => {
await scrollToElement(driver, "zeit wählen", Direction.down);
const timePicker = await driver.findElementByText("zeit wählen", SearchOptions.contains);
await timePicker.click();
const time = await getPickerTime(driver, 24);
let acceptBtn;
let rejectBtn;
if(driver.isAndroid){
let buttons = await driver.findElementsByClassName("android.widget.Button");
acceptBtn = buttons[5];
rejectBtn = buttons[4];
}
else{
acceptBtn = await driver.findElementByText("Bestätigen", SearchOptions.exact);
rejectBtn = await driver.findElementByText("Stornieren", SearchOptions.exact);
}
const title = await driver.findElementByText("Zeit wählen", SearchOptions.exact);
expect(acceptBtn).to.exist;
expect(rejectBtn).to.exist;
expect(title).to.exist;
await acceptBtn.click();
const dateField = await driver.findElementByText(time);
expect(time).to.exist;
});

it("Should scroll to custom format and verify values", async () => {
await scrollToElement(driver, "binding", Direction.down);
const customFromatLabel = await driver.findElementByText("custom format");
expect(customFromatLabel).to.exist;
const customFormatTime = await driver.findElementByText("time: 01:00", SearchOptions.exact);
expect(customFormatTime).to.exist;
});

it("Should scroll to css styled TimePicker and verify picker style", async () => {
Expand All @@ -260,7 +276,15 @@ describe("DateTimePicker", () => {
await clickOkBtn(driver);
});

it("Should expand custom buttons examples", async () => {
await scrollToElement(driver, "Custom Buttons", Direction.down);
const customButtonsTitle = await driver.findElementByText("Custom Buttons", SearchOptions.contains);
expect(customButtonsTitle).to.exist;
await customButtonsTitle.click();
});

it("Should tap button to select date and verify button text", async () => {
await scrollToElement(driver, "tap to select date and time", Direction.down);
let dateButton = await driver.findElementByText("tap to select date", SearchOptions.contains);
await dateButton.click();
const date = await getPickerDate(driver);
Expand Down
9 changes: 9 additions & 0 deletions demo-angular/src/app/home/home.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
color: #303F9F;
}

.header {
font-size: 16;
margin-top: 12;
margin-bottom: 6;
color: white;
background-color: #2196F3;
text-align: center;
}

label {
padding: 6 4;
}
Expand Down
Loading