mirror of
https://github.com/appium/appium.git
synced 2026-01-21 09:39:52 -06:00
Begin running sample code in CI (#12519)
* Make stage in Travis to run wd sample code * Clean up wd sample code for Sauce runs * Restrict to master/non-PR builds
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import wd from 'wd';
|
||||
import chai from 'chai';
|
||||
import { androidCaps, serverConfig } from '../helpers/caps';
|
||||
import {
|
||||
androidCaps, serverConfig, androidApiDemos,
|
||||
SAUCE_TESTING, SAUCE_USERNAME, SAUCE_ACCESS_KEY
|
||||
} from '../helpers/config';
|
||||
const {assert} = chai;
|
||||
|
||||
|
||||
@@ -10,21 +13,43 @@ const ALERT_DIALOG_ACTIVITY = '.app.AlertDialogSamples';
|
||||
|
||||
describe('Basic Android interactions', function () {
|
||||
let driver;
|
||||
let allPassed = true;
|
||||
|
||||
before(async function () {
|
||||
// Connect to Appium server
|
||||
driver = await wd.promiseChainRemote(serverConfig);
|
||||
driver = SAUCE_TESTING
|
||||
? await wd.promiseChainRemote(serverConfig)
|
||||
: await wd.promiseChainRemote(serverConfig, SAUCE_USERNAME, SAUCE_ACCESS_KEY);
|
||||
|
||||
// Start the session
|
||||
await driver.init({
|
||||
// add the name to the desired capabilities
|
||||
const sauceCaps = SAUCE_TESTING
|
||||
? {
|
||||
name: 'Android Basic Interactions Test',
|
||||
}
|
||||
: {};
|
||||
|
||||
// merge all the capabilities
|
||||
const caps = {
|
||||
...androidCaps,
|
||||
app: require('../helpers/apps').androidApiDemos,
|
||||
...sauceCaps,
|
||||
app: androidApiDemos,
|
||||
appActivity: SEARCH_ACTIVITY, // Android-specific capability. Can open a specific activity.
|
||||
});
|
||||
};
|
||||
|
||||
// Start the session, merging all the caps
|
||||
await driver.init(caps);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
// keep track of whether all the tests have passed, since mocha does not do this
|
||||
allPassed = allPassed && (this.currentTest.state === 'passed');
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await driver.quit();
|
||||
if (SAUCE_TESTING && driver) {
|
||||
await driver.sauceJobStatus(allPassed);
|
||||
}
|
||||
});
|
||||
|
||||
it('should send keys to search box and then check the value', async function () {
|
||||
|
||||
Reference in New Issue
Block a user