Skip to content

Commit

Permalink
ci: starting with android ci e2e tests (#139)
Browse files Browse the repository at this point in the history
* fix: removing leading whitespace from ruby version file
* ci: fixing e2e testing scripts for android / ios
* ci: starting with android ci e2e tests
  • Loading branch information
dawhitla authored Jun 15, 2023
1 parent a2104aa commit a83fdb7
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 272 deletions.
21 changes: 7 additions & 14 deletions .detoxrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,13 @@
}
},
"devices": {
"simulator": {
"ios": {
"type": "ios.simulator",
"device": {
"type": "iPhone 11"
"type": "iPhone 14"
}
},
"emulator": {
"type": "android.emulator",
"device": {
"avdName": "Pixel_3a_API_30_x86"
},
"utilBinaryPaths": ["./test-butler-app.apk"]
},
"ci-emulator": {
"android": {
"type": "android.emulator",
"device": {
"avdName": "TestingAVD"
Expand All @@ -51,19 +44,19 @@
},
"configurations": {
"ios": {
"device": "simulator",
"device": "ios",
"app": "ios.debug"
},
"ios.sim.release": {
"device": "simulator",
"device": "ios",
"app": "ios.release"
},
"android": {
"device": "emulator",
"device": "android",
"app": "android.debug"
},
"android.emu.release": {
"device": "ci-emulator",
"device": "android",
"app": "android.release"
}
}
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PR checks

on:
workflow_dispatch:
pull_request:
branches:
- main

jobs:
android:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: yarn
run: yarn

- name: e2e:build:android:release
run: yarn e2e:build:android:release

- name: get device name
id: device
run: node -e "console.log('AVD_NAME=' + require('./.detoxrc').devices.android.device.avdName)" >> $GITHUB_OUTPUT

- name: get android device image
run: |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-31;x86"
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd --force --name emu --device "${{ steps.device.outputs.AVD_NAME }}" -k 'system-images;android-31;x86'
$ANDROID_HOME/emulator/emulator -list-avds
- name: start android device
timeout-minutes: 10
continue-on-error: true
run: |
echo "starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd emu -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb devices
echo "emulator started"
- name: e2e:test:android:release
run: yarn e2e:test:android:release



1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.0
1 change: 0 additions & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

2.7.5
2 changes: 0 additions & 2 deletions e2e/advancedPlayer.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import { expectNativePlayerToBeVisible, togglePlayPauseVideo } from './utils';

jest.retryTimes(3);

describe('Advanced player', () => {
beforeAll(async () => {
await device.launchApp();
Expand Down
208 changes: 202 additions & 6 deletions e2e/playgroundPlayer.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ import {
atLeastOneLogIsVisible,
navigateToPlayground,
togglePlayPauseVideo,
scrollToModalBottom,
TIMEOUT,
} from './utils';

const TIMEOUT = 300000;

jest.setTimeout(1200000);

jest.retryTimes(3);

describe('Playground player', () => {
beforeAll(async () => {
await device.launchApp();
Expand Down Expand Up @@ -95,4 +91,204 @@ describe('Playground player', () => {
.not.toHaveText('live')
.withTimeout(TIMEOUT);
});

it("Player doesn't crash after setting auto quality", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await element(by.text('720P').withAncestor(by.id('qualitiesPicker'))).tap();
await element(by.text('AUTO').withAncestor(by.id('qualitiesPicker'))).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing muted property", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('muted')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing autoplay property", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('autoplay')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing paused property", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('paused')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing liveLowLatency property", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('liveLowLatency')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing autoQuality property", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('autoQuality')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing log level", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.text('DEBUG').withAncestor(by.id('logLevelPicker'))).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing autoMaxQuality", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(
by.text('720P').withAncestor(by.id('autoMaxQualityPicker'))
).tap();
await element(
by.text('AUTO').withAncestor(by.id('autoMaxQualityPicker'))
).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing playback rate", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
// await scrollToModalBottom();
await element(by.id('playbackRate')).replaceText('2');
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing progress interval", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('progressInterval')).replaceText('1');
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing volume", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('volume')).replaceText('0.5');
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing initialBufferDuration", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom()
await element(by.id('initialBufferDuration')).replaceText('4.0');
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});

it("Player doesn't crash after changing pauseInBackground", async () => {
await expectNativePlayerToBeVisible();
await togglePlayPauseVideo();

await waitFor(element(by.id('settingsIcon')))
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await element(by.id('pauseInBackground')).tap();
await element(by.id('closeIcon')).tap();

await expectNativePlayerToBeVisible(); // Not a crash
});
});
Loading

0 comments on commit a83fdb7

Please sign in to comment.