From 1ab915226321640cbd5011e69fa3bc26c47f890b Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Tue, 19 Dec 2023 10:21:44 +0100 Subject: [PATCH] chore: move tests to maestro (minimumDate) (#742) --- .maestro/maximum-date.yml | 26 +--- .maestro/minimum-date.yml | 78 ++++++++++++ .maestro/utils/change-mode-date.yml | 6 + .maestro/utils/change-mode-datetime.yml | 6 + .maestro/utils/change-mode-time.yml | 6 + .maestro/utils/swipe-wheel-1-down.yml | 5 + .maestro/utils/swipe-wheel-1-up.yml | 5 + .maestro/utils/swipe-wheel-1.yml | 11 +- .maestro/utils/swipe-wheel-2-up.yml | 5 + .maestro/utils/swipe-wheel-3-up.yml | 5 + examples/detox/e2e/tests/minimumDate.spec.js | 123 ------------------- 11 files changed, 130 insertions(+), 146 deletions(-) create mode 100644 .maestro/minimum-date.yml create mode 100644 .maestro/utils/change-mode-date.yml create mode 100644 .maestro/utils/change-mode-datetime.yml create mode 100644 .maestro/utils/change-mode-time.yml create mode 100644 .maestro/utils/swipe-wheel-1-down.yml create mode 100644 .maestro/utils/swipe-wheel-1-up.yml create mode 100644 .maestro/utils/swipe-wheel-2-up.yml create mode 100644 .maestro/utils/swipe-wheel-3-up.yml delete mode 100644 examples/detox/e2e/tests/minimumDate.spec.js diff --git a/.maestro/maximum-date.yml b/.maestro/maximum-date.yml index 1eaab4d..ac81335 100644 --- a/.maestro/maximum-date.yml +++ b/.maestro/maximum-date.yml @@ -14,10 +14,7 @@ tags: ### test: datetime mode -- runFlow: - file: utils/change-mode.yml - env: - VALUE: datetime +- runFlow: utils/change-mode-datetime.yml - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-01 00:00:00' @@ -30,10 +27,7 @@ tags: ### test: date mode -- runFlow: - file: utils/change-mode.yml - env: - VALUE: date +- runFlow: utils/change-mode-date.yml - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-01 00:00:00' @@ -46,10 +40,7 @@ tags: ### test: time mode -- runFlow: - file: utils/change-mode.yml - env: - VALUE: time +- runFlow: utils/change-mode-time.yml - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-01 00:00:00' @@ -72,10 +63,7 @@ tags: - assertVisible: '2000-01-02 00:00:00' ### test: overshooting month wheel should set other wheels to max date -- runFlow: - file: utils/change-mode.yml - env: - VALUE: date +- runFlow: utils/change-mode-date.yml - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-02 00:00:00' @@ -98,10 +86,8 @@ tags: file: utils/change-maximum-date.yml env: VALUE: '2000-01-01 00:00:00' -- runFlow: - file: utils/change-mode.yml - env: - VALUE: time + +- runFlow: utils/change-mode-time.yml - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-01 00:00:00' diff --git a/.maestro/minimum-date.yml b/.maestro/minimum-date.yml new file mode 100644 index 0000000..284c591 --- /dev/null +++ b/.maestro/minimum-date.yml @@ -0,0 +1,78 @@ +appId: com.rn071 +tags: + - android + - minimumDate +--- +- runFlow: utils/launch.yml + +########## describe: cannot pass min date + +- runFlow: + file: utils/change-minimum-date.yml + env: + VALUE: '2000-01-01 23:59:00' + +- runFlow: + file: utils/change-prop.yml + env: + PROP: date + VALUE: '2000-01-01 23:59:00' + +# ### test: datetime mode + +- runFlow: utils/swipe-wheel-1-up.yml +- assertVisible: '2000-01-01 23:59:00' + +- runFlow: utils/swipe-wheel-2-up.yml +- assertVisible: '2000-01-01 23:59:00' + +- runFlow: utils/swipe-wheel-3-up.yml +- assertVisible: '2000-01-01 23:59:00' + +### test: date mode + +- runFlow: utils/change-mode-date.yml + +- runFlow: + file: utils/change-prop.yml + env: + PROP: date + VALUE: '2000-01-01 23:59:00' +- runFlow: utils/swipe-wheel-1-up.yml +- assertVisible: '2000-01-06 00:00:00' + +- runFlow: + file: utils/change-prop.yml + env: + PROP: date + VALUE: '2000-01-01 23:59:00' +- runFlow: utils/swipe-wheel-2-up.yml +- assertVisible: '2000-01-06 00:00:00' + +- runFlow: + file: utils/change-prop.yml + env: + PROP: date + VALUE: '2000-01-01 23:59:00' +- runFlow: utils/swipe-wheel-3-up.yml +- assertVisible: '2000-01-01 23:59:00' + +########## describe: overshooting min date + +- runFlow: utils/reset.yml +- runFlow: utils/change-mode-time.yml +- runFlow: + file: utils/change-minimum-date.yml + env: + VALUE: '2000-01-01 23:59:00' + +### test: overshooting in time mode should set other wheels to max date + +- runFlow: utils/swipe-wheel-1-up.yml +- assertVisible: '2000-01-01 23:59:00' + +- runFlow: utils/swipe-wheel-2-up.yml +- assertVisible: '2000-01-01 23:59:00' + +- runFlow: utils/swipe-wheel-3-up.yml +- assertVisible: '2000-01-01 23:59:00' diff --git a/.maestro/utils/change-mode-date.yml b/.maestro/utils/change-mode-date.yml new file mode 100644 index 0000000..7425714 --- /dev/null +++ b/.maestro/utils/change-mode-date.yml @@ -0,0 +1,6 @@ +appId: com.rn071 +--- +- runFlow: + file: change-mode.yml + env: + VALUE: date diff --git a/.maestro/utils/change-mode-datetime.yml b/.maestro/utils/change-mode-datetime.yml new file mode 100644 index 0000000..44dfa53 --- /dev/null +++ b/.maestro/utils/change-mode-datetime.yml @@ -0,0 +1,6 @@ +appId: com.rn071 +--- +- runFlow: + file: change-mode.yml + env: + VALUE: datetime diff --git a/.maestro/utils/change-mode-time.yml b/.maestro/utils/change-mode-time.yml new file mode 100644 index 0000000..eb2cd0e --- /dev/null +++ b/.maestro/utils/change-mode-time.yml @@ -0,0 +1,6 @@ +appId: com.rn071 +--- +- runFlow: + file: change-mode.yml + env: + VALUE: time diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml new file mode 100644 index 0000000..d98a596 --- /dev/null +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -0,0 +1,5 @@ +appId: com.rn071 +--- +- swipe: + start: 25%, 40% + end: 25%, 35% diff --git a/.maestro/utils/swipe-wheel-1-up.yml b/.maestro/utils/swipe-wheel-1-up.yml new file mode 100644 index 0000000..2e83baf --- /dev/null +++ b/.maestro/utils/swipe-wheel-1-up.yml @@ -0,0 +1,5 @@ +appId: com.rn071 +--- +- swipe: + start: 38%, 30% + end: 38%, 35% diff --git a/.maestro/utils/swipe-wheel-1.yml b/.maestro/utils/swipe-wheel-1.yml index d98a596..ef2039a 100644 --- a/.maestro/utils/swipe-wheel-1.yml +++ b/.maestro/utils/swipe-wheel-1.yml @@ -1,5 +1,10 @@ appId: com.rn071 --- -- swipe: - start: 25%, 40% - end: 25%, 35% +- runFlow: + when: + true: ${DIRECTION == 'UP'} + file: swipe-wheel-1-up.yml +- runFlow: + when: + true: ${DIRECTION != 'UP'} + file: swipe-wheel-1-down.yml diff --git a/.maestro/utils/swipe-wheel-2-up.yml b/.maestro/utils/swipe-wheel-2-up.yml new file mode 100644 index 0000000..385a07e --- /dev/null +++ b/.maestro/utils/swipe-wheel-2-up.yml @@ -0,0 +1,5 @@ +appId: com.rn071 +--- +- swipe: + start: 50%, 30% + end: 50%, 35% diff --git a/.maestro/utils/swipe-wheel-3-up.yml b/.maestro/utils/swipe-wheel-3-up.yml new file mode 100644 index 0000000..6945d0e --- /dev/null +++ b/.maestro/utils/swipe-wheel-3-up.yml @@ -0,0 +1,5 @@ +appId: com.rn071 +--- +- swipe: + start: 65%, 30% + end: 65%, 35% diff --git a/examples/detox/e2e/tests/minimumDate.spec.js b/examples/detox/e2e/tests/minimumDate.spec.js deleted file mode 100644 index 7a15368..0000000 --- a/examples/detox/e2e/tests/minimumDate.spec.js +++ /dev/null @@ -1,123 +0,0 @@ -const { - setDate, - scrollWheel, - expectDate, - setMinimumDate, - setMode, -} = require('../utils') - -const oneMinuteBeforeJanuary2 = new Date(2000, 0, 1, 23, 59, 0) - -describe('Minimum date', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - beforeEach(async () => { - await setDate(oneMinuteBeforeJanuary2.toISOString()) - }) - - describe('cannot pass min date - mode: ', () => { - describe('datetime', () => { - before(async () => { - await setMode('datetime') - await setMinimumDate(oneMinuteBeforeJanuary2) - }) - - it('day wheel', async () => { - await scrollWheel(0, -2) - await expectDate('2000-01-01 23:59:00') - }) - - it('hour wheel', async () => { - await scrollWheel(1, -1) - await expectDate('2000-01-01 23:59:00') - }) - - it('minute wheel', async () => { - await scrollWheel(2, -1) - await expectDate('2000-01-01 23:59:00') - }) - }) - - describe('date', () => { - before(async () => { - await setMode('date') - await setMinimumDate(oneMinuteBeforeJanuary2) - }) - - it('month wheel', async () => { - await scrollWheel(0, -1) - await expectDate('2000-01-06 00:00:00') - }) - - it('date wheel', async () => { - await scrollWheel(1, -1) - await expectDate('2000-01-06 00:00:00') - }) - - it('year wheel', async () => { - await scrollWheel(2, -1) - await expectDate('2000-01-01 23:59:00') - }) - }) - }) - - describe('overshooting min date - mode:', () => { - before(async () => { - await setMinimumDate(oneMinuteBeforeJanuary2) - }) - - describe('datetime', () => { - before(async () => { - await setMode('datetime') - }) - - it('day wheel should not be possible to overshoot since it is not wrapping (no invalid dates exists)', async () => { - await scrollWheel(0, -1) - await expectDate('2000-01-01 23:59:00') - await scrollWheel(0, -1) - await expectDate('2000-01-01 23:59:00') - }) - }) - - describe('date', () => { - before(async () => { - await setMode('date') - }) - - it('overshooting month wheel should set all other wheels to maximum possible date', async () => { - await scrollWheel(0, -1) - await expectDate('2000-01-06 00:00:00') - }) - - it('overshooting date wheel should reverse to maximum possible date', async () => { - await scrollWheel(1, -5) - await expectDate('2000-01-06 00:00:00') - }) - }) - - describe('time mode', () => { - before(async () => { - await setMode('time') - await setMinimumDate(oneMinuteBeforeJanuary2) - }) - - it('overshooting hour wheel should reverse to minimum possible time', async () => { - await scrollWheel(0, -5) - await expectDate('2000-01-01 23:59:00') - }) - - it('overshooting minute wheel should reverse to minimum possible time', async () => { - await scrollWheel(1, -5) - await expectDate('2000-01-01 23:59:00') - }) - - it('overshooting am/pm wheel should reverse to minimum possible time', async () => { - await scrollWheel(2, -1) - await expectDate('2000-01-01 23:59:00') - }) - }) - }) -})