Skip to content

Commit

Permalink
Chore/harness e2e tests (#176)
Browse files Browse the repository at this point in the history
* chore: add row tests

* chore: add list tests

* fix: add fullReset in automation for app to be reinstalled

* chore: update row tests and organize tests

* chore: update row tests and organize tests

* chore: minor updates

* chore: add NF1, PF1, SF1 tests

* chore: add grid tests

* chore: add DR1 e2e test

* chore: integrate G1 into e2e flow

* chore: gha workflowrefactor

* chore: more tests to gha

* fix: add missing app name in build script

* chore: enable harness tvos and atv tests

* chore: add continue on error to gha

* fix tests

* change e2e timeout

* remove continue on error gha

* chore: improve logic on e2e gha

* test1

* test2

* test3

* chore: gha e2e cleanup

* chore: G1 e2e test cleanup

* chore: skip list tests on tvos in gha

* chore: e2e test cleanup

* chore: renaming test

* chore: optimize row and grid tests

* chore: add RFB1 tests

* chore: 1 more tst in RFB1 spec

* chore: add go back test in RFB1

---------

Co-authored-by: GabrieleKaceviciute <gabriele.kaceviciute@flexn.io>
Co-authored-by: pauliusguzas <paulius.guzas@flexn.io>
  • Loading branch information
3 people committed Sep 29, 2023
1 parent 51d43af commit 6b9afb0
Show file tree
Hide file tree
Showing 29 changed files with 753 additions and 93 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/e2e-harness-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App Android
- name: Build
run: |
yarn e2e-harness-android
cd packages/app-harness && yarn build:android-test
- name: E2E
run: |
cd packages/app-harness && yarn e2e:android
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
59 changes: 48 additions & 11 deletions .github/workflows/e2e-harness-androidtv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ defaults:
shell: zsh -l {0}
on:
workflow_dispatch:
# push:
# branches:
# - main
# - 'release/**'
# paths-ignore:
# - 'docs/**'
# - '**/README.md'
# pull_request:
# types: [labeled]
push:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- '**/README.md'
pull_request:
types: [labeled]

jobs:
e2e-harness-androidtv:
Expand All @@ -27,9 +27,46 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App AndroidTV
- name: Build
id: build
run: |
yarn e2e-harness-androidtv
cd packages/app-harness && yarn build:androidtv-test
- name: E2E Dynamic Rows
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/DR1.cjs
- name: E2E Grid
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/G1.cjs
- name: E2E List
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/L1.cjs
- name: E2E Next Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/NF1.cjs
- name: E2E Prefered Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/PF1.cjs
- name: E2E Row
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/R1.cjs
- name: E2E Remote Handler
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/RH1.cjs
- name: E2E Set Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/SF1.cjs
- name: E2E Row on focus blur
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:androidtv --spec ./test/specs/RFB1.cjs
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-harness-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App iOS
- name: Build
run: |
yarn e2e-harness-ios
cd packages/app-harness && yarn build:ios-test
- name: E2E
run: |
cd packages/app-harness && yarn e2e:ios
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-harness-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App macOS
- name: Build
run: |
yarn e2e-harness-macos
cd packages/app-harness && yarn build:macos-test
- name: E2E
run: |
cd packages/app-harness && yarn e2e:macos
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
61 changes: 50 additions & 11 deletions .github/workflows/e2e-harness-tvos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ defaults:
shell: zsh -l {0}
on:
workflow_dispatch:
# push:
# branches:
# - main
# - 'release/**'
# paths-ignore:
# - 'docs/**'
# - '**/README.md'
# pull_request:
# types: [labeled]
push:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- '**/README.md'
pull_request:
types: [labeled]

jobs:
e2e-harness-tvos:
Expand All @@ -28,9 +28,48 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App tvOS
- name: Build
id: build
run: |
yarn e2e-harness-tvos
cd packages/app-harness && yarn build:tvos-test
- name: E2E Dynamic Rows
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/DR1.cjs
- name: E2E Grid
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/G1.cjs
# skipped because on tvos list tests take 12 minutes
# - name: E2E List
# if: (success() || failure()) && steps.build.outcome == 'success'
# run: |
# cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/L1.cjs
- name: E2E Next Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/NF1.cjs
- name: E2E Prefered Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/PF1.cjs
- name: E2E Row
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/R1.cjs
- name: E2E Remote Handler
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/RH1.cjs
- name: E2E Set Focus
if: (success() || failure()) && steps.build.outcome == 'success'
run: |
cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/SF1.cjs
# skipped because on tvos Row on focus blur tests take 10 minutes
# - name: E2E Row on focus blur
# if: (success() || failure()) && steps.build.outcome == 'success'
# run: |
# cd packages/app-harness && yarn e2e:tvos --spec ./test/specs/RFB1.cjs
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-harness-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Harness App Web
- name: Host
run: |
yarn e2e-harness-web
cd packages/app-harness && yarn start:web-test & sleep 60
- name: E2E
run: |
cd packages/app-harness && yarn e2e:web && kill $(lsof -t -i:8080)
# Commented because e2e tests would fail due to harness builds not working and minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App Android
- name: Build
run: |
yarn e2e-template-android
cd packages/template-starter && yarn build:android-test
- name: E2E
run: |
cd packages/template-starter && yarn e2e:android
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-androidtv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App AndroidTV
- name: Build
run: |
yarn e2e-template-androidtv
cd packages/template-starter && yarn build:androidtv-test
- name: E2E
run: |
cd packages/template-starter && yarn e2e:androidtv
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App iOS
- name: Build
run: |
yarn e2e-template-ios
cd packages/template-starter && yarn build:ios-test
- name: E2E
run: |
cd packages/template-starter && yarn e2e:ios
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App macOS
- name: Build
run: |
yarn e2e-template-macos
cd packages/template-starter && yarn build:macos-test
- name: E2E
run: |
cd packages/template-starter && yarn e2e:macos
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-tvos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App tvOS
- name: Build
run: |
yarn e2e-template-tvos
cd packages/template-starter && yarn build:tvos-test
- name: E2E
run: |
cd packages/template-starter && yarn e2e:tvos
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/e2e-template-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Bootstrap
run: |
yarn bootstrap-clean
- name: E2E Template App Web
- name: Host
run: |
yarn e2e-template-web
cd packages/template-starter && yarn start:web-test & sleep 60
- name: E2E
run: |
cd packages/template-starter && yarn e2e:web && kill $(lsof -t -i:8080)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
12 changes: 0 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@
"deploy-template-firetv-canary": "cd packages/template-starter && npx rnv build -p firetv -s canary -c template --packageManager yarn --ci && yarn deploy:firetv-canary",
"deploy-template-web": "cd packages/template-starter && npx rnv export -p web -s production -c template --packageManager yarn --ci && yarn deploy:web-prod",
"deploy-template-web-canary": "cd packages/template-starter && npx rnv export -p web -s canary -c template --packageManager yarn --ci && yarn deploy:web-canary",
"e2e-harness-ios": "cd packages/app-harness && npx rnv build -p ios -s test --packageManager yarn --ci && yarn e2e:ios",
"e2e-harness-android": "cd packages/app-harness && npx rnv build -p android -s test --packageManager yarn --ci && yarn e2e:android",
"e2e-harness-tvos": "cd packages/app-harness && npx rnv build -p tvos -s test --packageManager yarn --ci && yarn e2e:tvos",
"e2e-harness-androidtv": "cd packages/app-harness && npx rnv build -p androidtv -s test --packageManager yarn --ci && yarn e2e:androidtv",
"e2e-harness-macos": "cd packages/app-harness && npx rnv build -p macos -s test --packageManager yarn --ci && yarn e2e:macos",
"e2e-harness-web": "cd packages/app-harness && npx rnv start -p web -s test --packageManager yarn --ci & sleep 60 && cd packages/app-harness && yarn e2e:web && kill $(lsof -t -i:8080)",
"e2e-template-ios": "cd packages/template-starter && npx rnv build -p ios -s test -c template --packageManager yarn --ci && yarn e2e:ios",
"e2e-template-android": "cd packages/template-starter && npx rnv build -p android -s test -c template --packageManager yarn --ci && yarn e2e:android",
"e2e-template-tvos": "cd packages/template-starter && npx rnv build -p tvos -s test -c template --packageManager yarn --ci && yarn e2e:tvos",
"e2e-template-androidtv": "cd packages/template-starter && npx rnv build -p androidtv -s test -c template --packageManager yarn --ci && yarn e2e:androidtv",
"e2e-template-macos": "cd packages/template-starter && npx rnv build -p macos -s test -c template --packageManager yarn --ci && yarn e2e:macos",
"e2e-template-web": "cd packages/template-starter && npx rnv start -p web -s test -c template --packageManager yarn --ci & sleep 60 && cd packages/template-starter && yarn e2e:web && kill $(lsof -t -i:8080)",
"prepare-harness-nightly": "cd packages/app-harness && npx rnv hooks run -x prepareNightlyBuild --only",
"prepare-template-nightly": "cd packages/template-starter && npx rnv hooks run -x prepareNightlyBuild -c template --only",
"clean-harness-post-nightly": "cd packages/app-harness && npx rnv hooks run -x cleanupPostNightly --only",
Expand Down
7 changes: 6 additions & 1 deletion packages/app-harness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
"deploy:tvos-prod": "npx rnv deploy -p tvos -s production --only --hooks",
"deploy:web-alpha": "npx rnv deploy -p web -s canary --only --hooks",
"deploy:web-prod": "npx rnv deploy -p web -s production --only --hooks",
"e2e:all": "yarn e2e:ios ; yarn e2e:tvos ; yarn e2e:android ; yarn e2e:androidtv ; yarn e2e:macos ; yarn e2e:web",
"build:ios-test": "npx rnv build -p ios -s test --packageManager yarn --ci",
"build:android-test": "npx rnv build -p android -s test --packageManager yarn --ci",
"build:tvos-test": "npx rnv build -p tvos -s test --packageManager yarn --ci",
"build:androidtv-test": "npx rnv build -p androidtv -s test --packageManager yarn --ci",
"build:macos-test": "npx rnv build -p macos -s test --packageManager yarn --ci",
"start:web-test": "npx rnv start -p web -s test --packageManager yarn --ci",
"e2e:android": "APPIUM_HOME=./ PLATFORM=android JAVA_HOME=$(/usr/libexec/java_home) npx wdio wdio.conf.cjs",
"e2e:androidtv": "APPIUM_HOME=./ PLATFORM=androidtv JAVA_HOME=$(/usr/libexec/java_home) npx wdio wdio.conf.cjs",
"e2e:ios": "APPIUM_HOME=./ PLATFORM=ios npx wdio wdio.conf.cjs",
Expand Down
9 changes: 6 additions & 3 deletions packages/app-harness/src/screens/tests/dynamicRows.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useState } from 'react';
import { StyleSheet } from 'react-native';
import { View, FlashList, Pressable, Image, CreateListRenderItemInfo } from '@flexn/create';
import { View, FlashList, Image, CreateListRenderItemInfo } from '@flexn/create';
import type { NavigationProps } from '../../navigation';
import Screen from './../screen';
import { Ratio } from '../../utils';
import Pressable from '../../components/Pressable';

