;
diff --git a/tests/ui/apps/RangePicker/RangePicker-View.js b/tests/ui/apps/RangePicker/RangePicker-View.js
index 7bb3e5419..47374e258 100644
--- a/tests/ui/apps/RangePicker/RangePicker-View.js
+++ b/tests/ui/apps/RangePicker/RangePicker-View.js
@@ -2,10 +2,14 @@ import RangePicker from '../../../../RangePicker';
import ThemeDecorator from '../../../../ThemeDecorator';
const app = (props) =>
-
;
diff --git a/tests/ui/specs/DatePicker/DatePicker-specs.js b/tests/ui/specs/DatePicker/DatePicker-specs.js
index 9962bacf3..3b57968a6 100644
--- a/tests/ui/specs/DatePicker/DatePicker-specs.js
+++ b/tests/ui/specs/DatePicker/DatePicker-specs.js
@@ -12,19 +12,19 @@ describe('DatePicker', function () {
const datePicker = Page.components.datePickerDefault;
it('should have month-day-year order', function () {
- expect(datePicker.decrementer(datePicker.month).isFocused(), 'Month').to.be.true();
+ Page.spotlightDown();
+ expect(datePicker.month.isFocused(), 'Month').to.be.true();
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.day).isFocused(), 'Day').to.be.true();
+ expect(datePicker.day.isFocused(), 'Day').to.be.true();
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.year).isFocused(), 'Year').to.be.true();
+ expect(datePicker.year.isFocused(), 'Year').to.be.true();
});
describe('5-way', function () {
it('should increase the month when incrementing the picker', function () {
const {month} = extractValues(datePicker);
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
+ expect(datePicker.month.isFocused()).to.be.true();
Page.spotlightDown();
- Page.spotlightSelect();
const {month: value} = extractValues(datePicker);
const expected = month < 12 ? month + 1 : 1;
expect(value).to.equal(expected);
@@ -32,8 +32,8 @@ describe('DatePicker', function () {
it('should decrease the month when decrementing the picker', function () {
const {month} = extractValues(datePicker);
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(datePicker.month.isFocused()).to.be.true();
+ Page.spotlightUp();
const {month: value} = extractValues(datePicker);
const expected = month > 1 ? month - 1 : 12;
expect(value).to.equal(expected);
@@ -43,9 +43,8 @@ describe('DatePicker', function () {
const {day, month, year} = extractValues(datePicker);
const numDays = daysInMonth({month, year});
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
+ expect(datePicker.day.isFocused()).to.be.true();
Page.spotlightDown();
- Page.spotlightSelect();
const {day: value} = extractValues(datePicker);
const expected = day !== numDays ? day + 1 : 1;
expect(value).to.equal(expected);
@@ -55,8 +54,8 @@ describe('DatePicker', function () {
const {day, month, year} = extractValues(datePicker);
const numDays = daysInMonth({month, year});
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(datePicker.day.isFocused()).to.be.true();
+ Page.spotlightUp();
const {day: value} = extractValues(datePicker);
const expected = day !== 1 ? day - 1 : numDays;
expect(value).to.equal(expected);
@@ -66,9 +65,8 @@ describe('DatePicker', function () {
const {year} = extractValues(datePicker);
Page.spotlightRight();
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.year).isFocused()).to.be.true();
+ expect(datePicker.year.isFocused()).to.be.true();
Page.spotlightDown();
- Page.spotlightSelect();
const {year: value} = extractValues(datePicker);
const expected = year + 1;
expect(value).to.equal(expected);
@@ -78,8 +76,8 @@ describe('DatePicker', function () {
const {year} = extractValues(datePicker);
Page.spotlightRight();
Page.spotlightRight();
- expect(datePicker.decrementer(datePicker.year).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(datePicker.year.isFocused()).to.be.true();
+ Page.spotlightUp();
const {year: value} = extractValues(datePicker);
const expected = year - 1;
expect(value).to.equal(expected);
@@ -90,7 +88,7 @@ describe('DatePicker', function () {
it('should increase the month when incrementing the picker', function () {
const {month} = extractValues(datePicker);
datePicker.incrementer(datePicker.month).click();
- expect(datePicker.incrementer(datePicker.month).isFocused()).to.be.true();
+ expect(datePicker.month.isFocused()).to.be.true();
const {month: value} = extractValues(datePicker);
const expected = month < 12 ? month + 1 : 1;
expect(value).to.equal(expected);
@@ -99,7 +97,7 @@ describe('DatePicker', function () {
it('should decrease the month when decrementing the picker', function () {
const {month} = extractValues(datePicker);
datePicker.decrementer(datePicker.month).click();
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
+ expect(datePicker.month.isFocused()).to.be.true();
const {month: value} = extractValues(datePicker);
const expected = month > 1 ? month - 1 : 12;
expect(value).to.equal(expected);
@@ -109,7 +107,7 @@ describe('DatePicker', function () {
const {day, month, year} = extractValues(datePicker);
const numDays = daysInMonth({month, year});
datePicker.incrementer(datePicker.day).click();
- expect(datePicker.incrementer(datePicker.day).isFocused()).to.be.true();
+ expect(datePicker.day.isFocused()).to.be.true();
const {day: value} = extractValues(datePicker);
const expected = day !== numDays ? day + 1 : 1;
expect(value).to.equal(expected);
@@ -119,7 +117,7 @@ describe('DatePicker', function () {
const {day, month, year} = extractValues(datePicker);
const numDays = daysInMonth({month, year});
datePicker.decrementer(datePicker.day).click();
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
+ expect(datePicker.day.isFocused()).to.be.true();
const {day: value} = extractValues(datePicker);
const expected = day !== 1 ? day - 1 : numDays;
expect(value).to.equal(expected);
@@ -128,7 +126,7 @@ describe('DatePicker', function () {
it('should increase the year when incrementing the picker', function () {
const {year} = extractValues(datePicker);
datePicker.incrementer(datePicker.year).click();
- expect(datePicker.incrementer(datePicker.year).isFocused()).to.be.true();
+ expect(datePicker.year.isFocused()).to.be.true();
const {year: value} = extractValues(datePicker);
const expected = year + 1;
expect(value).to.equal(expected);
@@ -137,7 +135,7 @@ describe('DatePicker', function () {
it('should decrease the year when decrementing the picker', function () {
const {year} = extractValues(datePicker);
datePicker.decrementer(datePicker.year).click();
- expect(datePicker.decrementer(datePicker.year).isFocused()).to.be.true();
+ expect(datePicker.year.isFocused()).to.be.true();
const {year: value} = extractValues(datePicker);
const expected = year - 1;
expect(value).to.equal(expected);
@@ -150,9 +148,22 @@ describe('DatePicker', function () {
const datePicker = Page.components.datePickerWithDefaultValue;
describe('5-way', function () {
- it('should not update on select', function () {
+ it('should not update when incrementing the picker', function () {
datePicker.focus();
- Page.spotlightSelect();
+ Page.spotlightRight();
+ Page.spotlightDown();
+
+ const {day, month, year} = extractValues(datePicker);
+
+ expect(day).to.equal(6);
+ expect(month).to.equal(6); // `Date` uses 0-indexed months, picker displays 1-indexed month values
+ expect(year).to.equal(2020);
+ });
+
+ it('should not update when decrementing the picker', function () {
+ datePicker.focus();
+ Page.spotlightRight();
+ Page.spotlightUp();
const {day, month, year} = extractValues(datePicker);
@@ -168,21 +179,21 @@ describe('DatePicker', function () {
const datePicker = Page.components.datePickerDisabled;
it('should focus the disabled month picker', function () {
- datePicker.decrementer(datePicker.month).click();
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
+ datePicker.month.click();
+ expect(datePicker.month.isFocused()).to.be.true();
});
it('should not increase the day when incrementing disabled picker', function () {
- datePicker.incrementer(datePicker.day).click();
- expect(datePicker.incrementer(datePicker.day).isFocused()).to.be.true();
+ datePicker.focus();
+ Page.spotlightDown();
browser.pause(500);
const {day: value} = extractValues(datePicker);
expect(value).to.equal(1);
});
it('should not decrease the day when decrementing disabled picker', function () {
- datePicker.decrementer(datePicker.day).click();
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
+ datePicker.focus();
+ Page.spotlightUp();
browser.pause(500);
const {day: value} = extractValues(datePicker);
expect(value).to.equal(1);
@@ -203,14 +214,12 @@ describe('DatePicker', function () {
it('should not update \'defaultValue\' on decrementing disabled picker', function () {
const {day, month, year} = extractValues(datePicker);
- datePicker.decrementer(datePicker.month).click();
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
-
- datePicker.decrementer(datePicker.day).click();
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
-
- datePicker.decrementer(datePicker.year).click();
- expect(datePicker.decrementer(datePicker.year).isFocused()).to.be.true();
+ datePicker.focus();
+ Page.spotlightUp();
+ Page.spotlightRight();
+ Page.spotlightUp();
+ Page.spotlightRight();
+ Page.spotlightUp();
browser.pause(500);
@@ -221,15 +230,12 @@ describe('DatePicker', function () {
it('should not update \'defaultValue\' on incrementing disabled picker', function () {
const {day, month, year} = extractValues(datePicker);
-
- datePicker.incrementer(datePicker.month).click();
- expect(datePicker.incrementer(datePicker.month).isFocused()).to.be.true();
-
- datePicker.incrementer(datePicker.day).click();
- expect(datePicker.incrementer(datePicker.day).isFocused()).to.be.true();
-
- datePicker.incrementer(datePicker.year).click();
- expect(datePicker.incrementer(datePicker.year).isFocused()).to.be.true();
+ datePicker.focus();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightDown();
browser.pause(500);
@@ -247,16 +253,16 @@ describe('DatePicker', function () {
Page.open('?locale=ar-SA');
});
- it('should focus rightmost picker (day) when selected', function () {
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
- });
-
it('should have day-month-year order', function () {
- expect(datePicker.decrementer(datePicker.day).isFocused()).to.be.true();
+ datePicker.focus();
+ Page.spotlightRight();
+ Page.spotlightRight();
+
+ expect(datePicker.day.isFocused()).to.be.true();
Page.spotlightLeft();
- expect(datePicker.decrementer(datePicker.month).isFocused()).to.be.true();
+ expect(datePicker.month.isFocused()).to.be.true();
Page.spotlightLeft();
- expect(datePicker.decrementer(datePicker.year).isFocused()).to.be.true();
+ expect(datePicker.year.isFocused()).to.be.true();
});
});
});
diff --git a/tests/ui/specs/DatePicker/DatePicker-utils.js b/tests/ui/specs/DatePicker/DatePicker-utils.js
index 186218a9d..1cb527ca0 100644
--- a/tests/ui/specs/DatePicker/DatePicker-utils.js
+++ b/tests/ui/specs/DatePicker/DatePicker-utils.js
@@ -4,9 +4,9 @@
const daysInMonth = ({month, year}) => new Date(year, month, 0).getDate();
const extractValues = (picker) => {
- const day = parseInt(picker.active(picker.day).getText());
- const month = parseInt(picker.active(picker.month).getText());
- const year = parseInt(picker.active(picker.year).getText());
+ const day = parseInt(picker.selectedItem(picker.day).getText());
+ const month = parseInt(picker.selectedItem(picker.month).getText());
+ const year = parseInt(picker.selectedItem(picker.year).getText());
return {day, month, year};
};
diff --git a/tests/ui/specs/DatePicker/DatePickerPage.js b/tests/ui/specs/DatePicker/DatePickerPage.js
index aa7ade08b..aaa0ff738 100644
--- a/tests/ui/specs/DatePicker/DatePickerPage.js
+++ b/tests/ui/specs/DatePicker/DatePickerPage.js
@@ -27,15 +27,15 @@ class PickerInterface {
}
decrementer (picker) {
- return element('.internal_Picker_Picker_itemDecrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemDecrement', picker);
}
incrementer (picker) {
- return element('.internal_Picker_Picker_itemIncrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemIncrement', picker);
}
- active (picker) {
- return element('.internal_Picker_Picker_active', picker);
+ selectedItem (picker) {
+ return element('.internal_DrumPicker_DrumPicker_selectedItem', picker);
}
}
diff --git a/tests/ui/specs/DateTimePicker/DateTimePicker-specs.js b/tests/ui/specs/DateTimePicker/DateTimePicker-specs.js
index 890ab7c32..8eab35717 100644
--- a/tests/ui/specs/DateTimePicker/DateTimePicker-specs.js
+++ b/tests/ui/specs/DateTimePicker/DateTimePicker-specs.js
@@ -12,33 +12,17 @@ describe('DateTimePicker', function () {
const dateTimePicker = Page.components.dateTimePickerDefault;
it('should have hour-minute-meridiem-month-day-year order', function () {
- const {meridiem} = extractValues(dateTimePicker);
- if (meridiem === 'AM') {
- Page.spotlightDown();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
- Page.spotlightRight();
- expect(dateTimePicker.incrementer(dateTimePicker.month).isFocused(), 'Month').to.be.true();
- Page.spotlightRight();
- expect(dateTimePicker.incrementer(dateTimePicker.day).isFocused(), 'Day').to.be.true();
- Page.spotlightRight();
- expect(dateTimePicker.incrementer(dateTimePicker.year).isFocused(), 'Year').to.be.true();
- } else {
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
- Page.spotlightRight();
- expect(dateTimePicker.decrementer(dateTimePicker.month).isFocused(), 'Month').to.be.true();
- Page.spotlightRight();
- expect(dateTimePicker.decrementer(dateTimePicker.day).isFocused(), 'Day').to.be.true();
- Page.spotlightRight();
- expect(dateTimePicker.decrementer(dateTimePicker.year).isFocused(), 'Year').to.be.true();
- }
+ browser.waitUntil(() => dateTimePicker.hour.isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
+ Page.spotlightRight();
+ browser.waitUntil(() => dateTimePicker.minute.isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
+ Page.spotlightRight();
+ browser.waitUntil(() => dateTimePicker.meridiem.isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
+ Page.spotlightRight();
+ expect(dateTimePicker.month.isFocused(), 'Month').to.be.true();
+ Page.spotlightRight();
+ expect(dateTimePicker.day.isFocused(), 'Day').to.be.true();
+ Page.spotlightRight();
+ expect(dateTimePicker.year.isFocused(), 'Year').to.be.true();
});
describe('pointer', function () {
@@ -61,7 +45,7 @@ describe('DateTimePicker', function () {
it('should increase the minute when incrementing the picker', function () {
const {minute} = extractValues(dateTimePicker);
dateTimePicker.incrementer(dateTimePicker.minute).click();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => dateTimePicker.minute.isFocused(), {timeout: 1500, interval: 100});
const {minute: value} = extractValues(dateTimePicker);
const expected = minute !== 59 ? minute + 1 : 0;
expect(value).to.equal(expected);
@@ -70,7 +54,7 @@ describe('DateTimePicker', function () {
it('should decrease the minute when decrementing the picker', function () {
const {minute} = extractValues(dateTimePicker);
dateTimePicker.decrementer(dateTimePicker.minute).click();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => dateTimePicker.minute.isFocused(), {timeout: 1500, interval: 100});
const {minute: value} = extractValues(dateTimePicker);
const expected = minute !== 0 ? minute - 1 : 59;
expect(value).to.equal(expected);
@@ -97,7 +81,7 @@ describe('DateTimePicker', function () {
it('should increase the month when incrementing the picker', function () {
const {month} = extractValues(dateTimePicker);
dateTimePicker.incrementer(dateTimePicker.month).click();
- expect(dateTimePicker.incrementer(dateTimePicker.month).isFocused()).to.be.true();
+ expect(dateTimePicker.month.isFocused()).to.be.true();
const {month: value} = extractValues(dateTimePicker);
const expected = month < 12 ? month + 1 : 1;
expect(value).to.equal(expected);
@@ -106,7 +90,7 @@ describe('DateTimePicker', function () {
it('should decrease the month when decrementing the picker', function () {
const {month} = extractValues(dateTimePicker);
dateTimePicker.decrementer(dateTimePicker.month).click();
- expect(dateTimePicker.decrementer(dateTimePicker.month).isFocused()).to.be.true();
+ expect(dateTimePicker.month.isFocused()).to.be.true();
const {month: value} = extractValues(dateTimePicker);
const expected = month > 1 ? month - 1 : 12;
expect(value).to.equal(expected);
@@ -116,7 +100,7 @@ describe('DateTimePicker', function () {
const {day, month, year} = extractValues(dateTimePicker);
const numDays = daysInMonth({month, year});
dateTimePicker.incrementer(dateTimePicker.day).click();
- expect(dateTimePicker.incrementer(dateTimePicker.day).isFocused()).to.be.true();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
const {day: value} = extractValues(dateTimePicker);
const expected = day !== numDays ? day + 1 : 1;
expect(value).to.equal(expected);
@@ -126,7 +110,7 @@ describe('DateTimePicker', function () {
const {day, month, year} = extractValues(dateTimePicker);
const numDays = daysInMonth({month, year});
dateTimePicker.decrementer(dateTimePicker.day).click();
- expect(dateTimePicker.decrementer(dateTimePicker.day).isFocused()).to.be.true();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
const {day: value} = extractValues(dateTimePicker);
const expected = day !== 1 ? day - 1 : numDays;
expect(value).to.equal(expected);
@@ -135,7 +119,7 @@ describe('DateTimePicker', function () {
it('should increase the year when incrementing the picker', function () {
const {year} = extractValues(dateTimePicker);
dateTimePicker.incrementer(dateTimePicker.year).click();
- expect(dateTimePicker.incrementer(dateTimePicker.year).isFocused()).to.be.true();
+ expect(dateTimePicker.year.isFocused()).to.be.true();
const {year: value} = extractValues(dateTimePicker);
const expected = year + 1;
expect(value).to.equal(expected);
@@ -144,7 +128,7 @@ describe('DateTimePicker', function () {
it('should decrease the year when decrementing the picker', function () {
const {year} = extractValues(dateTimePicker);
dateTimePicker.decrementer(dateTimePicker.year).click();
- expect(dateTimePicker.decrementer(dateTimePicker.year).isFocused()).to.be.true();
+ expect(dateTimePicker.year.isFocused()).to.be.true();
const {year: value} = extractValues(dateTimePicker);
const expected = year - 1;
expect(value).to.equal(expected);
@@ -159,7 +143,7 @@ describe('DateTimePicker', function () {
describe('5-way', function () {
it('should not update on select', function () {
dateTimePicker.focus();
- Page.spotlightSelect();
+ Page.spotlightDown();
const {day, hour, minute, meridiem, month, year} = extractValues(dateTimePicker);
@@ -173,30 +157,33 @@ describe('DateTimePicker', function () {
});
});
-
describe('disabled', function () {
const dateTimePicker = Page.components.dateTimePickerDisabled;
it('should not increase the day when incrementing disabled picker', function () {
- dateTimePicker.incrementer(dateTimePicker.day).click();
- expect(dateTimePicker.incrementer(dateTimePicker.day).isFocused()).to.be.true();
+ dateTimePicker.day.click();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
+ Page.spotlightDown();
+
browser.pause(500);
const {day: value} = extractValues(dateTimePicker);
expect(value).to.equal(1);
});
it('should not decrease the day when decrementing disabled picker', function () {
- dateTimePicker.decrementer(dateTimePicker.day).click();
- expect(dateTimePicker.decrementer(dateTimePicker.day).isFocused()).to.be.true();
+ dateTimePicker.day.click();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
+ Page.spotlightUp();
browser.pause(500);
const {day: value} = extractValues(dateTimePicker);
expect(value).to.equal(1);
});
- it('should not update hour on click', function () {
+ it('should not update hour when decrementing disabled picker', function () {
const {hour} = extractValues(dateTimePicker);
- dateTimePicker.decrementer(dateTimePicker.hour).click();
- expect(dateTimePicker.decrementer(dateTimePicker.hour).isFocused()).to.be.true();
+ dateTimePicker.hour.click();
+ expect(dateTimePicker.hour.isFocused()).to.be.true();
+ Page.spotlightUp();
browser.pause(500);
const {hour: value} = extractValues(dateTimePicker);
expect(value).to.equal(hour);
@@ -218,29 +205,34 @@ describe('DateTimePicker', function () {
});
- it('should not update \'defaultValue\' on on click', function () {
+ it('should not update \'defaultValue\' on decrement', function () {
const {day, hour, meridiem, minute, month, year} = extractValues(dateTimePicker);
- dateTimePicker.decrementer(dateTimePicker.month).click();
- expect(dateTimePicker.decrementer(dateTimePicker.month).isFocused()).to.be.true();
+ dateTimePicker.month.click();
+ expect(dateTimePicker.month.isFocused()).to.be.true();
+ Page.spotlightUp();
- dateTimePicker.decrementer(dateTimePicker.day).click();
- expect(dateTimePicker.decrementer(dateTimePicker.day).isFocused()).to.be.true();
+ dateTimePicker.day.click();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
+ Page.spotlightUp();
- dateTimePicker.decrementer(dateTimePicker.year).click();
- expect(dateTimePicker.decrementer(dateTimePicker.year).isFocused()).to.be.true();
+ dateTimePicker.year.click();
+ expect(dateTimePicker.year.isFocused()).to.be.true();
+ Page.spotlightUp();
- dateTimePicker.decrementer(dateTimePicker.minute).click();
- expect(dateTimePicker.decrementer(dateTimePicker.minute).isFocused()).to.be.true();
+ dateTimePicker.minute.click();
+ expect(dateTimePicker.minute.isFocused()).to.be.true();
+ Page.spotlightUp();
- dateTimePicker.decrementer(dateTimePicker.hour).click();
- expect(dateTimePicker.decrementer(dateTimePicker.hour).isFocused()).to.be.true();
+ dateTimePicker.hour.click();
+ expect(dateTimePicker.hour.isFocused()).to.be.true();
+ Page.spotlightUp();
+ dateTimePicker.meridiem.click();
+ expect(dateTimePicker.meridiem.isFocused()).to.be.true();
if (meridiem === 'AM') {
- dateTimePicker.incrementer(dateTimePicker.meridiem).click();
- expect(dateTimePicker.incrementer(dateTimePicker.meridiem).isFocused()).to.be.true();
+ Page.spotlightDown();
} else {
- dateTimePicker.decrementer(dateTimePicker.meridiem).click();
- expect(dateTimePicker.decrementer(dateTimePicker.meridiem).isFocused()).to.be.true();
+ Page.spotlightUp();
}
browser.pause(500);
@@ -263,41 +255,23 @@ describe('DateTimePicker', function () {
});
it('should focus hour picker when selected', function () {
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, interval: 100});
+ expect(dateTimePicker.hour.isFocused()).to.be.true();
});
it('should have minute-hour-meridiem-day-month-year order', function () {
- const {meridiem} = extractValues(dateTimePicker);
- if (meridiem === 'ص') {
- Page.spotlightDown();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'initial', interval: 100});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => dateTimePicker.incrementer(dateTimePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem', interval: 100});
- Page.spotlightLeft();
- expect(dateTimePicker.incrementer(dateTimePicker.day).isFocused()).to.be.true();
- Page.spotlightLeft();
- expect(dateTimePicker.incrementer(dateTimePicker.month).isFocused()).to.be.true();
- Page.spotlightLeft();
- expect(dateTimePicker.incrementer(dateTimePicker.year).isFocused()).to.be.true();
- } else {
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'initial', interval: 100});
- Page.spotlightRight();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => dateTimePicker.decrementer(dateTimePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem', interval: 100});
- Page.spotlightLeft();
- expect(dateTimePicker.decrementer(dateTimePicker.day).isFocused()).to.be.true();
- Page.spotlightLeft();
- expect(dateTimePicker.decrementer(dateTimePicker.month).isFocused()).to.be.true();
- Page.spotlightLeft();
- expect(dateTimePicker.decrementer(dateTimePicker.year).isFocused()).to.be.true();
- }
+ browser.waitUntil(() => dateTimePicker.hour.isFocused(), {timeout: 1500, timeoutMsg: 'initial', interval: 100});
+ Page.spotlightRight();
+ browser.waitUntil(() => dateTimePicker.minute.isFocused(), {timeout: 1500, timeoutMsg: 'minute', interval: 100});
+ Page.spotlightLeft();
+ browser.waitUntil(() => dateTimePicker.hour.isFocused(), {timeout: 1500, timeoutMsg: 'hour', interval: 100});
+ Page.spotlightLeft();
+ browser.waitUntil(() => dateTimePicker.meridiem.isFocused(), {timeout: 1500, timeoutMsg: 'meridiem', interval: 100});
+ Page.spotlightLeft();
+ expect(dateTimePicker.day.isFocused()).to.be.true();
+ Page.spotlightLeft();
+ expect(dateTimePicker.month.isFocused()).to.be.true();
+ Page.spotlightLeft();
+ expect(dateTimePicker.year.isFocused()).to.be.true();
});
});
@@ -313,28 +287,33 @@ describe('DateTimePicker', function () {
});
it('should display hours in 24-hour format', function () {
- dateTimePicker.incrementer(dateTimePicker.hour).click();
+ dateTimePicker.hour.click();
+ Page.spotlightDown();
expect(extractValues(dateTimePicker).hour).to.equal(13);
});
it('should increment hours from 23 to 0', function () {
+ dateTimePicker.hour.click();
// go to 23 first
for (let i = 11; i; i -= 1) {
- dateTimePicker.incrementer(dateTimePicker.hour).click();
+ Page.spotlightDown();
}
+ browser.pause(1000);
expect(extractValues(dateTimePicker).hour).to.equal(23);
// now increment
- dateTimePicker.incrementer(dateTimePicker.hour).click();
+ Page.spotlightDown();
expect(extractValues(dateTimePicker).hour).to.equal(0);
+
});
it('should decrement hours from 0 to 23', function () {
+ dateTimePicker.hour.click();
// go to 0 first
for (let i = 12; i; i -= 1) {
- dateTimePicker.decrementer(dateTimePicker.hour).click();
+ Page.spotlightUp();
}
expect(extractValues(dateTimePicker).hour).to.equal(0);
- dateTimePicker.decrementer(dateTimePicker.hour).click();
+ Page.spotlightUp();
expect(extractValues(dateTimePicker).hour).to.equal(23);
});
});
diff --git a/tests/ui/specs/DateTimePicker/DateTimePicker-utils.js b/tests/ui/specs/DateTimePicker/DateTimePicker-utils.js
index 895033402..cd876a643 100644
--- a/tests/ui/specs/DateTimePicker/DateTimePicker-utils.js
+++ b/tests/ui/specs/DateTimePicker/DateTimePicker-utils.js
@@ -4,12 +4,12 @@
const daysInMonth = ({month, year}) => new Date(year, month, 0).getDate();
const extractValues = (picker) => {
- const day = parseInt(picker.active(picker.day).getText());
- const month = parseInt(picker.active(picker.month).getText());
- const year = parseInt(picker.active(picker.year).getText());
- const hour = parseInt(picker.active(picker.hour).getText());
- const minute = parseInt(picker.active(picker.minute).getText());
- const meridiem = picker.meridiem.isExisting() ? picker.active(picker.meridiem).getText() : null;
+ const day = parseInt(picker.selectedItem(picker.day).getText());
+ const month = parseInt(picker.selectedItem(picker.month).getText());
+ const year = parseInt(picker.selectedItem(picker.year).getText());
+ const hour = parseInt(picker.selectedItem(picker.hour).getText());
+ const minute = parseInt(picker.selectedItem(picker.minute).getText());
+ const meridiem = picker.meridiem.isExisting() ? picker.selectedItem(picker.meridiem).getText() : null;
return {day, month, year, hour, minute, meridiem};
};
diff --git a/tests/ui/specs/DateTimePicker/DateTimePickerPage.js b/tests/ui/specs/DateTimePicker/DateTimePickerPage.js
index 2dadce9d9..cb35765ef 100644
--- a/tests/ui/specs/DateTimePicker/DateTimePickerPage.js
+++ b/tests/ui/specs/DateTimePicker/DateTimePickerPage.js
@@ -37,15 +37,15 @@ class DateTimePickerInterface {
}
decrementer (picker) {
- return element('.internal_Picker_Picker_itemDecrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemDecrement', picker);
}
incrementer (picker) {
- return element('.internal_Picker_Picker_itemIncrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemIncrement', picker);
}
- active (picker) {
- return element('.internal_Picker_Picker_active', picker);
+ selectedItem (picker) {
+ return element('.internal_DrumPicker_DrumPicker_selectedItem', picker);
}
}
diff --git a/tests/ui/specs/Picker/Picker-specs.js b/tests/ui/specs/Picker/Picker-specs.js
index 386ca22e4..894e4f871 100644
--- a/tests/ui/specs/Picker/Picker-specs.js
+++ b/tests/ui/specs/Picker/Picker-specs.js
@@ -13,19 +13,16 @@ describe('Picker', function () {
describe('5-way', function () {
it('should change the value forward when incrementing the picker', function () {
- expect(picker.incrementer(picker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(picker.self.isFocused()).to.be.true();
+ Page.spotlightDown();
browser.pause(500);
const newValue = extractValue(picker);
expect(newValue).to.equal('Banana');
});
it('should change the value backward when decrementing the picker', function () {
- expect(picker.incrementer(picker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(picker.self.isFocused()).to.be.true();
Page.spotlightUp();
- expect(picker.decrementer(picker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
browser.pause(500);
const newValue = extractValue(picker);
expect(newValue).to.equal('Apple');
@@ -35,15 +32,18 @@ describe('Picker', function () {
describe('pointer', function () {
it('should increase the value when incrementing the picker', function () {
picker.incrementer(picker.self).click();
+ expect(picker.self.isFocused()).to.be.true();
browser.pause(500);
const newValue = extractValue(picker);
expect(newValue).to.equal('Banana');
});
it('should decrease the value when decrementing the picker', function () {
+ // first increment to second option the decrement back to first option
picker.incrementer(picker.self).click();
- expect(picker.incrementer(picker.self).isFocused()).to.be.true();
picker.decrementer(picker.self).click();
+ expect(picker.self.isFocused()).to.be.true();
+ picker.self.click();
browser.pause(500);
const newValue = extractValue(picker);
expect(newValue).to.equal('Apple');
@@ -65,9 +65,20 @@ describe('Picker', function () {
const picker = Page.components.pickerDisabled;
describe('5-way', function () {
- it('should not update on select', function () {
+ it('should not update when incrementing the picker', function () {
const oldValue = extractValue(picker);
- Page.spotlightSelect();
+ Page.spotlightLeft();
+ Page.spotlightDown();
+ picker.focus();
+ browser.pause(500);
+ const newValue = extractValue(picker);
+ expect(newValue).to.equal(oldValue);
+ });
+
+ it('should not update when decrementing the picker', function () {
+ const oldValue = extractValue(picker);
+ Page.spotlightLeft();
+ Page.spotlightUp();
picker.focus();
browser.pause(500);
const newValue = extractValue(picker);
diff --git a/tests/ui/specs/Picker/Picker-utils.js b/tests/ui/specs/Picker/Picker-utils.js
index b322c6ac9..72a2beebe 100644
--- a/tests/ui/specs/Picker/Picker-utils.js
+++ b/tests/ui/specs/Picker/Picker-utils.js
@@ -1,7 +1,7 @@
// Utility methods for testing
const extractValue = (picker) => {
- return picker.active(picker.self).getText();
+ return picker.selectedItem(picker.self).getText();
};
module.exports = {
diff --git a/tests/ui/specs/Picker/PickerPage.js b/tests/ui/specs/Picker/PickerPage.js
index 3806244c8..7556b6b3e 100644
--- a/tests/ui/specs/Picker/PickerPage.js
+++ b/tests/ui/specs/Picker/PickerPage.js
@@ -3,32 +3,33 @@ const {Page} = require('@enact/ui-test-utils/utils');
const {element} = require('@enact/ui-test-utils/utils');
class PickerInterface {
- constructor (id) {
- this.id = id;
+ constructor (className) {
+ this.className = className;
+ this.selector = `.${this.className}`;
}
focus () {
- return browser.execute((el) => el.focus(), $(`#${this.id}>div`));
+ return browser.execute((el) => el.focus(), $(`.${this.className}>div`));
}
get self () {
- return $(`#${this.id}`, browser);
+ return $(this.selector);
}
get picker () {
- return element('.internal_Picker_Picker_picker', this.self);
+ return element('.internal_DrumPicker_DrumPicker_drumPicker', this.self);
}
decrementer (picker) {
- return element('.internal_Picker_Picker_itemDecrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemDecrement', picker);
}
incrementer (picker) {
- return element('.internal_Picker_Picker_itemIncrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemIncrement', picker);
}
- active (picker) {
- return element('.internal_Picker_Picker_active', picker);
+ selectedItem (picker) {
+ return element('.internal_DrumPicker_DrumPicker_selectedItem', picker);
}
}
diff --git a/tests/ui/specs/RangePicker/RangePicker-specs.js b/tests/ui/specs/RangePicker/RangePicker-specs.js
index 106995b78..21eef4e6b 100644
--- a/tests/ui/specs/RangePicker/RangePicker-specs.js
+++ b/tests/ui/specs/RangePicker/RangePicker-specs.js
@@ -13,19 +13,16 @@ describe('RangePicker', function () {
describe('5-way', function () {
it('should change the value forward when incrementing the rangePicker', function () {
- expect(rangePicker.incrementer(rangePicker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(rangePicker.self.isFocused()).to.be.true();
+ Page.spotlightDown();
browser.pause(500);
const newValue = extractValue(rangePicker);
- expect(newValue).to.equal(5);
+ expect(newValue).to.equal(10);
});
it('should change the value backward when decrementing the rangePicker', function () {
- expect(rangePicker.incrementer(rangePicker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
+ expect(rangePicker.self.isFocused()).to.be.true();
Page.spotlightUp();
- expect(rangePicker.decrementer(rangePicker.self).isFocused()).to.be.true();
- Page.spotlightSelect();
browser.pause(500);
const newValue = extractValue(rangePicker);
expect(newValue).to.equal(0);
@@ -35,15 +32,15 @@ describe('RangePicker', function () {
describe('pointer', function () {
it('should increase the value when incrementing the rangePicker', function () {
rangePicker.incrementer(rangePicker.self).click();
+ expect(rangePicker.self.isFocused()).to.be.true();
browser.pause(500);
const newValue = extractValue(rangePicker);
- expect(newValue).to.equal(5);
+ expect(newValue).to.equal(10);
});
it('should decrease the value when decrementing the rangePicker', function () {
- rangePicker.incrementer(rangePicker.self).click();
- expect(rangePicker.incrementer(rangePicker.self).isFocused()).to.be.true();
rangePicker.decrementer(rangePicker.self).click();
+ expect(rangePicker.self.isFocused()).to.be.true();
browser.pause(500);
const newValue = extractValue(rangePicker);
expect(newValue).to.equal(0);
@@ -55,9 +52,20 @@ describe('RangePicker', function () {
const rangePicker = Page.components.rangePickerDisabled;
describe('5-way', function () {
- it('should not update on select', function () {
+ it('should not change the value forward when incrementing the rangePicker', function () {
const oldValue = extractValue(rangePicker);
- Page.spotlightSelect();
+ Page.spotlightLeft();
+ Page.spotlightDown();
+ rangePicker.focus();
+ browser.pause(500);
+ const newValue = extractValue(rangePicker);
+ expect(newValue).to.equal(oldValue);
+ });
+
+ it('should not change the value backward when decrementing the rangePicker', function () {
+ const oldValue = extractValue(rangePicker);
+ Page.spotlightLeft();
+ Page.spotlightUp();
rangePicker.focus();
browser.pause(500);
const newValue = extractValue(rangePicker);
@@ -93,7 +101,10 @@ describe('RangePicker', function () {
});
it('should decrement to negative number', function () {
- rangePicker.decrementer(rangePicker.self).click();
+ Page.spotlightRight();
+ Page.spotlightRight();
+ expect(rangePicker.self.isFocused()).to.be.true();
+ Page.spotlightUp();
browser.pause(500);
const newValue = extractValue(rangePicker);
expect(newValue).to.equal(-1);
diff --git a/tests/ui/specs/RangePicker/RangePicker-utils.js b/tests/ui/specs/RangePicker/RangePicker-utils.js
index 8d24937fd..08f3426f2 100644
--- a/tests/ui/specs/RangePicker/RangePicker-utils.js
+++ b/tests/ui/specs/RangePicker/RangePicker-utils.js
@@ -1,7 +1,7 @@
// Utility methods for testing
const extractValue = (rangePicker) => {
- return parseInt(rangePicker.active(rangePicker.self).getText());
+ return parseInt(rangePicker.selectedItem(rangePicker.self).getText());
};
module.exports = {
diff --git a/tests/ui/specs/RangePicker/RangePickerPage.js b/tests/ui/specs/RangePicker/RangePickerPage.js
index 0e4630eb6..74cd375ce 100644
--- a/tests/ui/specs/RangePicker/RangePickerPage.js
+++ b/tests/ui/specs/RangePicker/RangePickerPage.js
@@ -3,32 +3,33 @@ const {Page} = require('@enact/ui-test-utils/utils');
const {element} = require('@enact/ui-test-utils/utils');
class RangePickerInterface {
- constructor (id) {
- this.id = id;
+ constructor (className) {
+ this.className = className;
+ this.selector = `.${this.className}`;
}
focus () {
- return browser.execute((el) => el.focus(), $(`#${this.id}>div`));
+ return browser.execute((el) => el.focus(), $(`.${this.className}>div`));
}
get self () {
- return $(`#${this.id}`, browser);
+ return $(this.selector);
}
get rangePicker () {
- return element('.internal_Picker_Picker_picker', this.self);
+ return element('.internal_DrumPicker_DrumPicker_drumPicker', this.self);
}
decrementer (rangePicker) {
- return element('.internal_Picker_Picker_itemDecrement', rangePicker);
+ return element('.internal_DrumPicker_DrumPicker_itemDecrement', rangePicker);
}
incrementer (rangePicker) {
- return element('.internal_Picker_Picker_itemIncrement', rangePicker);
+ return element('.internal_DrumPicker_DrumPicker_itemIncrement', rangePicker);
}
- active (rangePicker) {
- return element('.internal_Picker_Picker_active', rangePicker);
+ selectedItem (rangePicker) {
+ return element('.internal_DrumPicker_DrumPicker_selectedItem', rangePicker);
}
}
diff --git a/tests/ui/specs/TimePicker/TimePicker-specs.js b/tests/ui/specs/TimePicker/TimePicker-specs.js
index 91c1dec87..16589b860 100644
--- a/tests/ui/specs/TimePicker/TimePicker-specs.js
+++ b/tests/ui/specs/TimePicker/TimePicker-specs.js
@@ -12,28 +12,17 @@ describe('TimePicker', function () {
const timePicker = Page.components.timePickerDefault;
it('should have hour-minute-meridiem order', function () {
- const {meridiem} = extractValues(timePicker);
- if (meridiem === 'AM') {
- Page.spotlightDown();
- browser.waitUntil(() => timePicker.incrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.incrementer(timePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.incrementer(timePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
- } else {
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
- }
+ browser.waitUntil(() => timePicker.hour.isFocused(), {timeout: 1500, timeoutMsg: 'hour focused'});
+ Page.spotlightRight();
+ browser.waitUntil(() => timePicker.minute.isFocused(), {timeout: 1500, timeoutMsg: 'minute focused'});
+ Page.spotlightRight();
+ browser.waitUntil(() => timePicker.meridiem.isFocused(), {timeout: 1500, timeoutMsg: 'meridiem focused'});
});
describe('5-way', function () {
it('should decrease the hour when decrementing the picker', function () {
const {hour} = extractValues(timePicker);
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
- Page.spotlightSelect();
+ Page.spotlightUp();
const {hour: value} = extractValues(timePicker);
const expected = hour > 1 ? hour - 1 : 12;
expect(value).to.equal(expected);
@@ -42,8 +31,7 @@ describe('TimePicker', function () {
it('should increase the hour when incrementing the picker', function () {
const {hour} = extractValues(timePicker);
Page.spotlightDown();
- browser.waitUntil(() => timePicker.incrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
- Page.spotlightSelect();
+ browser.pause(500);
const {hour: value} = extractValues(timePicker);
const expected = hour < 12 ? hour + 1 : 1;
expect(value).to.equal(expected);
@@ -52,8 +40,9 @@ describe('TimePicker', function () {
it('should decrease the minute when decrementing the picker', function () {
const {minute} = extractValues(timePicker);
Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.minute).isFocused(), {timeout: 1500, interval: 100});
- Page.spotlightSelect();
+ browser.waitUntil(() => timePicker.minute.isFocused(), {timeout: 1500, interval: 100});
+ Page.spotlightUp();
+ browser.pause(500);
const {minute: value} = extractValues(timePicker);
const expected = minute !== 0 ? minute - 1 : 59;
expect(value).to.equal(expected);
@@ -62,10 +51,9 @@ describe('TimePicker', function () {
it('should increase the minute when incrementing the picker', function () {
const {minute} = extractValues(timePicker);
Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.minute).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => timePicker.minute.isFocused(), {timeout: 1500, interval: 100});
Page.spotlightDown();
- browser.waitUntil(() => timePicker.incrementer(timePicker.minute).isFocused(), {timeout: 1500, interval: 100});
- Page.spotlightSelect();
+ browser.pause(500);
const {minute: value} = extractValues(timePicker);
const expected = minute !== 59 ? minute + 1 : 0;
expect(value).to.equal(expected);
@@ -73,35 +61,33 @@ describe('TimePicker', function () {
it('should not change displayed hour when changing the meridiem picker', function () {
const {hour, meridiem} = extractValues(timePicker);
+ Page.spotlightRight();
+ Page.spotlightRight();
+ browser.waitUntil(() => timePicker.meridiem.isFocused(), {timeout: 1500, interval: 100});
if (meridiem === 'AM') {
- // change to PM
Page.spotlightDown();
- Page.spotlightRight();
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.incrementer(timePicker.meridiem).isFocused(), {timeout: 1500, interval: 100});
} else {
- // change to AM
- Page.spotlightRight();
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.meridiem).isFocused(), {timeout: 1500, interval: 100});
+ Page.spotlightUp();
}
- Page.spotlightSelect();
-
+ browser.pause(500);
const {hour: value} = extractValues(timePicker);
expect(value).to.equal(hour);
});
it('should change the meridiem on hour boundaries', function () {
const {meridiem} = extractValues(timePicker);
+ Page.spotlightDown();
+ browser.waitUntil(() => timePicker.hour.isFocused(), {timeout: 1500, interval: 100});
if (meridiem === 'AM') {
- Page.spotlightDown();
- browser.waitUntil(() => timePicker.incrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
+ for (let i = 12; i; i -= 1) {
+ // 12 hours ought to change the value text if meridiem changes
+ Page.spotlightDown();
+ }
} else {
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
- }
- // 12 hours ought to change the value text if meridiem changes
- for (let i = 12; i; i -= 1) {
- Page.spotlightSelect();
+ for (let i = 12; i; i -= 1) {
+ // 12 hours ought to change the value text if meridiem changes
+ Page.spotlightUp();
+ }
}
const {meridiem: value} = extractValues(timePicker);
@@ -112,7 +98,7 @@ describe('TimePicker', function () {
describe('pointer', function () {
it('should select hour when opened', function () {
timePicker.decrementer(timePicker.hour).click();
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => timePicker.hour.isFocused(), {timeout: 1500, interval: 100});
});
@@ -135,7 +121,7 @@ describe('TimePicker', function () {
it('should increase the minute when incrementing the picker', function () {
const {minute} = extractValues(timePicker);
timePicker.incrementer(timePicker.minute).click();
- browser.waitUntil(() => timePicker.incrementer(timePicker.minute).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => timePicker.minute.isFocused(), {timeout: 1500, interval: 100});
const {minute: value} = extractValues(timePicker);
const expected = minute !== 59 ? minute + 1 : 0;
expect(value).to.equal(expected);
@@ -144,7 +130,7 @@ describe('TimePicker', function () {
it('should decrease the minute when decrementing the picker', function () {
const {minute} = extractValues(timePicker);
timePicker.decrementer(timePicker.minute).click();
- browser.waitUntil(() => timePicker.decrementer(timePicker.minute).isFocused(), {timeout: 1500, interval: 100});
+ browser.waitUntil(() => timePicker.minute.isFocused(), {timeout: 1500, interval: 100});
const {minute: value} = extractValues(timePicker);
const expected = minute !== 0 ? minute - 1 : 59;
expect(value).to.equal(expected);
@@ -175,9 +161,24 @@ describe('TimePicker', function () {
const timePicker = Page.components.timePickerWithDefaultValue;
describe('5-way', function () {
- it('should not update on select', function () {
+ it('should not update when incrementing the picker', function () {
timePicker.focus();
- Page.spotlightSelect();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightDown();
+
+ const {hour, minute, meridiem} = extractValues(timePicker);
+
+ expect(hour).to.equal(12);
+ expect(minute).to.equal(0);
+ expect(meridiem).to.equal('AM');
+ });
+
+ it('should not update when decrementing the picker', function () {
+ timePicker.focus();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightUp();
const {hour, minute, meridiem} = extractValues(timePicker);
@@ -202,7 +203,7 @@ describe('TimePicker', function () {
it('should not update hour on click', function () {
const {hour} = extractValues(timePicker);
timePicker.decrementer(timePicker.hour).click();
- expect(timePicker.decrementer(timePicker.hour).isFocused()).to.be.true();
+ expect(timePicker.hour.isFocused()).to.be.true();
browser.pause(500);
const {hour: value} = extractValues(timePicker);
expect(value).to.equal(hour);
@@ -212,24 +213,34 @@ describe('TimePicker', function () {
describe('disabled with \'defaultValue\'', function () {
const timePicker = Page.components.timePickerDisabledWithDefaultValue;
- it('should not update \'defaultValue\' on click', function () {
+
+ it('should not update \'defaultValue\' on decrementing disabled picker', function () {
const {hour, minute, meridiem} = extractValues(timePicker);
+ timePicker.focus();
+ Page.spotlightUp();
+ Page.spotlightRight();
+ Page.spotlightUp();
+ Page.spotlightRight();
+ Page.spotlightUp();
- timePicker.decrementer(timePicker.minute).click();
- expect(timePicker.decrementer(timePicker.minute).isFocused()).to.be.true();
+ browser.pause(500);
- timePicker.decrementer(timePicker.hour).click();
- expect(timePicker.decrementer(timePicker.hour).isFocused()).to.be.true();
+ expect(hour).to.equal(12);
+ expect(minute).to.equal(0);
+ expect(meridiem).to.equal('AM');
+ });
- if (meridiem === 'AM') {
- timePicker.incrementer(timePicker.meridiem).click();
- expect(timePicker.incrementer(timePicker.meridiem).isFocused()).to.be.true();
- } else {
- timePicker.decrementer(timePicker.meridiem).click();
- expect(timePicker.decrementer(timePicker.meridiem).isFocused()).to.be.true();
- }
+ it('should not update \'defaultValue\' on incrementing disabled picker', function () {
+ const {hour, minute, meridiem} = extractValues(timePicker);
+ timePicker.focus();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightDown();
+ Page.spotlightRight();
+ Page.spotlightDown();
browser.pause(500);
+
expect(hour).to.equal(12);
expect(minute).to.equal(0);
expect(meridiem).to.equal('AM');
@@ -245,32 +256,16 @@ describe('TimePicker', function () {
Page.open('?locale=ar-SA');
});
- it('should focus middle picker (hour) when selected', function () {
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, interval: 100});
- });
-
it('should have minute-hour-meridiem order', function () {
- const {meridiem} = extractValues(timePicker);
- if (meridiem === 'ص') {
- Page.spotlightDown();
- browser.waitUntil(() => timePicker.incrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'initial', interval: 100});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.incrementer(timePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => timePicker.incrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => timePicker.incrementer(timePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem', interval: 100});
- } else {
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'initial', interval: 100});
- Page.spotlightRight();
- browser.waitUntil(() => timePicker.decrementer(timePicker.minute).isFocused(), {timeout: 1500, timeoutMsg: 'minute', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => timePicker.decrementer(timePicker.hour).isFocused(), {timeout: 1500, timeoutMsg: 'hour', interval: 100});
- Page.spotlightLeft();
- browser.waitUntil(() => timePicker.decrementer(timePicker.meridiem).isFocused(), {timeout: 1500, timeoutMsg: 'meridiem', interval: 100});
- }
-
-
+ timePicker.focus();
+ Page.spotlightRight();
+ Page.spotlightRight();
+
+ expect(timePicker.minute.isFocused()).to.be.true();
+ Page.spotlightLeft();
+ expect(timePicker.hour.isFocused()).to.be.true();
+ Page.spotlightLeft();
+ expect(timePicker.meridiem.isFocused()).to.be.true();
});
});
@@ -290,16 +285,23 @@ describe('TimePicker', function () {
});
it('should increment hours from 23 to 0', function () {
+ Page.spotlightRight();
+ Page.spotlightRight();
// go to 23 first
- timePicker.decrementer(timePicker.hour).click();
+ Page.spotlightUp();
+ browser.pause(1000);
expect(extractValues(timePicker).hour).to.equal(23);
// now increment
- timePicker.incrementer(timePicker.hour).click();
+ Page.spotlightDown();
+ browser.pause(1000);
expect(extractValues(timePicker).hour).to.equal(0);
});
it('should decrement hours from 0 to 23', function () {
- timePicker.decrementer(timePicker.hour).click();
+ Page.spotlightRight();
+ Page.spotlightRight();
+ Page.spotlightUp();
+ browser.pause(1000);
expect(extractValues(timePicker).hour).to.equal(23);
});
});
diff --git a/tests/ui/specs/TimePicker/TimePicker-utils.js b/tests/ui/specs/TimePicker/TimePicker-utils.js
index 9c83354a6..80d64b603 100644
--- a/tests/ui/specs/TimePicker/TimePicker-utils.js
+++ b/tests/ui/specs/TimePicker/TimePicker-utils.js
@@ -1,8 +1,8 @@
// Utility methods for testing
const extractValues = (picker) => {
- const hour = parseInt(picker.active(picker.hour).getText());
- const minute = parseInt(picker.active(picker.minute).getText());
- const meridiem = picker.meridiem.isExisting() ? picker.active(picker.meridiem).getText() : null;
+ const hour = parseInt(picker.selectedItem(picker.hour).getText());
+ const minute = parseInt(picker.selectedItem(picker.minute).getText());
+ const meridiem = picker.meridiem.isExisting() ? picker.selectedItem(picker.meridiem).getText() : null;
return {hour, minute, meridiem};
};
diff --git a/tests/ui/specs/TimePicker/TimePickerPage.js b/tests/ui/specs/TimePicker/TimePickerPage.js
index f368e40cb..1c25024a7 100644
--- a/tests/ui/specs/TimePicker/TimePickerPage.js
+++ b/tests/ui/specs/TimePicker/TimePickerPage.js
@@ -25,13 +25,15 @@ class PickerInterface {
}
decrementer (picker) {
- return element('.internal_Picker_Picker_itemDecrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemDecrement', picker);
}
+
incrementer (picker) {
- return element('.internal_Picker_Picker_itemIncrement', picker);
+ return element('.internal_DrumPicker_DrumPicker_itemIncrement', picker);
}
- active (picker) {
- return element('.internal_Picker_Picker_active', picker);
+
+ selectedItem (picker) {
+ return element('.internal_DrumPicker_DrumPicker_selectedItem', picker);
}
}