You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

82 lines
2.3 KiB

const {
setTimeZoneOffsetInMinutes,
expectDate,
scrollWheel,
expectDateString,
setMaximumDate,
setDate,
init,
} = require('../utils');
const scrollMinuteWheel = () => scrollWheel(2, 1);
// I haven't found a way to change the timezone on the emulator to be able to run these tests.
// Until possible, run these tests locally when needed with Europe/Stockholm timezone.
describe.skip('Timezone offset', () => {
beforeAll(async () => {
await init();
await element(by.text('Advanced')).tap();
});
it('undefined (default)', async () => {
await setTimeZoneOffsetInMinutes(undefined);
await scrollMinuteWheel();
await expectDate('2000-01-01 00:01:00');
await expectDateString('Sat Jan 11201 AM ');
});
it('0', async () => {
await setTimeZoneOffsetInMinutes(0);
await scrollMinuteWheel();
await expectDate('2000-01-01 00:01:00');
await expectDateString('Fri Dec 311101 PM ');
});
it('180', async () => {
await setTimeZoneOffsetInMinutes(180);
await scrollMinuteWheel();
await expectDate('2000-01-01 00:01:00');
await expectDateString('Sat Jan 1201 AM ');
});
it('-180', async () => {
await setTimeZoneOffsetInMinutes(-180);
await scrollMinuteWheel();
await expectDate('2000-01-01 00:01:00');
await expectDateString('Fri Dec 31801 PM ');
});
describe('daylight saving', () => {
const firstOfJuly = new Date(2000, 6, 1, 0, 0);
const firstOfJune = new Date(2000, 5, 1, 0, 0);
beforeAll(async () => {
await setMaximumDate(firstOfJuly);
await setDate(firstOfJune);
});
it('undefined', async () => {
await setDate(firstOfJune);
await setTimeZoneOffsetInMinutes(undefined);
await scrollMinuteWheel();
await expectDate('2000-06-01 00:01:00');
await expectDateString('Thu Jun 11201 AM ');
});
it('0', async () => {
await setDate(firstOfJune);
await setTimeZoneOffsetInMinutes(0);
await scrollMinuteWheel();
await expectDate('2000-06-01 00:01:00');
await expectDateString('Wed May 311001 PM ');
});
it('180', async () => {
await setDate(firstOfJune);
await setTimeZoneOffsetInMinutes(180);
await scrollMinuteWheel();
await expectDate('2000-06-01 00:01:00');
await expectDateString('Thu Jun 1101 AM ');
});
});
});