const kittyNames = ['Abby', 'Angel', 'Annie', 'Baby', 'Bailey', 'Bandit'];

Expand All @@ -28,7 +29,7 @@ const DynamicRows = ({ route }: NavigationProps) => {
const [data] = useState(generateData(200, 200, 5));
const [data2, setData2] = useState(generateData(200, 200, 5));

const rowRenderer = ({ item, focusRepeatContext }: CreateListRenderItemInfo<any>) => {
const rowRenderer = ({ item, focusRepeatContext, index }: CreateListRenderItemInfo<any>) => {
return (
<Pressable
style={styles.packshot}
Expand All @@ -45,13 +46,14 @@ const DynamicRows = ({ route }: NavigationProps) => {
onPress={() => {
setData2(generateData(interval(201, 210), interval(201, 210), interval(5, 10)));
}}
testID={`DR1-0-${index}`}
>
<Image source={{ uri: item.backgroundImage }} style={styles.image} />
</Pressable>
);
};

const rowRenderer2 = ({ item, focusRepeatContext }: CreateListRenderItemInfo<any>) => {
const rowRenderer2 = ({ item, focusRepeatContext, index }: CreateListRenderItemInfo<any>) => {
return (
<Pressable
style={styles.packshot}
Expand All @@ -65,6 +67,7 @@ const DynamicRows = ({ route }: NavigationProps) => {
},
},
}}
testID={`DR1-1-${index}`}
>
<Image source={{ uri: item.backgroundImage }} style={styles.image} />
</Pressable>
Expand Down
2 changes: 1 addition & 1 deletion packages/app-harness/src/screens/tests/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function generateData(width: number, height: number, items = 30) {
}

const Grid = ({ route }: NavigationProps) => {
const [data] = useState(generateData(200, 200, 200));
const [data] = useState(generateData(200, 200, 75));

const rowRenderer = ({ item, focusRepeatContext, index }: CreateListRenderItemInfo<any>) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/app-harness/src/screens/tests/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function generateData(width: number, height: number, items = 30) {
}

const Row = ({ route }: NavigationProps) => {
const [data] = useState(generateData(200, 200, 500));
const [data] = useState(generateData(200, 200, 20));

const rowRenderer = ({ item, focusRepeatContext, index }: CreateListRenderItemInfo<any>) => {
return (
Expand Down

0 comments on commit 6b9afb0

Please sign in to comment.