Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e test rework #173

Merged
merged 18 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .detoxrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"testRunner": {
"$0": "jest",
"args": {
"config": "e2e/jest.config.js"
"config": "e2e/jest.config.ts"
}
},
"apps": {
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
e2e
lib
example/dist
46 changes: 23 additions & 23 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ on:

jobs:
setup:
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
node_modules
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- run: yarn bootstrap

lint:
runs-on: macos-latest
runs-on: macos-13
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
node_modules
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -46,38 +46,38 @@ jobs:
- run: yarn typescript

test:
runs-on: macos-latest
runs-on: macos-13
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
node_modules
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn test

ios:
runs-on: macos-latest
runs-on: macos-13
needs: [lint, test]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
node_modules
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache-2
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
example/ios/build
Expand All @@ -91,7 +91,7 @@ jobs:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -102,19 +102,19 @@ jobs:
- run: yarn e2e:test:ios:release

android:
runs-on: macos-latest
runs-on: macos-13
needs: [lint, test]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
node_modules
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache-2
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
android/build
Expand Down Expand Up @@ -144,13 +144,13 @@ jobs:
$ANDROID_HOME/platform-tools/adb devices
echo "emulator started"

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: gradle

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
57 changes: 0 additions & 57 deletions e2e/advancedPlayer.e2e.js

This file was deleted.

55 changes: 55 additions & 0 deletions e2e/basicProps.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-env detox/detox, jest/globals */
import {
afterAllTestPlan,
beforeAllTestPlan,
waitForClearLogs,
waitForTestPlan,
waitForLogLabel,
waitForTap,
} from './testPlan';

describe('Basic Props', () => {
beforeAll(beforeAllTestPlan);
afterAll(afterAllTestPlan);

it('paused controls playback state', async () => {
await waitForTestPlan(`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a future pass, maybe something like a fluent DSL would be useful here. We could likely achieve similar readability, without the need to parse. Would also make it simpler to extend for more nuanced cases.

inputs:
- paused: true
events:
- onPlayerStateChange
`);
await waitForTap(by.id('paused'));
await waitForLogLabel('onPlayerStateChange ::: Playing');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a similar way, a DSL around validating outputs could also be useful. I think having separate test setup, execution and validation snippets can be useful, which I think it where this is going.

Ideally we're not verifying directly via logs, but collected output with post-execution validation (along with a more defined interface for the collected output) could work well.

});

it('paused controls playback state', async () => {
await waitForTestPlan(`
inputs:
- paused: false
events:
- onPlayerStateChange
`);
await waitForLogLabel('onPlayerStateChange ::: Playing');
await waitForTap(by.id('paused'));
await waitForLogLabel('onPlayerStateChange ::: Idle');
});

it('autoMaxQuality controls highest quality picked on auto', async () => {
await waitForTestPlan(`
inputs:
- autoMaxQuality
events:
- onQualityChange
`);
await waitForLogLabel('onQualityChange ::: name ::: 720p', 24);
await waitForClearLogs();
// bump down
await waitForTap(by.id('autoMaxQuality:480p'));
await waitForLogLabel('onQualityChange ::: name ::: 480p', 24);
await waitForClearLogs();
// back to max
await waitForTap(by.id('autoMaxQuality:720p'));
await waitForLogLabel('onQualityChange ::: name ::: 720p', 24);
});
});
Loading
Loading