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 all 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
37 changes: 19 additions & 18 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ jobs:
setup:
runs-on: macos-latest
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 @@ -28,16 +28,16 @@ jobs:
runs-on: macos-latest
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 @@ -49,16 +49,16 @@ jobs:
runs-on: macos-latest
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 @@ -68,16 +68,16 @@ jobs:
runs-on: macos-latest
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 @@ -105,16 +105,16 @@ jobs:
runs-on: macos-latest
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,17 +144,18 @@ 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'

- run: yarn add [email protected] -D
- run: yarn e2e:build:android:release
- run: yarn e2e:test:android:release

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.20.0
18.19.0
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