Browse Source

chore: convert tests from detox to maestro (maximumDate) (#739)

master
Henning Hall 1 year ago
committed by GitHub
parent
commit
708a61ed9d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 133 additions and 118 deletions
  1. +6
    -1
      .github/workflows/test-android-e2e.yml
  2. +1
    -1
      .github/workflows/test-ios-e2e.yml
  3. +112
    -0
      .maestro/maximum-date.yml
  4. +7
    -0
      .maestro/utils/change-maximum-date.yml
  5. +7
    -0
      .maestro/utils/change-mode.yml
  6. +0
    -116
      examples/detox/e2e/tests/maximumDate.spec.js

+ 6
- 1
.github/workflows/test-android-e2e.yml View File

@ -3,6 +3,11 @@ name: Test Android e2e
on:
workflow_call:
workflow_dispatch:
inputs:
test-tags:
description: 'Maestro tags to run (comma separated)'
required: false
default: 'android'
env:
APP_PATH: examples/Rn071/android/app/build/outputs/apk/release/app-release.apk
@ -28,7 +33,7 @@ jobs:
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: ${{ env.APP_PATH }}
include-tags: android
include-tags: ${{ inputs.test-tags }}
# Step can be removed when this is fixed:
# https://github.com/mobile-dev-inc/action-maestro-cloud/issues/28

+ 1
- 1
.github/workflows/test-ios-e2e.yml View File

@ -1,4 +1,4 @@
name: E2E tests (ios)
name: Test iOS e2e
on:
workflow_call:

+ 112
- 0
.maestro/maximum-date.yml View File

@ -0,0 +1,112 @@
appId: com.rn071
tags:
- android
- maximumDate
---
- runFlow: utils/launch.yml
########## describe: cannot pass max date
- runFlow:
file: utils/change-maximum-date.yml
env:
VALUE: '2000-01-01T00:00:00'
### test: datetime mode
- runFlow:
file: utils/change-mode.yml
env:
VALUE: datetime
- runFlow: utils/swipe-wheel-1.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-2.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-3.yml
- assertVisible: '2000-01-01 00:00:00'
### test: date mode
- runFlow:
file: utils/change-mode.yml
env:
VALUE: date
- runFlow: utils/swipe-wheel-1.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-2.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-3.yml
- assertVisible: '2000-01-01 00:00:00'
### test: time mode
- runFlow:
file: utils/change-mode.yml
env:
VALUE: time
- runFlow: utils/swipe-wheel-1.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-2.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-3.yml
- assertVisible: '2000-01-01 00:00:00'
########## describe: overshooting max date
### test: overshooting day wheel should reset to maximum date
- runFlow:
file: utils/change-maximum-date.yml
env:
VALUE: '2000-01-02 00:00:00'
- runFlow: utils/swipe-wheel-1.yml
- 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/swipe-wheel-1.yml
- assertVisible: '2000-01-02 00:00:00'
- runFlow: utils/swipe-wheel-2.yml
- assertVisible: '2000-01-02 00:00:00'
### test: overshooting year wheel should set other wheels to max date
- runFlow:
file: utils/change-maximum-date.yml
env:
VALUE: '2001-01-02 00:00:00'
- runFlow: utils/swipe-wheel-1.yml
- runFlow: utils/swipe-wheel-3.yml
- assertVisible: '2001-01-02 00:00:00'
### test: overshooting in time mode should set other wheels to max date
- runFlow: utils/reset.yml
- runFlow:
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/swipe-wheel-1.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-2.yml
- assertVisible: '2000-01-01 00:00:00'
- runFlow: utils/swipe-wheel-3.yml
- assertVisible: '2000-01-01 00:00:00'

+ 7
- 0
.maestro/utils/change-maximum-date.yml View File

@ -0,0 +1,7 @@
appId: com.rn071
---
- runFlow:
file: change-prop.yml
env:
PROP: maximumDate
VALUE: ${VALUE}

+ 7
- 0
.maestro/utils/change-mode.yml View File

@ -0,0 +1,7 @@
appId: com.rn071
---
- runFlow:
file: change-prop.yml
env:
PROP: mode
VALUE: ${VALUE}

+ 0
- 116
examples/detox/e2e/tests/maximumDate.spec.js View File

@ -1,116 +0,0 @@
const { scrollWheel, expectDate, setMaximumDate, setMode } = require('../utils')
const initialDate = new Date(2000, 0, 1, 0, 0)
const secondOfJanuary = new Date(2000, 0, 2, 0, 0)
const secondOfJanuary2001 = new Date(2001, 0, 2, 0, 0)
describe('Maximum date', () => {
before(async () => {
await device.reloadReactNative()
await element(by.text('Advanced')).tap()
})
describe('cannot pass max date - datetime mode', () => {
before(async () => {
await setMode('datetime')
await setMaximumDate(initialDate)
})
it('day wheel', async () => {
await scrollWheel(0, 2)
await expectDate('2000-01-01 00:00:00')
})
it('hour wheel', async () => {
await scrollWheel(1, 1)
await expectDate('2000-01-01 00:00:00')
})
it('minute wheel', async () => {
await scrollWheel(2, 1)
await expectDate('2000-01-01 00:00:00')
})
})
describe('cannot pass max date - date mode', () => {
before(async () => {
await setMode('date')
await setMaximumDate(initialDate)
})
it('month wheel', async () => {
await scrollWheel(0, 1)
await expectDate('2000-01-01 00:00:00')
})
it('date wheel', async () => {
await scrollWheel(1, 1)
await expectDate('2000-01-01 00:00:00')
})
it('year wheel', async () => {
await scrollWheel(2, 1)
await expectDate('2000-01-01 00:00:00')
})
})
describe('overshooting max date', () => {
before(async () => {
await setMaximumDate(secondOfJanuary)
})
it('day wheel should not be possible to overshoot since it is not wrapping (no invalid dates exists)', async () => {
await setMode('datetime')
await scrollWheel(0, 1)
await expectDate('2000-01-02 00:00:00')
await scrollWheel(0, 1)
await expectDate('2000-01-02 00:00:00')
})
describe('date mode', () => {
before(async () => {
await setMode('date')
await setMaximumDate(secondOfJanuary)
})
it('overshooting month wheel should set all other wheels to maximum possible date', async () => {
await scrollWheel(0, 1)
await expectDate('2000-01-02 00:00:00')
})
it('overshooting date wheel should reverse to highest possible date', async () => {
await scrollWheel(1, 5)
await expectDate('2000-01-02 00:00:00')
})
it('overshooting year wheel should set all other wheels to maximum possible date', async () => {
await setMaximumDate(secondOfJanuary2001)
await scrollWheel(0, 1) // set month to feb
await scrollWheel(2, 1)
await expectDate('2001-01-02 00:00:00')
})
})
describe('time mode', () => {
before(async () => {
await setMode('time')
await setMaximumDate(initialDate)
})
it('overshooting hour wheel should reverse to highest possible time', async () => {
await scrollWheel(0, 5)
await expectDate('2000-01-01 00:00:00')
})
it('overshooting minute wheel should reverse to highest possible time', async () => {
await scrollWheel(1, 5)
await expectDate('2000-01-01 00:00:00')
})
it('overshooting am/pm wheel should reverse to highest possible time', async () => {
await scrollWheel(2, 1)
await expectDate('2000-01-01 00:00:00')
})
})
})
})

Loading…
Cancel
Save