From 9b858f37d5f970c8ca3fdb6e8d7d896d2be4c580 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 10:13:51 +0200 Subject: [PATCH 01/18] chore: move display text tests to mastro --- .maestro/display-text.yml | 92 +++++++++---- .maestro/utils/change-locale-and-scroll.yml | 14 ++ .maestro/utils/change-prop.yml | 3 +- .maestro/utils/swipe-wheel-1-down.yml | 4 +- examples/Rn069/e2e/tests/displayText.spec.js | 106 --------------- examples/Rn071/src/App.js | 9 +- examples/Rn071/src/CustomPropValue.js | 130 +++++++++++-------- examples/Rn071/src/MicroButton.js | 9 ++ examples/Rn071/src/examples/Advanced.js | 47 ++++++- 9 files changed, 210 insertions(+), 204 deletions(-) create mode 100644 .maestro/utils/change-locale-and-scroll.yml delete mode 100644 examples/Rn069/e2e/tests/displayText.spec.js create mode 100644 examples/Rn071/src/MicroButton.js diff --git a/.maestro/display-text.yml b/.maestro/display-text.yml index 22eb5e06..f31e8e27 100644 --- a/.maestro/display-text.yml +++ b/.maestro/display-text.yml @@ -11,7 +11,6 @@ tags: STATE: '' - runFlow: utils/launch.yml - # test: minuteInterval rounding should round with floor - runFlow: file: utils/change-prop.yml @@ -29,16 +28,8 @@ tags: - runFlow: utils/reset.yml # test: can have initial date in past -- runFlow: - file: utils/change-prop.yml - env: - PROP: maximumDate - VALUE: undefined -- runFlow: - file: utils/change-prop.yml - env: - PROP: minimumDate - VALUE: undefined +- tapOn: clear maximumDate +- tapOn: clear minimumDate - runFlow: file: utils/change-prop.yml env: @@ -49,23 +40,74 @@ tags: - runFlow: utils/reset.yml -# test: display text - runFlow: - file: utils/change-prop.yml + file: utils/change-locale-and-scroll.yml env: - PROP: locale - VALUE: vi-VN -- runFlow: utils/swipe-wheel-1.yml -- assertVisible: - id: dateStringOutput - text: 'CN 2 thg 11200 SA ' + LOCALE: en-US + EXPECT: 'Sun Jan 21200 AM ' + +# test: translates the display text - datetime +- runFlow: reset.yml + +test: display text - datetime +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: vi-VN + EXPECT: 'CN 2 thg 11200 SA ' + +- runFlow: reset.yml +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: pt-BR + EXPECT: 'dom. 2 de jan. 1200 AM' + +- runFlow: reset.yml + +# If more tests are needed on datetime locale: +# 'sv-SE', 'sön 2 jan.' + '1200 fm ' +# 'ru-RU', 'вс 2 янв.' + '1200 AM ' +# 'ko', '1월 2일 일 오전 1200' +# 'ja', '1月2日 日' + '1200 午前 ' +# 'zh-CH', '1月2日周日 上午 1200' +# 'eu', 'urt. 2 ig.' + ' AM 1200' # Should be possible to use picker with invalid locale -- runFlow: utils/launch.yml - runFlow: - file: utils/change-prop.yml + file: utils/change-locale-and-scroll.yml env: - PROP: locale - VALUE: xx -- runFlow: utils/swipe-wheel-1.yml -- assertVisible: '2000-01-02 00:00:00' + LOCALE: xx + EXPECT: '2000-01-02 00:00:00' + +# test: translates the display text - datetime +test: display text - date + +- tapOn: date mode +- tapOn: clear minimumDate +- tapOn: clear maximumDate + +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: en-US + EXPECT: 'February12000' + +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: pt-BR + EXPECT: '2janeiro2000' + +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: zh-CH + EXPECT: '2001年一月1日' + +# If more tests are needed for date locale: +# 'sv-SE', '2' + 'januari' + '2000' +# 'ko', '2001년' + '1월' + '1일' +# 'ja', '2001年' + '1月' + '1日' +# 'zh-CH', '2001年' + '一月' + '1日' +# 'eu', '2001' + 'urtarrila' + '1' diff --git a/.maestro/utils/change-locale-and-scroll.yml b/.maestro/utils/change-locale-and-scroll.yml new file mode 100644 index 00000000..f3f1aea5 --- /dev/null +++ b/.maestro/utils/change-locale-and-scroll.yml @@ -0,0 +1,14 @@ +appId: com.android.settings +--- +- tapOn: Clear +- tapOn: reset date +- tapOn: change locale +- tapOn: + id: propValue +- inputText: ${LOCALE} +- hideKeyboard +- tapOn: Change +- runFlow: swipe-wheel-1.yml +- assertVisible: + id: dateStringOutput + text: ${EXPECT} diff --git a/.maestro/utils/change-prop.yml b/.maestro/utils/change-prop.yml index fb811bf6..4638cedc 100644 --- a/.maestro/utils/change-prop.yml +++ b/.maestro/utils/change-prop.yml @@ -7,7 +7,6 @@ appId: com.rn071 - tapOn: id: propValue - inputText: ${VALUE} -- tapOn: - id: changeProp +- hideKeyboard - tapOn: id: changeProp diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml index 4134479b..ac8a1e33 100644 --- a/.maestro/utils/swipe-wheel-1-down.yml +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 25%, 40% - end: 25%, 32% + start: 38%, 40% + end: 38%, 32% diff --git a/examples/Rn069/e2e/tests/displayText.spec.js b/examples/Rn069/e2e/tests/displayText.spec.js deleted file mode 100644 index 390e8a11..00000000 --- a/examples/Rn069/e2e/tests/displayText.spec.js +++ /dev/null @@ -1,106 +0,0 @@ -const { - setMode, - setLocale, - expectDateString, - scrollWheel, - setMinimumDate, - setMaximumDate, - reset, - init, -} = require('../utils'); - -describe('Display text', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - beforeEach(async () => { - await reset(); - }); - - describe('datetime', () => { - it('vi-VN', async () => { - await expectLocaleDateString('vi-VN', 'CN 2 thg 1' + '1200 SA '); - }); - it('en-US', async () => { - await expectLocaleDateString('en-US', 'Sun Jan 2' + '1200 AM '); - }); - - it('pt-BR', async () => { - await expectLocaleDateString('pt-BR', 'dom 2 de jan' + '1200 AM '); - }); - - it('sv-SE', async () => { - await expectLocaleDateString('sv-SE', 'sön 2 jan.' + '1200 fm '); - }); - - it('ru-RU', async () => { - await expectLocaleDateString('ru-RU', 'вс 2 янв.' + '1200 AM '); - }); - - it('ko', async () => { - await expectLocaleDateString('ko', '1월 2일 일 오전 1200'); - }); - - it('ja', async () => { - await expectLocaleDateString('ja', '1月2日 日' + '1200 午前 '); - }); - - it('zh-CH', async () => { - await expectLocaleDateString('zh-CH', '1月2日周日 上午 1200'); - }); - - it('eu', async () => { - await expectLocaleDateString('eu', 'urt. 2 ig.' + ' AM 1200'); - }); - }); - - describe('date', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - await setMinimumDate(undefined); - await setMaximumDate(undefined); - await setMode('date'); - }); - - beforeEach(async () => { - await reset(); - }); - - it('en-US', async () => { - await expectLocaleDateString('en-US', 'February' + '1' + '2000'); - }); - - it('pt-BR', async () => { - await expectLocaleDateString('pt-BR', '2janeiro' + '2000'); - }); - - it('sv-SE', async () => { - await expectLocaleDateString('sv-SE', '2' + 'januari' + '2000'); - }); - - it('ko', async () => { - await expectLocaleDateString('ko', '2001년' + '1월' + '1일'); - }); - - it('ja', async () => { - await expectLocaleDateString('ja', '2001年' + '1月' + '1日'); - }); - - it('zh-CH', async () => { - await expectLocaleDateString('zh-CH', '2001年' + '一月' + '1日'); - }); - - it('eu', async () => { - await expectLocaleDateString('eu', '2001' + 'urtarrila' + '1'); - }); - }); - - const expectLocaleDateString = async (locale, dateString) => { - await setLocale(locale); - await scrollWheel(0, 1); - await expectDateString(dateString); - }; -}); diff --git a/examples/Rn071/src/App.js b/examples/Rn071/src/App.js index 46fdc674..de422b69 100644 --- a/examples/Rn071/src/App.js +++ b/examples/Rn071/src/App.js @@ -20,8 +20,7 @@ export default class App extends Component { styles.container, {backgroundColor: this.state.backgroundColor || 'white'}, ]} - contentContainerStyle={styles.content} - > + contentContainerStyle={styles.content}> {!this.state.picker && 'Examples'} {!this.state.picker && this.renderButtons()} @@ -53,8 +52,7 @@ export default class App extends Component { this.setState({picker: key})} - style={{margin: 10}} - > + style={{margin: 10}}> {examples[key].buttonTitle} ); @@ -62,8 +60,7 @@ export default class App extends Component { renderBackButton = key => ( this.setState({picker: undefined})} - style={{margin: 10, position: 'absolute', top: 30, left: 0}} - > + style={{margin: 10, position: 'absolute', top: 30, left: 0}}> Go back ); diff --git a/examples/Rn071/src/CustomPropValue.js b/examples/Rn071/src/CustomPropValue.js index dfbc026d..4547ee81 100644 --- a/examples/Rn071/src/CustomPropValue.js +++ b/examples/Rn071/src/CustomPropValue.js @@ -1,64 +1,80 @@ -import React, { useState } from 'react' -import { Button, TextInput, Text, View, TouchableOpacity } from 'react-native' +import React, {useState} from 'react'; +import {Text, TextInput, TouchableOpacity, View} from 'react-native'; +import {MicroButton} from './MicroButton'; +import {getInitialDate} from './examples/Advanced'; export default function CustomPropValue(props) { - const [propName, setPropName] = useState("") - const [propValue, setPropValue] = useState("") + const [propName, setPropName] = useState(''); + const [propValue, setPropValue] = useState(''); - const getPropValue = () => { - if (propValue === "undefined") return undefined - if (propName === "minuteInterval") return parseInt(propValue) - if (propName === "timeZoneOffsetInMinutes") return parseInt(propValue) - if (["date", "maximumDate", "minimumDate"].includes(propName)) return new Date(propValue) - return propValue - } + const getPropValue = () => { + if (propValue === 'undefined') return undefined; + if (propName === 'minuteInterval') return parseInt(propValue); + if (propName === 'timeZoneOffsetInMinutes') return parseInt(propValue); + if (['date', 'maximumDate', 'minimumDate'].includes(propName)) + return new Date(propValue); + return propValue; + }; - return ( - - - Prop name - - Prop value - - - { - props.changeProp({ propName, propValue: getPropValue() }) - setPropName(''); - setPropValue(''); - } - } - >Change - - { - setPropName(''); - setPropValue(''); - }} - > - Clear - - - ) + return ( + + + Prop name + + Prop value + + + { + props.changeProp({propName, propValue: getPropValue()}); + setPropName(''); + setPropValue(''); + }}> + Change + + + + { + setPropName(''); + setPropValue(''); + }}> + Clear + + + props.changeProp({propName: 'date', propValue: getInitialDate()}) + } + /> + { + setPropName('locale'); + }} + /> + + + ); } const input = { - height: 30, - borderColor: 'gray', - borderWidth: 0.5, - margin: 2, - padding: 0, - alignItems: "center", - textAlign: "center" -} \ No newline at end of file + height: 30, + borderColor: 'gray', + borderWidth: 0.5, + margin: 2, + padding: 0, + alignItems: 'center', + textAlign: 'center', +}; diff --git a/examples/Rn071/src/MicroButton.js b/examples/Rn071/src/MicroButton.js new file mode 100644 index 00000000..50a4d0a5 --- /dev/null +++ b/examples/Rn071/src/MicroButton.js @@ -0,0 +1,9 @@ +import {Text, TouchableOpacity} from 'react-native'; + +export const MicroButton = ({onPress, text}) => { + return ( + + {text} + + ); +}; diff --git a/examples/Rn071/src/examples/Advanced.js b/examples/Rn071/src/examples/Advanced.js index b61c8833..c8fc02ad 100644 --- a/examples/Rn071/src/examples/Advanced.js +++ b/examples/Rn071/src/examples/Advanced.js @@ -1,15 +1,16 @@ import React, {Component} from 'react'; -import {StyleSheet, Text, View, UIManager, findNodeHandle} from 'react-native'; +import {StyleSheet, Text, UIManager, View, findNodeHandle} from 'react-native'; import DatePicker from 'react-native-date-picker'; +import CustomPropValue from '../CustomPropValue'; +import {MicroButton} from '../MicroButton'; +import PropSlider from '../PropSlider'; import DateChange from '../propPickers/DateChange'; import LocalePicker from '../propPickers/LocalePicker'; import MinMaxDateChange from '../propPickers/MinMaxDateChange'; -import ModePicker from '../propPickers/ModePicker'; -import TimeZoneOffsetInMinutes from '../propPickers/TimeZoneOffsetInMinutes'; -import PropSlider from '../PropSlider'; import MinuteInterval from '../propPickers/MinuteInterval'; +import ModePicker from '../propPickers/ModePicker'; import Scroll from '../propPickers/Scroll'; -import CustomPropValue from '../CustomPropValue'; +import TimeZoneOffsetInMinutes from '../propPickers/TimeZoneOffsetInMinutes'; import {readableDate} from '../utils'; Date.prototype.addHours = function (h) { @@ -17,7 +18,7 @@ Date.prototype.addHours = function (h) { return this; }; -const getInitialDate = () => new Date(2000, 0, 1, 0, 0); +export const getInitialDate = () => new Date(2000, 0, 1, 0, 0); export const defaultMinDate = getInitialDate().addHours(-24 * 5); export const defaultMaxDate = getInitialDate().addHours(24 * 5); @@ -69,6 +70,40 @@ export default class Advanced extends Component { /> Prop value: {this.selectedPropData().component} + + + this.setState({date: getInitialDate()})} + text={'reset date'} + /> + this.setState({minimumDate: undefined})} + text={'clear minimumDate'} + /> + this.setState({maximumDate: undefined})} + text={'clear maximumDate'} + /> + this.setState({mode: 'date'})} + text={'date mode'} + /> + this.setState({mode: 'datetime'})} + text={'datetime mode'} + /> + this.setState({mode: 'time'})} + text={'time mode'} + /> + ); } From 45895521cfb6ba8f0765770a64a5d29f954424c2 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 10:22:46 +0200 Subject: [PATCH 02/18] wip --- .maestro/display-text.yml | 48 ++++++++++++--------------- .maestro/utils/change-prop-value.yml | 9 +++++ examples/Rn071/src/CustomPropValue.js | 12 +++++++ 3 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 .maestro/utils/change-prop-value.yml diff --git a/.maestro/display-text.yml b/.maestro/display-text.yml index f31e8e27..1d417ab1 100644 --- a/.maestro/display-text.yml +++ b/.maestro/display-text.yml @@ -3,12 +3,12 @@ tags: - android - displayText --- -- runFlow: - file: utils/set-timezone.yml - env: - REGION: Sweden - GMT: GMT+01:00 - STATE: '' +# - runFlow: +# file: utils/set-timezone.yml +# env: +# REGION: Sweden +# GMT: GMT+01:00 +# STATE: '' - runFlow: utils/launch.yml # test: minuteInterval rounding should round with floor @@ -17,10 +17,10 @@ tags: env: PROP: minuteInterval VALUE: 5 +- tapOn: change date - runFlow: - file: utils/change-prop.yml + file: utils/change-prop-value.yml env: - PROP: date VALUE: '2000-01-01T00:34:00+01:00' - runFlow: utils/swipe-wheel-1.yml - assertVisible: '2000-01-02 00:30:00' @@ -28,12 +28,12 @@ tags: - runFlow: utils/reset.yml # test: can have initial date in past -- tapOn: clear maximumDate +- tapOn: clear maximumDate - tapOn: clear minimumDate +- tapOn: change date - runFlow: - file: utils/change-prop.yml + file: utils/change-prop-value.yml env: - PROP: date VALUE: '1999-01-01' - runFlow: utils/swipe-wheel-1.yml - assertVisible: '1999-01-02 01:00:00' @@ -46,24 +46,27 @@ tags: LOCALE: en-US EXPECT: 'Sun Jan 21200 AM ' -# test: translates the display text - datetime -- runFlow: reset.yml +- runFlow: utils/reset.yml -test: display text - datetime +# test: display text - datetime - runFlow: file: utils/change-locale-and-scroll.yml env: LOCALE: vi-VN EXPECT: 'CN 2 thg 11200 SA ' -- runFlow: reset.yml - runFlow: file: utils/change-locale-and-scroll.yml env: LOCALE: pt-BR - EXPECT: 'dom. 2 de jan. 1200 AM' + EXPECT: 'dom. 2 de jan. 1200 AM ' -- runFlow: reset.yml +# Should be possible to use picker with invalid locale +- runFlow: + file: utils/change-locale-and-scroll.yml + env: + LOCALE: xx + EXPECT: '2000-01-02 00:00:00' # If more tests are needed on datetime locale: # 'sv-SE', 'sön 2 jan.' + '1200 fm ' @@ -73,15 +76,7 @@ test: display text - datetime # 'zh-CH', '1月2日周日 上午 1200' # 'eu', 'urt. 2 ig.' + ' AM 1200' -# Should be possible to use picker with invalid locale -- runFlow: - file: utils/change-locale-and-scroll.yml - env: - LOCALE: xx - EXPECT: '2000-01-02 00:00:00' - -# test: translates the display text - datetime -test: display text - date +# test: display text - date - tapOn: date mode - tapOn: clear minimumDate @@ -104,7 +99,6 @@ test: display text - date env: LOCALE: zh-CH EXPECT: '2001年一月1日' - # If more tests are needed for date locale: # 'sv-SE', '2' + 'januari' + '2000' # 'ko', '2001년' + '1월' + '1일' diff --git a/.maestro/utils/change-prop-value.yml b/.maestro/utils/change-prop-value.yml new file mode 100644 index 00000000..83e0171a --- /dev/null +++ b/.maestro/utils/change-prop-value.yml @@ -0,0 +1,9 @@ +appId: com.rn071 +--- +- tapOn: clear prop value +- tapOn: + id: propValue +- inputText: ${VALUE} +- hideKeyboard +- tapOn: + id: changeProp diff --git a/examples/Rn071/src/CustomPropValue.js b/examples/Rn071/src/CustomPropValue.js index 4547ee81..8accbc03 100644 --- a/examples/Rn071/src/CustomPropValue.js +++ b/examples/Rn071/src/CustomPropValue.js @@ -52,6 +52,12 @@ export default function CustomPropValue(props) { }}> Clear + { + setPropName('date'); + }} + /> @@ -64,6 +70,12 @@ export default function CustomPropValue(props) { setPropName('locale'); }} /> + { + setPropName('date'); + }} + /> ); From 35e6c3231d814545b754c0a92ef41e7d2a56cdbd Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 10:27:40 +0200 Subject: [PATCH 03/18] pt --- .maestro/display-text.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.maestro/display-text.yml b/.maestro/display-text.yml index 1d417ab1..007dbf79 100644 --- a/.maestro/display-text.yml +++ b/.maestro/display-text.yml @@ -3,12 +3,12 @@ tags: - android - displayText --- -# - runFlow: -# file: utils/set-timezone.yml -# env: -# REGION: Sweden -# GMT: GMT+01:00 -# STATE: '' +- runFlow: + file: utils/set-timezone.yml + env: + REGION: Sweden + GMT: GMT+01:00 + STATE: '' - runFlow: utils/launch.yml # test: minuteInterval rounding should round with floor @@ -59,7 +59,7 @@ tags: file: utils/change-locale-and-scroll.yml env: LOCALE: pt-BR - EXPECT: 'dom. 2 de jan. 1200 AM ' + EXPECT: 'dom. 2 de jan.1200 AM ' # Should be possible to use picker with invalid locale - runFlow: @@ -99,6 +99,7 @@ tags: env: LOCALE: zh-CH EXPECT: '2001年一月1日' +# # If more tests are needed for date locale: # 'sv-SE', '2' + 'januari' + '2000' # 'ko', '2001년' + '1월' + '1일' From f5b275cae3fe843546944ec3bb888a99c8d04e1c Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 10:51:09 +0200 Subject: [PATCH 04/18] fix regex --- .maestro/utils/change-locale-and-scroll.yml | 2 +- examples/Rn071/src/examples/Advanced.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.maestro/utils/change-locale-and-scroll.yml b/.maestro/utils/change-locale-and-scroll.yml index f3f1aea5..c447f4ab 100644 --- a/.maestro/utils/change-locale-and-scroll.yml +++ b/.maestro/utils/change-locale-and-scroll.yml @@ -10,5 +10,5 @@ appId: com.android.settings - tapOn: Change - runFlow: swipe-wheel-1.yml - assertVisible: - id: dateStringOutput + id: dateStringOutput|dateOutput text: ${EXPECT} diff --git a/examples/Rn071/src/examples/Advanced.js b/examples/Rn071/src/examples/Advanced.js index c8fc02ad..1bf7ab67 100644 --- a/examples/Rn071/src/examples/Advanced.js +++ b/examples/Rn071/src/examples/Advanced.js @@ -58,7 +58,9 @@ export default class Advanced extends Component { timeZoneOffsetInMinutes={this.state.timeZoneOffsetInMinutes} /> {readableDate(this.state.date)} - {this.state.dateString} + + {this.state.dateString} + Change prop: From 7790a620238659430eeeb42bb4dead17a4e214fa Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 11:22:20 +0200 Subject: [PATCH 05/18] mode --- .maestro/other.yml | 31 +++++++++++++++++++++++++++ .maestro/utils/swipe-wheel-1-down.yml | 4 ++-- .maestro/utils/swipe-wheel-1-up.yml | 4 ++-- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 .maestro/other.yml diff --git a/.maestro/other.yml b/.maestro/other.yml new file mode 100644 index 00000000..25455875 --- /dev/null +++ b/.maestro/other.yml @@ -0,0 +1,31 @@ +appId: com.rn071 +tags: + - mode +--- +- runFlow: utils/launch.yml + +# datetime +- tapOn: datetime mode +- runFlow: utils/swipe-wheel-1.yml +- runFlow: utils/swipe-wheel-2.yml +- runFlow: utils/swipe-wheel-3.yml +- runFlow: utils/swipe-wheel-4.yml +- assertVisible: '2000-01-02 13:01:00' +- tapOn: reset date + +# date +- tapOn: date mode +- tapOn: clear maximumDate +- runFlow: utils/swipe-wheel-1.yml +- runFlow: utils/swipe-wheel-2.yml +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2001-02-02 00:00:00' +- tapOn: reset date + +# time +- tapOn: time mode +- runFlow: utils/swipe-wheel-1.yml +- runFlow: utils/swipe-wheel-2.yml +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2000-01-01 13:01:00' +- tapOn: reset date diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml index ac8a1e33..b4a63409 100644 --- a/.maestro/utils/swipe-wheel-1-down.yml +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 38%, 40% - end: 38%, 32% + start: 35%, 40% + end: 35%, 32% diff --git a/.maestro/utils/swipe-wheel-1-up.yml b/.maestro/utils/swipe-wheel-1-up.yml index 712ac321..92a51418 100644 --- a/.maestro/utils/swipe-wheel-1-up.yml +++ b/.maestro/utils/swipe-wheel-1-up.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 38%, 32% - end: 38%, 40% + start: 35%, 32% + end: 35%, 40% From 97c1ee3f6b98faf59814940a1a3d54e726864230 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 11:22:58 +0200 Subject: [PATCH 06/18] 35% --- .maestro/utils/swipe-wheel-1-down.yml | 4 ++-- .maestro/utils/swipe-wheel-1-up.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml index ac8a1e33..b4a63409 100644 --- a/.maestro/utils/swipe-wheel-1-down.yml +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 38%, 40% - end: 38%, 32% + start: 35%, 40% + end: 35%, 32% diff --git a/.maestro/utils/swipe-wheel-1-up.yml b/.maestro/utils/swipe-wheel-1-up.yml index 712ac321..92a51418 100644 --- a/.maestro/utils/swipe-wheel-1-up.yml +++ b/.maestro/utils/swipe-wheel-1-up.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 38%, 32% - end: 38%, 40% + start: 35%, 32% + end: 35%, 40% From 28c80d2e42bf88276975a40d417e5514bc869e81 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 11:24:41 +0200 Subject: [PATCH 07/18] rm --- examples/detox/e2e/tests/mode.spec.js | 47 --------------------------- 1 file changed, 47 deletions(-) delete mode 100644 examples/detox/e2e/tests/mode.spec.js diff --git a/examples/detox/e2e/tests/mode.spec.js b/examples/detox/e2e/tests/mode.spec.js deleted file mode 100644 index 45194f7d..00000000 --- a/examples/detox/e2e/tests/mode.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -const { setMode } = require('../utils') - -describe('Modes', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - it('datetime', async () => { - await setMode('datetime') - - await expect(element(by.id('day'))).toBeVisible() - await expect(element(by.id('minutes'))).toBeVisible() - await expect(element(by.id('hour'))).toBeVisible() - await expect(element(by.id('ampm'))).toBeVisible() - - await expect(element(by.id('month'))).toNotExist() - await expect(element(by.id('date'))).toNotExist() - await expect(element(by.id('year'))).toNotExist() - }) - - it('date', async () => { - await setMode('date') - - await expect(element(by.id('month'))).toBeVisible() - await expect(element(by.id('date'))).toBeVisible() - await expect(element(by.id('year'))).toBeVisible() - - await expect(element(by.id('day'))).toNotExist() - await expect(element(by.id('minutes'))).toNotExist() - await expect(element(by.id('hour'))).toNotExist() - await expect(element(by.id('ampm'))).toNotExist() - }) - - it('time', async () => { - await setMode('time') - - await expect(element(by.id('minutes'))).toBeVisible() - await expect(element(by.id('hour'))).toBeVisible() - await expect(element(by.id('ampm'))).toBeVisible() - - await expect(element(by.id('day'))).toNotExist() - await expect(element(by.id('month'))).toNotExist() - await expect(element(by.id('date'))).toNotExist() - await expect(element(by.id('year'))).toNotExist() - }) -}) From 33f467bfeeb8875290386419c0c6ce99d452bfee Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 11:32:17 +0200 Subject: [PATCH 08/18] rm --- examples/detox/e2e/tests/displayText.spec.js | 96 -------------------- 1 file changed, 96 deletions(-) delete mode 100644 examples/detox/e2e/tests/displayText.spec.js diff --git a/examples/detox/e2e/tests/displayText.spec.js b/examples/detox/e2e/tests/displayText.spec.js deleted file mode 100644 index 0981056e..00000000 --- a/examples/detox/e2e/tests/displayText.spec.js +++ /dev/null @@ -1,96 +0,0 @@ -const { - setMode, - setLocale, - expectDateString, - scrollWheel, - setMinimumDate, - setMaximumDate, -} = require('../utils') - -describe('Display text', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - describe('datetime', () => { - it('vi-VN', async () => { - await expectLocaleDateString('vi-VN', 'CN 2 thg 1' + '1200 SA ') - }) - it('en-US', async () => { - await expectLocaleDateString('en-US', 'Sun Jan 2' + '1200 AM ') - }) - - it('pt-BR', async () => { - await expectLocaleDateString('pt-BR', 'dom 2 de jan' + '1200 AM ') - }) - - it('sv-SE', async () => { - await expectLocaleDateString('sv-SE', 'sön 2 jan.' + '1200 fm ') - }) - - it('ru-RU', async () => { - await expectLocaleDateString('ru-RU', 'вс 2 янв.' + '1200 AM ') - }) - - it('ko', async () => { - await expectLocaleDateString('ko', '1월 2일 일 오전 1200') - }) - - it('ja', async () => { - await expectLocaleDateString('ja', '1月2日 日' + '1200 午前 ') - }) - - it('zh-CH', async () => { - await expectLocaleDateString('zh-CH', '1月2日周日 上午 1200') - }) - - it('eu', async () => { - await expectLocaleDateString('eu', 'urt. 2 ig.' + ' AM 1200') - }) - }) - - describe('date', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - await setMinimumDate(undefined) - await setMaximumDate(undefined) - await setMode('date') - }) - - it('en-US', async () => { - await expectLocaleDateString('en-US', 'February' + '1' + '2000') - }) - - it('pt-BR', async () => { - await expectLocaleDateString('pt-BR', '2janeiro' + '2000') - }) - - it('sv-SE', async () => { - await expectLocaleDateString('sv-SE', '2' + 'januari' + '2000') - }) - - it('ko', async () => { - await expectLocaleDateString('ko', '2001년' + '1월' + '1일') - }) - - it('ja', async () => { - await expectLocaleDateString('ja', '2001年' + '1月' + '1日') - }) - - it('zh-CH', async () => { - await expectLocaleDateString('zh-CH', '2001年' + '一月' + '1日') - }) - - it('eu', async () => { - await expectLocaleDateString('eu', '2001' + 'urtarrila' + '1') - }) - }) - - const expectLocaleDateString = async (locale, dateString) => { - await setLocale(locale) - await scrollWheel(0, 1) - await expectDateString(dateString) - } -}) From 3348812a0f825802711db8729ed69c7bff4fad88 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:18:26 +0200 Subject: [PATCH 09/18] fix test --- .maestro/{other.yml => mode.yml} | 27 ++++++++++++++++++++++++ .maestro/utils/set-hour-format.yml | 16 ++++++++++++++ .maestro/utils/set-timezone.yml | 1 - .maestro/utils/swipe-wheel-1-no-ampm.yml | 5 +++++ .maestro/utils/swipe-wheel-1-up.yml | 4 ++-- examples/Rn071/package.json | 3 ++- examples/Rn071/src/MicroButton.js | 5 ++++- examples/Rn071/src/examples/Advanced.js | 7 +++++- examples/Rn071/yarn.lock | 10 +++++++++ 9 files changed, 72 insertions(+), 6 deletions(-) rename .maestro/{other.yml => mode.yml} (51%) create mode 100644 .maestro/utils/set-hour-format.yml create mode 100644 .maestro/utils/swipe-wheel-1-no-ampm.yml diff --git a/.maestro/other.yml b/.maestro/mode.yml similarity index 51% rename from .maestro/other.yml rename to .maestro/mode.yml index 25455875..d4f8faf1 100644 --- a/.maestro/other.yml +++ b/.maestro/mode.yml @@ -4,6 +4,8 @@ tags: --- - runFlow: utils/launch.yml +# test: 12h time + # datetime - tapOn: datetime mode - runFlow: utils/swipe-wheel-1.yml @@ -29,3 +31,28 @@ tags: - runFlow: utils/swipe-wheel-3.yml - assertVisible: '2000-01-01 13:01:00' - tapOn: reset date + +# test: 24h time +- runFlow: + when: + visible: 'time format: 12h' + file: utils/set-hour-format.yml + +- runFlow: utils/launch.yml + +# datetime +- tapOn: datetime mode +- runFlow: utils/swipe-wheel-4.yml # expected not to exist (check needed so that ) +- runFlow: utils/swipe-wheel-1.yml +- runFlow: utils/swipe-wheel-2.yml +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2000-01-02 01:01:00' +- tapOn: reset date + +# time +- tapOn: time mode +- runFlow: utils/swipe-wheel-3.yml # expected not to exist +- runFlow: utils/swipe-wheel-1-no-ampm.yml +- runFlow: utils/swipe-wheel-2.yml +- assertVisible: '2000-01-01 01:01:00' +- tapOn: reset date diff --git a/.maestro/utils/set-hour-format.yml b/.maestro/utils/set-hour-format.yml new file mode 100644 index 00000000..12a668cf --- /dev/null +++ b/.maestro/utils/set-hour-format.yml @@ -0,0 +1,16 @@ +appId: com.android.settings +--- +- launchApp +- runFlow: + when: + visible: 'App info' + file: goto-settings-from-app-info.yml +- tapOn: 'Search settings' +- inputText: 'Date' +- tapOn: 'Date & time' +- tapOn: 'Date & time' + +- runFlow: + commands: + - tapOn: 'Use locale default' + - tapOn: 'Use 24-hour format' diff --git a/.maestro/utils/set-timezone.yml b/.maestro/utils/set-timezone.yml index e9a2b4f5..79c50205 100644 --- a/.maestro/utils/set-timezone.yml +++ b/.maestro/utils/set-timezone.yml @@ -22,7 +22,6 @@ appId: com.android.settings file: select-utc-offset.yml env: GMT: ${GMT} - # on most(?) devices timezone is selected by picking region - runFlow: when: diff --git a/.maestro/utils/swipe-wheel-1-no-ampm.yml b/.maestro/utils/swipe-wheel-1-no-ampm.yml new file mode 100644 index 00000000..d50b81e1 --- /dev/null +++ b/.maestro/utils/swipe-wheel-1-no-ampm.yml @@ -0,0 +1,5 @@ +appId: com.rn071 +--- +- swipe: + start: 45%, 40% + end: 45%, 32% diff --git a/.maestro/utils/swipe-wheel-1-up.yml b/.maestro/utils/swipe-wheel-1-up.yml index 92a51418..b4a63409 100644 --- a/.maestro/utils/swipe-wheel-1-up.yml +++ b/.maestro/utils/swipe-wheel-1-up.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 35%, 32% - end: 35%, 40% + start: 35%, 40% + end: 35%, 32% diff --git a/examples/Rn071/package.json b/examples/Rn071/package.json index 8faf04fb..8720f4a3 100644 --- a/examples/Rn071/package.json +++ b/examples/Rn071/package.json @@ -12,7 +12,8 @@ }, "dependencies": { "react": "18.2.0", - "react-native": "0.71.8" + "react-native": "0.71.8", + "react-native-localize": "^3.1.0" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/examples/Rn071/src/MicroButton.js b/examples/Rn071/src/MicroButton.js index 50a4d0a5..0abd938b 100644 --- a/examples/Rn071/src/MicroButton.js +++ b/examples/Rn071/src/MicroButton.js @@ -3,7 +3,10 @@ import {Text, TouchableOpacity} from 'react-native'; export const MicroButton = ({onPress, text}) => { return ( - {text} + ); }; +export const MicroText = ({text, ...props}) => ( + {text} +); diff --git a/examples/Rn071/src/examples/Advanced.js b/examples/Rn071/src/examples/Advanced.js index 1bf7ab67..385fb000 100644 --- a/examples/Rn071/src/examples/Advanced.js +++ b/examples/Rn071/src/examples/Advanced.js @@ -2,7 +2,7 @@ import React, {Component} from 'react'; import {StyleSheet, Text, UIManager, View, findNodeHandle} from 'react-native'; import DatePicker from 'react-native-date-picker'; import CustomPropValue from '../CustomPropValue'; -import {MicroButton} from '../MicroButton'; +import {MicroButton, MicroText} from '../MicroButton'; import PropSlider from '../PropSlider'; import DateChange from '../propPickers/DateChange'; import LocalePicker from '../propPickers/LocalePicker'; @@ -12,6 +12,7 @@ import ModePicker from '../propPickers/ModePicker'; import Scroll from '../propPickers/Scroll'; import TimeZoneOffsetInMinutes from '../propPickers/TimeZoneOffsetInMinutes'; import {readableDate} from '../utils'; +import {uses24HourClock} from 'react-native-localize'; Date.prototype.addHours = function (h) { this.setTime(this.getTime() + h * 60 * 60 * 1000); @@ -105,6 +106,10 @@ export default class Advanced extends Component { onPress={() => this.setState({mode: 'time'})} text={'time mode'} /> + + ); diff --git a/examples/Rn071/yarn.lock b/examples/Rn071/yarn.lock index a6b0a6b2..2b32a8be 100644 --- a/examples/Rn071/yarn.lock +++ b/examples/Rn071/yarn.lock @@ -5932,11 +5932,21 @@ react-native-codegen@^0.71.5: jscodeshift "^0.13.1" nullthrows "^1.1.1" +react-native-device-info@^10.13.1: + version "10.13.1" + resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-10.13.1.tgz#f87f44ba7b67933248be10ca302a4f2f6dbbdd4f" + integrity sha512-j/7Z+Yl9Cesjp8vKaVzbuJQKJSVs4ojXATt5WjwipZ0Ss0mBJjqtbc4x5dfZLmQ4y55VVa7c0v8KHca1iqY/TQ== + react-native-gradle-plugin@^0.71.18: version "0.71.19" resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.19.tgz#3379e28341fcd189bc1f4691cefc84c1a4d7d232" integrity sha512-1dVk9NwhoyKHCSxcrM6vY6cxmojeATsBobDicX0ZKr7DgUF2cBQRTKsimQFvzH8XhOVXyH8p4HyDSZNIFI8OlQ== +react-native-localize@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/react-native-localize/-/react-native-localize-3.1.0.tgz#1b322c05af21fd3d78d44e9b747d872ab5155b10" + integrity sha512-A7Rrxl8vuAr5FAqtMFrM5ELLdmszohK6FoHL6qlgxx4HScyOnadoZksbvKHbn+zV5nE8kud2Z4kJM10cN120Zg== + react-native@0.71.8: version "0.71.8" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.71.8.tgz#4314145341c49448cf7465b93ced52a433a5e191" From 27674ce9e8fb0fd4b498a36c3c67ec604beb72b9 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:20:54 +0200 Subject: [PATCH 10/18] remove files --- examples/Rn069/e2e/config.json | 9 -- examples/Rn069/e2e/environment.js | 23 ---- .../e2e/tests/24h-mode/hourWheel.spec.js | 24 ---- .../Rn069/e2e/tests/24h-mode/mode.spec.js | 47 ------- examples/Rn069/e2e/tests/invalidDates.spec.js | 57 -------- examples/Rn069/e2e/tests/maximumDate.spec.js | 122 ----------------- examples/Rn069/e2e/tests/minimumDate.spec.js | 124 ------------------ .../Rn069/e2e/tests/minuteInterval.spec.js | 32 ----- examples/Rn069/e2e/tests/modal.spec.js | 22 ---- examples/Rn069/e2e/tests/mode.spec.js | 47 ------- examples/Rn069/e2e/tests/scrollAround.spec.js | 45 ------- examples/Rn069/e2e/tests/wheelOrder.spec.js | 91 ------------- examples/Rn069/e2e/utils.js | 53 -------- .../e2e/tests/24h-mode/hourWheel.spec.js | 24 ---- .../detox/e2e/tests/24h-mode/mode.spec.js | 47 ------- 15 files changed, 767 deletions(-) delete mode 100644 examples/Rn069/e2e/config.json delete mode 100644 examples/Rn069/e2e/environment.js delete mode 100644 examples/Rn069/e2e/tests/24h-mode/hourWheel.spec.js delete mode 100644 examples/Rn069/e2e/tests/24h-mode/mode.spec.js delete mode 100644 examples/Rn069/e2e/tests/invalidDates.spec.js delete mode 100644 examples/Rn069/e2e/tests/maximumDate.spec.js delete mode 100644 examples/Rn069/e2e/tests/minimumDate.spec.js delete mode 100644 examples/Rn069/e2e/tests/minuteInterval.spec.js delete mode 100644 examples/Rn069/e2e/tests/modal.spec.js delete mode 100644 examples/Rn069/e2e/tests/mode.spec.js delete mode 100644 examples/Rn069/e2e/tests/scrollAround.spec.js delete mode 100644 examples/Rn069/e2e/tests/wheelOrder.spec.js delete mode 100644 examples/Rn069/e2e/utils.js delete mode 100644 examples/detox/e2e/tests/24h-mode/hourWheel.spec.js delete mode 100644 examples/detox/e2e/tests/24h-mode/mode.spec.js diff --git a/examples/Rn069/e2e/config.json b/examples/Rn069/e2e/config.json deleted file mode 100644 index 39ebe680..00000000 --- a/examples/Rn069/e2e/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "maxWorkers": 1, - "testEnvironment": "./environment", - "testRunner": "jest-circus/runner", - "testTimeout": 120000, - "testRegex": "\\.spec\\.js$", - "reporters": ["detox/runners/jest/streamlineReporter"], - "verbose": true -} diff --git a/examples/Rn069/e2e/environment.js b/examples/Rn069/e2e/environment.js deleted file mode 100644 index 7f4fc942..00000000 --- a/examples/Rn069/e2e/environment.js +++ /dev/null @@ -1,23 +0,0 @@ -const { - DetoxCircusEnvironment, - SpecReporter, - WorkerAssignReporter, -} = require('detox/runners/jest-circus'); - -class CustomDetoxEnvironment extends DetoxCircusEnvironment { - constructor(config, context) { - super(config, context); - - // Can be safely removed, if you are content with the default value (=300000ms) - this.initTimeout = 300000; - - // This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level. - // This is strictly optional. - this.registerListeners({ - SpecReporter, - WorkerAssignReporter, - }); - } -} - -module.exports = CustomDetoxEnvironment; diff --git a/examples/Rn069/e2e/tests/24h-mode/hourWheel.spec.js b/examples/Rn069/e2e/tests/24h-mode/hourWheel.spec.js deleted file mode 100644 index 027928e7..00000000 --- a/examples/Rn069/e2e/tests/24h-mode/hourWheel.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -const {scrollWheel, expectDate, init} = require('../../utils'); - -describe('Hour wheel', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - it('should have 24 hours', async () => { - await scroll3HoursAndExpect('2000-01-01 03:00:00'); - await scroll3HoursAndExpect('2000-01-01 06:00:00'); - await scroll3HoursAndExpect('2000-01-01 09:00:00'); - await scroll3HoursAndExpect('2000-01-01 12:00:00'); - await scroll3HoursAndExpect('2000-01-01 15:00:00'); - await scroll3HoursAndExpect('2000-01-01 18:00:00'); - await scroll3HoursAndExpect('2000-01-01 21:00:00'); - await scroll3HoursAndExpect('2000-01-01 00:00:00'); - }); - - const scroll3HoursAndExpect = async date => { - await scrollWheel(1, 3); - await expectDate(date); - }; -}); diff --git a/examples/Rn069/e2e/tests/24h-mode/mode.spec.js b/examples/Rn069/e2e/tests/24h-mode/mode.spec.js deleted file mode 100644 index 82a705cb..00000000 --- a/examples/Rn069/e2e/tests/24h-mode/mode.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -const {setMode, init} = require('../../utils'); - -describe('Modes - 24h', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - it('datetime', async () => { - await setMode('datetime'); - - await expect(element(by.id('day'))).toBeVisible(); - await expect(element(by.id('minutes'))).toBeVisible(); - await expect(element(by.id('hour'))).toBeVisible(); - - await expect(element(by.id('ampm'))).toNotExist(); - await expect(element(by.id('month'))).toNotExist(); - await expect(element(by.id('date'))).toNotExist(); - await expect(element(by.id('year'))).toNotExist(); - }); - - it('date', async () => { - await setMode('date'); - - await expect(element(by.id('month'))).toBeVisible(); - await expect(element(by.id('date'))).toBeVisible(); - await expect(element(by.id('year'))).toBeVisible(); - - await expect(element(by.id('day'))).toNotExist(); - await expect(element(by.id('minutes'))).toNotExist(); - await expect(element(by.id('hour'))).toNotExist(); - await expect(element(by.id('ampm'))).toNotExist(); - }); - - it('time', async () => { - await setMode('time'); - - await expect(element(by.id('minutes'))).toBeVisible(); - await expect(element(by.id('hour'))).toBeVisible(); - - await expect(element(by.id('ampm'))).toNotExist(); - await expect(element(by.id('day'))).toNotExist(); - await expect(element(by.id('month'))).toNotExist(); - await expect(element(by.id('date'))).toNotExist(); - await expect(element(by.id('year'))).toNotExist(); - }); -}); diff --git a/examples/Rn069/e2e/tests/invalidDates.spec.js b/examples/Rn069/e2e/tests/invalidDates.spec.js deleted file mode 100644 index 4a63719d..00000000 --- a/examples/Rn069/e2e/tests/invalidDates.spec.js +++ /dev/null @@ -1,57 +0,0 @@ -const { - scrollWheel, - expectDate, - setDate, - setMode, - setMaximumDate, - setMinimumDate, - init, -} = require('../utils'); - -const scrollDays = days => scrollWheel(1, days); - -describe('Invalid dates', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - await setMinimumDate(undefined); - await setMaximumDate(undefined); - await setMode('date'); - }); - - it('scrolls back to last valid date', async () => { - await setDate(new Date('2001-02-28 00:00')); - await scrollDays(1); - await expectDate('2001-02-28 00:00:00'); - }); - - it('scrolls back after scrolling multiple dates', async () => { - await setDate(new Date('2001-02-27 00:00')); - await scrollDays(2); - await expectDate('2001-02-28 00:00:00'); - }); - - it('not scrolling back on unusual valid dates', async () => { - await setDate(new Date('2000-02-28 00:00')); - await scrollDays(1); - await expectDate('2000-02-29 00:00:00'); - }); - - it('not scrolling back after scrolling past invalid dates', async () => { - await setDate(new Date('2001-02-28 00:00')); - await scrollDays(4); - await expectDate('2001-02-01 00:00:00'); - }); - - it('works on months with 30 days', async () => { - await setDate(new Date('2001-04-30 00:00')); - await scrollDays(1); - await expectDate('2001-04-30 00:00:00'); - }); - - it('works on months with 31 days', async () => { - await setDate(new Date('2001-05-30 00:00')); - await scrollDays(1); - await expectDate('2001-05-31 00:00:00'); - }); -}); diff --git a/examples/Rn069/e2e/tests/maximumDate.spec.js b/examples/Rn069/e2e/tests/maximumDate.spec.js deleted file mode 100644 index 290b0b41..00000000 --- a/examples/Rn069/e2e/tests/maximumDate.spec.js +++ /dev/null @@ -1,122 +0,0 @@ -const { - scrollWheel, - expectDate, - setMaximumDate, - setMode, - init, -} = 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', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - describe('cannot pass max date - datetime mode', () => { - beforeAll(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', () => { - beforeAll(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', () => { - beforeAll(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', () => { - beforeAll(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', () => { - beforeAll(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'); - }); - }); - }); -}); diff --git a/examples/Rn069/e2e/tests/minimumDate.spec.js b/examples/Rn069/e2e/tests/minimumDate.spec.js deleted file mode 100644 index f48935d0..00000000 --- a/examples/Rn069/e2e/tests/minimumDate.spec.js +++ /dev/null @@ -1,124 +0,0 @@ -const { - setDate, - scrollWheel, - expectDate, - setMinimumDate, - setMode, - init, -} = require('../utils'); - -const oneMinuteBeforeJanuary2 = new Date(2000, 0, 1, 23, 59, 0); - -describe('Minimum date', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - beforeEach(async () => { - await setDate(oneMinuteBeforeJanuary2.toISOString()); - }); - - describe('cannot pass min date - mode: ', () => { - describe('datetime', () => { - beforeAll(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', () => { - beforeAll(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:', () => { - beforeAll(async () => { - await setMinimumDate(oneMinuteBeforeJanuary2); - }); - - describe('datetime', () => { - beforeAll(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', () => { - beforeAll(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', () => { - beforeAll(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'); - }); - }); - }); -}); diff --git a/examples/Rn069/e2e/tests/minuteInterval.spec.js b/examples/Rn069/e2e/tests/minuteInterval.spec.js deleted file mode 100644 index ddc00dfa..00000000 --- a/examples/Rn069/e2e/tests/minuteInterval.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const {scrollWheel, expectDate, setMinuteInterval, init} = require('../utils'); - -const scrollMinuteWheel = () => scrollWheel(2, 1); - -describe('Minute interval', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - it('1 minute (default)', async () => { - await setMinuteInterval(1); - await scrollMinuteWheel(); - await expectDate('2000-01-01 00:01:00'); - }); - - it('5 minutes', async () => { - await setMinuteInterval(5); - await scrollMinuteWheel(); - await expectDate('2000-01-01 00:05:00'); - }); - - it('15 minutes', async () => { - await setMinuteInterval(15); - await scrollMinuteWheel(); - await expectDate('2000-01-01 00:15:00'); - await scrollMinuteWheel(); - await expectDate('2000-01-01 00:30:00'); - await scrollMinuteWheel(); - await expectDate('2000-01-01 00:45:00'); - }); -}); diff --git a/examples/Rn069/e2e/tests/modal.spec.js b/examples/Rn069/e2e/tests/modal.spec.js deleted file mode 100644 index 9233fc16..00000000 --- a/examples/Rn069/e2e/tests/modal.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -const {init} = require('../utils'); - -describe('Modal', () => { - beforeAll(async () => { - await init(); - await element(by.text('Modal')).tap(); - }); - - it('can open and close modal', async () => { - await element(by.id('openModal')).tap(); - await expect(element(by.id('day'))).toBeVisible(); - await expect(element(by.id('minutes'))).toBeVisible(); - await expect(element(by.id('hour'))).toBeVisible(); - await expect(element(by.id('ampm'))).toBeVisible(); - await expect(element(by.id('month'))).not.toExist(); - await expect(element(by.id('date'))).not.toExist(); - await expect(element(by.id('year'))).not.toExist(); - - await element(by.text('CONFIRM')).tap(); - await expect(element(by.id('day'))).not.toBeVisible(); - }); -}); diff --git a/examples/Rn069/e2e/tests/mode.spec.js b/examples/Rn069/e2e/tests/mode.spec.js deleted file mode 100644 index e3764c5c..00000000 --- a/examples/Rn069/e2e/tests/mode.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -const {setMode, init} = require('../utils'); - -describe('Modes', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - it('datetime', async () => { - await setMode('datetime'); - - await expect(element(by.id('day'))).toBeVisible(); - await expect(element(by.id('minutes'))).toBeVisible(); - await expect(element(by.id('hour'))).toBeVisible(); - await expect(element(by.id('ampm'))).toBeVisible(); - - await expect(element(by.id('month'))).toNotExist(); - await expect(element(by.id('date'))).toNotExist(); - await expect(element(by.id('year'))).toNotExist(); - }); - - it('date', async () => { - await setMode('date'); - - await expect(element(by.id('month'))).toBeVisible(); - await expect(element(by.id('date'))).toBeVisible(); - await expect(element(by.id('year'))).toBeVisible(); - - await expect(element(by.id('day'))).toNotExist(); - await expect(element(by.id('minutes'))).toNotExist(); - await expect(element(by.id('hour'))).toNotExist(); - await expect(element(by.id('ampm'))).toNotExist(); - }); - - it('time', async () => { - await setMode('time'); - - await expect(element(by.id('minutes'))).toBeVisible(); - await expect(element(by.id('hour'))).toBeVisible(); - await expect(element(by.id('ampm'))).toBeVisible(); - - await expect(element(by.id('day'))).toNotExist(); - await expect(element(by.id('month'))).toNotExist(); - await expect(element(by.id('date'))).toNotExist(); - await expect(element(by.id('year'))).toNotExist(); - }); -}); diff --git a/examples/Rn069/e2e/tests/scrollAround.spec.js b/examples/Rn069/e2e/tests/scrollAround.spec.js deleted file mode 100644 index dcb759f5..00000000 --- a/examples/Rn069/e2e/tests/scrollAround.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -const {scrollWheel, expectDate, init, reset} = require('../utils'); - -describe('Scroll around', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - }); - - beforeEach(async () => { - await reset(); - }); - - it.skip('Hour wheel should scroll all way around and switch AM/PM when passing 12', async () => { - await scroll3HoursAndExpect('2000-01-01 03:00:00'); - await scroll3HoursAndExpect('2000-01-01 06:00:00'); - await scroll3HoursAndExpect('2000-01-01 09:00:00'); - await scrollWheel(1, 2); - await expectDate('2000-01-01 11:00:00'); - await scrollWheel(1, 2); - await expectDate('2000-01-01 13:00:00'); - await scroll3HoursAndExpect('2000-01-01 16:00:00'); - await scroll3HoursAndExpect('2000-01-01 19:00:00'); - await scroll3HoursAndExpect('2000-01-01 22:00:00'); - await scroll3HoursAndExpect('2000-01-01 01:00:00'); - }); - - it('Minute wheel should be possible to scroll all way around', async () => { - await scrollWheel(2, 55); - await expectDate('2000-01-01 00:55:00'); - await scrollWheel(2, 10); - await expectDate('2000-01-01 00:05:00'); - }); - - it('Day wheel should change year when passing new year', async () => { - await scrollWheel(0, -1); - await expectDate('1999-12-31 00:00:00'); - await scrollWheel(0, 1); - await expectDate('2000-01-01 00:00:00'); - }); - - const scroll3HoursAndExpect = async date => { - await scrollWheel(1, 3); - await expectDate(date); - }; -}); diff --git a/examples/Rn069/e2e/tests/wheelOrder.spec.js b/examples/Rn069/e2e/tests/wheelOrder.spec.js deleted file mode 100644 index 2a0b709d..00000000 --- a/examples/Rn069/e2e/tests/wheelOrder.spec.js +++ /dev/null @@ -1,91 +0,0 @@ -const { - scrollWheelWithIndexAndExpectDate, - setMode, - setLocale, - setMaximumDate, - init, -} = require('../utils'); - -describe('Wheel order', () => { - beforeAll(async () => { - await init(); - await element(by.text('Advanced')).tap(); - await setMaximumDate('undefined'); - }); - - describe('datetime', () => { - beforeAll(async () => { - await setMode('datetime'); - }); - - it('US', async () => { - await setLocale('en-US'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-02 00:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-01 01:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-01 00:01:00'); - await scrollWheelWithIndexAndExpectDate(3, '2000-01-01 12:00:00'); - }); - - it('Korean', async () => { - await setLocale('ko-KR'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-02 00:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-01 12:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-01 01:00:00'); - await scrollWheelWithIndexAndExpectDate(3, '2000-01-01 00:01:00'); - }); - }); - - describe('date', () => { - beforeAll(async () => { - await setMode('date'); - }); - - it('US', async () => { - await setLocale('en-US'); - await scrollWheelWithIndexAndExpectDate(0, '2000-02-01 00:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-02 00:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2001-01-01 00:00:00'); - }); - - it('UK', async () => { - await setLocale('en-GB'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-02 00:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-02-01 00:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2001-01-01 00:00:00'); - }); - - it('Korean', async () => { - await setLocale('ko-KR'); - await scrollWheelWithIndexAndExpectDate(0, '2001-01-01 00:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-02-01 00:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-02 00:00:00'); - }); - }); - - describe('time', () => { - beforeAll(async () => { - await setMode('time'); - }); - - it('US', async () => { - await setLocale('en-US'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-01 01:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-01 00:01:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-01 12:00:00'); - }); - - it('UK', async () => { - await setLocale('en-GB'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-01 01:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-01 00:01:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-01 12:00:00'); - }); - - it('Korean', async () => { - await setLocale('ko-KR'); - await scrollWheelWithIndexAndExpectDate(0, '2000-01-01 12:00:00'); - await scrollWheelWithIndexAndExpectDate(1, '2000-01-01 01:00:00'); - await scrollWheelWithIndexAndExpectDate(2, '2000-01-01 00:01:00'); - }); - }); -}); diff --git a/examples/Rn069/e2e/utils.js b/examples/Rn069/e2e/utils.js deleted file mode 100644 index e354902c..00000000 --- a/examples/Rn069/e2e/utils.js +++ /dev/null @@ -1,53 +0,0 @@ -const expectDate = async date => { - await waitFor(element(by.id('dateOutput'))) - .toHaveText(date) - .withTimeout(10000); - await expect(element(by.id('dateOutput'))).toHaveText(date); -}; - -const expectDateString = async date => { - await expect(element(by.id('dateStringOutput'))).toHaveText(date); -}; - -const reset = async () => { - await element(by.id('props/scroll')).tap(); - await element(by.id('reset')).tap(); -}; - -const scrollWheel = async (index, times) => { - await element(by.id('props/scroll')).tap(); - await element(by.id('wheelIndex')).replaceText(`${index}`); - await element(by.id('scrollTimes')).replaceText(`${times}`); - await element(by.id('doScroll')).tap(); -}; - -const changeProp = name => async value => { - await element(by.id('propName')).replaceText(name); - await element(by.id('propValue')).replaceText(`${value}`); - await element(by.id('changeProp')).tap(); -}; - -const scrollWheelWithIndexAndExpectDate = async (index, expectedDate) => { - await scrollWheel(index, 1); - await expectDate(expectedDate); - await reset(); -}; - -const init = async () => { - await device.launchApp(); - await device.reloadReactNative(); -}; - -exports.setDate = changeProp('date'); -exports.setLocale = changeProp('locale'); -exports.setMinimumDate = changeProp('minimumDate'); -exports.setMaximumDate = changeProp('maximumDate'); -exports.setMinuteInterval = changeProp('minuteInterval'); -exports.setTimeZoneOffsetInMinutes = changeProp('timeZoneOffsetInMinutes'); -exports.setMode = changeProp('mode'); -exports.scrollWheel = scrollWheel; -exports.expectDate = expectDate; -exports.expectDateString = expectDateString; -exports.scrollWheelWithIndexAndExpectDate = scrollWheelWithIndexAndExpectDate; -exports.reset = reset; -exports.init = init; diff --git a/examples/detox/e2e/tests/24h-mode/hourWheel.spec.js b/examples/detox/e2e/tests/24h-mode/hourWheel.spec.js deleted file mode 100644 index a473227a..00000000 --- a/examples/detox/e2e/tests/24h-mode/hourWheel.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -const { scrollWheel, expectDate } = require('../../utils') - -describe('Hour wheel', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - it('should have 24 hours', async () => { - await scroll3HoursAndExpect('2000-01-01 03:00:00') - await scroll3HoursAndExpect('2000-01-01 06:00:00') - await scroll3HoursAndExpect('2000-01-01 09:00:00') - await scroll3HoursAndExpect('2000-01-01 12:00:00') - await scroll3HoursAndExpect('2000-01-01 15:00:00') - await scroll3HoursAndExpect('2000-01-01 18:00:00') - await scroll3HoursAndExpect('2000-01-01 21:00:00') - await scroll3HoursAndExpect('2000-01-01 00:00:00') - }) - - const scroll3HoursAndExpect = async date => { - await scrollWheel(1, 3) - await expectDate(date) - } -}) diff --git a/examples/detox/e2e/tests/24h-mode/mode.spec.js b/examples/detox/e2e/tests/24h-mode/mode.spec.js deleted file mode 100644 index 72296e96..00000000 --- a/examples/detox/e2e/tests/24h-mode/mode.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -const { setMode } = require('../../utils') - -describe('Modes - 24h', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - it('datetime', async () => { - await setMode('datetime') - - await expect(element(by.id('day'))).toBeVisible() - await expect(element(by.id('minutes'))).toBeVisible() - await expect(element(by.id('hour'))).toBeVisible() - - await expect(element(by.id('ampm'))).toNotExist() - await expect(element(by.id('month'))).toNotExist() - await expect(element(by.id('date'))).toNotExist() - await expect(element(by.id('year'))).toNotExist() - }) - - it('date', async () => { - await setMode('date') - - await expect(element(by.id('month'))).toBeVisible() - await expect(element(by.id('date'))).toBeVisible() - await expect(element(by.id('year'))).toBeVisible() - - await expect(element(by.id('day'))).toNotExist() - await expect(element(by.id('minutes'))).toNotExist() - await expect(element(by.id('hour'))).toNotExist() - await expect(element(by.id('ampm'))).toNotExist() - }) - - it('time', async () => { - await setMode('time') - - await expect(element(by.id('minutes'))).toBeVisible() - await expect(element(by.id('hour'))).toBeVisible() - - await expect(element(by.id('ampm'))).toNotExist() - await expect(element(by.id('day'))).toNotExist() - await expect(element(by.id('month'))).toNotExist() - await expect(element(by.id('date'))).toNotExist() - await expect(element(by.id('year'))).toNotExist() - }) -}) From e9d91b0ccc350231aa4332a9ebc4aa55e53a8ad4 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:52:50 +0200 Subject: [PATCH 11/18] revert --- .maestro/utils/swipe-wheel-1-down.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml index b4a63409..92a51418 100644 --- a/.maestro/utils/swipe-wheel-1-down.yml +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 35%, 40% - end: 35%, 32% + start: 35%, 32% + end: 35%, 40% From 2b3df91faaa337dc82465f97710ff2a0978c583e Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:53:27 +0200 Subject: [PATCH 12/18] rm device info --- examples/Rn071/yarn.lock | 5 ----- 1 file changed, 5 deletions(-) diff --git a/examples/Rn071/yarn.lock b/examples/Rn071/yarn.lock index 2b32a8be..39fc2b0c 100644 --- a/examples/Rn071/yarn.lock +++ b/examples/Rn071/yarn.lock @@ -5932,11 +5932,6 @@ react-native-codegen@^0.71.5: jscodeshift "^0.13.1" nullthrows "^1.1.1" -react-native-device-info@^10.13.1: - version "10.13.1" - resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-10.13.1.tgz#f87f44ba7b67933248be10ca302a4f2f6dbbdd4f" - integrity sha512-j/7Z+Yl9Cesjp8vKaVzbuJQKJSVs4ojXATt5WjwipZ0Ss0mBJjqtbc4x5dfZLmQ4y55VVa7c0v8KHca1iqY/TQ== - react-native-gradle-plugin@^0.71.18: version "0.71.19" resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.19.tgz#3379e28341fcd189bc1f4691cefc84c1a4d7d232" From 25bb9951186ecfce271ccaba60cc94a1810d6128 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:55:10 +0200 Subject: [PATCH 13/18] prints --- examples/Rn071/src/examples/Advanced.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/Rn071/src/examples/Advanced.js b/examples/Rn071/src/examples/Advanced.js index 385fb000..a71eadc5 100644 --- a/examples/Rn071/src/examples/Advanced.js +++ b/examples/Rn071/src/examples/Advanced.js @@ -107,9 +107,17 @@ export default class Advanced extends Component { text={'time mode'} /> - + + + + + ); From ae6446340e6909074c21f53b27f1104d3257c23b Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 14:56:26 +0200 Subject: [PATCH 14/18] restore --- .maestro/utils/swipe-wheel-1-down.yml | 4 ++-- .maestro/utils/swipe-wheel-1-up.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.maestro/utils/swipe-wheel-1-down.yml b/.maestro/utils/swipe-wheel-1-down.yml index 92a51418..b4a63409 100644 --- a/.maestro/utils/swipe-wheel-1-down.yml +++ b/.maestro/utils/swipe-wheel-1-down.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 35%, 32% - end: 35%, 40% + start: 35%, 40% + end: 35%, 32% diff --git a/.maestro/utils/swipe-wheel-1-up.yml b/.maestro/utils/swipe-wheel-1-up.yml index b4a63409..92a51418 100644 --- a/.maestro/utils/swipe-wheel-1-up.yml +++ b/.maestro/utils/swipe-wheel-1-up.yml @@ -1,5 +1,5 @@ appId: com.rn071 --- - swipe: - start: 35%, 40% - end: 35%, 32% + start: 35%, 32% + end: 35%, 40% From a9cf4df2150d8770aa238b2bb540d4dccf77830e Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 15:03:38 +0200 Subject: [PATCH 15/18] chore: move modal tests from detox to maestro --- .maestro/modal.yml | 13 +++++++++++++ examples/detox/e2e/tests/modal.spec.js | 20 -------------------- 2 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 .maestro/modal.yml delete mode 100644 examples/detox/e2e/tests/modal.spec.js diff --git a/.maestro/modal.yml b/.maestro/modal.yml new file mode 100644 index 00000000..f0b7f7d7 --- /dev/null +++ b/.maestro/modal.yml @@ -0,0 +1,13 @@ +appId: com.rn071 +tags: + - modal +--- +# test: can use modal + +- launchApp +- tapOn: Modal +- tapOn: Select date +- runFlow: utils/swipe-wheel-1.yml +- tapOn: Confirm +- assertVisible: + text: '2000-01-02' diff --git a/examples/detox/e2e/tests/modal.spec.js b/examples/detox/e2e/tests/modal.spec.js deleted file mode 100644 index fd27a195..00000000 --- a/examples/detox/e2e/tests/modal.spec.js +++ /dev/null @@ -1,20 +0,0 @@ -describe('Modal', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Modal')).tap() - }) - - it('can open and close modal', async () => { - await element(by.id('openModal')).tap() - await expect(element(by.id('day'))).toBeVisible() - await expect(element(by.id('minutes'))).toBeVisible() - await expect(element(by.id('hour'))).toBeVisible() - await expect(element(by.id('ampm'))).toBeVisible() - await expect(element(by.id('month'))).not.toExist() - await expect(element(by.id('date'))).not.toExist() - await expect(element(by.id('year'))).not.toExist() - - await element(by.text('CONFIRM')).tap() - await expect(element(by.id('day'))).not.toBeVisible() - }) -}) From cea634ebd90699f8ae83bf7329f5d0d1eae5ce04 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 15:11:17 +0200 Subject: [PATCH 16/18] minute interval --- .maestro/modal.yml | 13 ------------- .maestro/other.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 13 deletions(-) delete mode 100644 .maestro/modal.yml create mode 100644 .maestro/other.yml diff --git a/.maestro/modal.yml b/.maestro/modal.yml deleted file mode 100644 index f0b7f7d7..00000000 --- a/.maestro/modal.yml +++ /dev/null @@ -1,13 +0,0 @@ -appId: com.rn071 -tags: - - modal ---- -# test: can use modal - -- launchApp -- tapOn: Modal -- tapOn: Select date -- runFlow: utils/swipe-wheel-1.yml -- tapOn: Confirm -- assertVisible: - text: '2000-01-02' diff --git a/.maestro/other.yml b/.maestro/other.yml new file mode 100644 index 00000000..f05604b1 --- /dev/null +++ b/.maestro/other.yml @@ -0,0 +1,35 @@ +appId: com.rn071 +tags: + - modal + - minuteInterval +--- +# test: can use modal + +- launchApp +- tapOn: Modal +- tapOn: Select date +- runFlow: utils/swipe-wheel-1.yml +- tapOn: Confirm +- assertVisible: '2000-01-02' + +# test: minuteInterval + +- runFlow: utils/launch.yml + +# 1min +- tapOn: 1min interval +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2000-01-01 00:01:00' +- tapOn: reset date + +# 5min +- tapOn: 5min interval +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2000-01-01 00:05:00' +- tapOn: reset date + +# 15min +- tapOn: 15min interval +- runFlow: utils/swipe-wheel-3.yml +- assertVisible: '2000-01-01 00:15:00' +- tapOn: reset date From b07e6a8ea1f491fe67e5de4d788055f4b2e5d699 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 15:14:07 +0200 Subject: [PATCH 17/18] rm --- .../detox/e2e/tests/minuteInterval.spec.js | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 examples/detox/e2e/tests/minuteInterval.spec.js diff --git a/examples/detox/e2e/tests/minuteInterval.spec.js b/examples/detox/e2e/tests/minuteInterval.spec.js deleted file mode 100644 index 506cb224..00000000 --- a/examples/detox/e2e/tests/minuteInterval.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const { scrollWheel, expectDate, setMinuteInterval } = require('../utils') - -const scrollMinuteWheel = () => scrollWheel(2, 1) - -describe('Minute interval', () => { - before(async () => { - await device.reloadReactNative() - await element(by.text('Advanced')).tap() - }) - - it('1 minute (default)', async () => { - await setMinuteInterval(1) - await scrollMinuteWheel() - await expectDate('2000-01-01 00:01:00') - }) - - it('5 minutes', async () => { - await setMinuteInterval(5) - await scrollMinuteWheel() - await expectDate('2000-01-01 00:05:00') - }) - - it('15 minutes', async () => { - await setMinuteInterval(15) - await scrollMinuteWheel() - await expectDate('2000-01-01 00:15:00') - await scrollMinuteWheel() - await expectDate('2000-01-01 00:30:00') - await scrollMinuteWheel() - await expectDate('2000-01-01 00:45:00') - }) -}) From 265490c82846871fe204e4b5f96337bc12fae8fb Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Fri, 19 Apr 2024 15:14:13 +0200 Subject: [PATCH 18/18] buttons --- examples/Rn071/src/examples/Advanced.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/Rn071/src/examples/Advanced.js b/examples/Rn071/src/examples/Advanced.js index a71eadc5..ead80d63 100644 --- a/examples/Rn071/src/examples/Advanced.js +++ b/examples/Rn071/src/examples/Advanced.js @@ -106,6 +106,18 @@ export default class Advanced extends Component { onPress={() => this.setState({mode: 'time'})} text={'time mode'} /> + this.setState({minuteInterval: 1})} + text={'1min interval'} + /> + this.setState({minuteInterval: 5})} + text={'5min interval'} + /> + this.setState({minuteInterval: 15})} + text={'15min interval'} + />