Skip to content

Commit

Permalink
feat: add android video and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
wswebcreation committed Jan 8, 2024
1 parent c66b7c8 commit 2426299
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/e2e-android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ jobs:

- name: Save server output
if: ${{ always() }}
uses: actions/upload-artifact@master
# uses: actions/upload-artifact@master
# with:
# name: appium-api
# path: appium.log
uses: actions/upload-artifact@v4
with:
name: appium-api
path: appium.log
name: android-runner-output
path: |
logs/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ apps/
*.log
chromeDriver
.tmp
*.mp4
12 changes: 11 additions & 1 deletion config/wdio.android.app.conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'node:path';
import { writeFileSync } from 'node:fs';
import { config as baseConfig } from './wdio.shared.local.appium.conf.js';

export const config: WebdriverIO.Config = {
Expand Down Expand Up @@ -44,5 +45,14 @@ export const config: WebdriverIO.Config = {
'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
'appium:newCommandTimeout': 240,
},
]
],
beforeSuite: async () =>{
await driver.execute('mobile: startMediaProjectionRecording');
},
afterSuite: async (suite) => {
const fileName = suite.file.split('/').pop()?.replace('.spec.ts', '');
let recordingAsBase64Str = await driver.execute('mobile: stopMediaProjectionRecording') as string;
let videoBinary = Buffer.from(recordingAsBase64Str, 'base64');
writeFileSync(`./logs/${fileName}.mp4`, videoBinary);
}
};
1 change: 1 addition & 0 deletions config/wdio.shared.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const config: Options.Testrunner = {
//
// Level of logging verbosity: trace | debug | info | warn | error | silent
logLevel: 'debug',
outputDir: './logs',
// Set specific log levels per logger
// loggers:
// - webdriver, webdriverio
Expand Down
2 changes: 1 addition & 1 deletion config/wdio.shared.local.appium.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const config: WebdriverIO.Config = {
// and to automatically download the latest version of ChromeDriver
relaxedSecurity: true,
// Write the Appium logs to a file in the root of the directory
log: './appium.log',
log: './logs/appium.log',
},
},
],
Expand Down

0 comments on commit 2426299

Please sign in to comment.