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:
Isaac A. Murchie
2019-04-23 12:58:42 -04:00
committed by GitHub
parent 6e4a0e6480
commit 4ccc8665f8
12 changed files with 395 additions and 149 deletions

View File

@@ -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 () {