Skip to content

Commit

Permalink
fix: Fix the 'mobile: backgroundApp' functionality (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jun 23, 2023
1 parent 4748db0 commit 9025248
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: Functional Tests

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- chromedriverVersion: "113.0.5672.63"
Expand Down
18 changes: 18 additions & 0 deletions lib/commands/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ commands.mobilePressKey = async function mobilePressKey (opts = {}) {
});
};

/**
* @typedef {Object} BackgroundAppOptions
* @property {number?} seconds The amount of seconds to wait between putting the app to background and restoring it.
* Any negative value means to not restore the app after putting it to the background (the default behavior).
*/

/**
* Puts the app under test to the background
* and then restores it (if needed). The call is blocking is the
* app needs to be restored afterwards.
*
* @param {BackgroundAppOptions} opts
*/
commands.mobileBackgroundApp = async function mobileBackgroundApp (opts = {}) {
const {seconds = -1} = opts;
return await this.background(seconds);
};

commands.mobileGetDeviceInfo = async function mobileGetDeviceInfo () {
return await this.espresso.jwproxy.command('/appium/device/info', 'GET');
};
Expand Down

0 comments on commit 9025248

Please sign in to comment.