Revert "Create session and basic interactions samples (#9907)" (#9915)

This reverts commit 061e264800.
This commit is contained in:
Dan Graham
2018-01-04 13:52:30 -08:00
committed by GitHub
parent 061e264800
commit 36cc935fc5
21 changed files with 1 additions and 281 deletions

View File

@@ -1,35 +0,0 @@
import wd from 'wd';
import chai from 'chai';
import { iosCaps, androidCaps, serverConfig } from '../helpers/caps';
const {assert} = chai;
describe('Create Android session', function () {
it('should create and destroy Android sessions', async function () {
// Connect to Appium server
const driver = await wd.promiseChainRemote(serverConfig);
// We haven't started a session yet, so we shouldn't see any sessions running
assert.equal((await driver.sessions()).length, 0);
// Start the session
await driver.init({
...androidCaps,
app: require('../helpers/apps').androidApiDemos
});
// Now that session is running, check that 'sessions' length is one
assert.equal((await driver.sessions()).length, 1);
// Check that we're running the ApiDemos app by checking package and activity
const activity = await driver.getCurrentActivity();
const pkg = await driver.getCurrentPackage();
assert.equal(`${pkg}${activity}`, 'io.appium.android.apis.ApiDemos');
// Quit the session
await driver.quit();
// Session is closed, so we should be back to having no sessions
assert.equal((await driver.sessions()).length, 0);
});
});

View File

@@ -1,28 +0,0 @@
import wd from 'wd';
import chai from 'chai';
import { androidCaps, serverConfig } from '../helpers/caps';
const {assert} = chai;
describe('Create Chrome web session', function () {
it('should create and destroy Android browser session', async function () {
// Connect to Appium server
const driver = await wd.promiseChainRemote(serverConfig);
// Start the session
await driver.init({
...androidCaps,
browserName: 'Chrome'
});
// Navigate to google.com
await driver.get('https://www.google.com');
// Test that it was successful by checking the document title
const pageTitle = await driver.title();
assert.equal(pageTitle, 'Google');
// Quit the session
await driver.quit();
});
});

View File

@@ -1,60 +0,0 @@
import wd from 'wd';
import chai from 'chai';
import { iosCaps, serverConfig } from '../helpers/caps';
const {assert} = chai;
describe('Basic IOS interactions', function () {
let driver;
before(async function () {
// Connect to Appium server
driver = await wd.promiseChainRemote(serverConfig);
// Start the session
await driver.init({
...iosCaps,
app: require('../helpers/apps').iosTestApp
});
});
after(async function () {
await driver.quit();
});
it('should send keys to inputs', async function () {
// Find TextField input element
const textInputId = `TextField1`;
await driver.waitForElementByAccessibilityId(textInputId);
const textViewsEl = await driver.elementByAccessibilityId(textInputId);
// Check that it doesn't have a value
let value = await textViewsEl.getValue();
assert.isNull(value, 'Input should have no value');
// Send keys to that input
await textViewsEl.sendKeys('Hello World!');
// Check that the input has new value
value = await textViewsEl.getValue();
assert.equal(value, 'Hello World!', 'Input should have newly input value');
});
it('should click a button that opens an alert', async function () {
// Find Button element and click on it
const buttonElementId = `show alert`;
await driver.waitForElementByAccessibilityId(buttonElementId);
const buttonElement = await driver.elementByAccessibilityId(buttonElementId);
await buttonElement.click();
// Wait for the alert to show up
const alertTitleId = `Cool title`;
await driver.waitForElementByAccessibilityId(alertTitleId);
const alertTitleElement = await driver.elementByAccessibilityId(alertTitleId);
// Check the text
const alertTitle = await alertTitleElement.text();
assert.equal(alertTitle, `Cool title`);
});
});

View File

@@ -1,35 +0,0 @@
import wd from 'wd';
import chai from 'chai';
import { iosCaps, serverConfig } from '../helpers/caps';
const {assert} = chai;
describe('Create session', function () {
it('should create and destroy IOS sessions', async function () {
// Connect to Appium server
const driver = await wd.promiseChainRemote(serverConfig);
// We haven't started a session yet, so we shouldn't see any sessions running
assert.equal((await driver.sessions()).length, 0);
// Start the session
await driver.init({
...iosCaps,
app: require('../helpers/apps').iosTestApp
});
// Now that session is running, check that 'sessions' length is one
assert.equal((await driver.sessions()).length, 1);
// Check that the XCUIElementTypeApplication was what we expect it to be
const applicationElement = await driver.elementByClassName('XCUIElementTypeApplication');
const applicationName = await applicationElement.getAttribute('name');
assert.equal(applicationName, 'TestApp');
// Quit the session
await driver.quit();
// Session is closed, so we should be back to having no sessions
assert.equal((await driver.sessions()).length, 0);
});
});

View File

@@ -1,28 +0,0 @@
import wd from 'wd';
import chai from 'chai';
import { iosCaps, serverConfig } from '../helpers/caps';
const {assert} = chai;
describe('Create Safari session', function () {
it('should create and destroy IOS Safari session', async function () {
// Connect to Appium server
const driver = await wd.promiseChainRemote(serverConfig);
// Start the session
await driver.init({
...iosCaps,
browserName: 'Safari'
});
// Navigate to google.com
await driver.get('https://www.google.com');
// Test that it was successful by checking the document title
const pageTitle = await driver.title();
assert.equal(pageTitle, 'Google');
// Quit the session
await driver.quit();
});
});

View File

@@ -1,8 +0,0 @@
if (process.env.DEV) {
// TODO: Change thes URL's to updated locations
exports.iosTestApp = "http://appium.github.io/appium/assets/TestApp7.1.app.zip";
exports.androidApiDemos = "http://appium.github.io/appium/assets/ApiDemos-debug.apk";
} else {
exports.iosTestApp = "sample-code/apps/TestApp.app.zip";
exports.androidApiDemos = "sample-code/apps/ApiDemos-debug.apk";
}

View File

@@ -1,29 +0,0 @@
import path from 'path';
const iosCaps = {
platformName: 'iOS',
automationName: 'XCUITest',
deviceName: process.env.IOS_DEVICE_NAME || 'iPhone 6s',
platformVersion: process.env.IOS_PLATFORM_VERSION || '11.1',
app: undefined, // Will be added in tests
};
// Leave the Android platformVersion blank and set deviceName to a random string (Android deviceName is ignored by Appium but is still required)
// If we're using SauceLabs, set the Android deviceName and platformVersion to the latest supported SauceLabs device and version
const DEFAULT_ANDROID_DEVICE_NAME = process.env.SAUCE ? 'Android GoogleAPI Emulator' : 'My Android Device';
const DEFAULT_ANDROID_PLATFORM_VERSION = process.env.SAUCE ? '7.1' : null;
const androidCaps = {
platformName: 'Android',
automationName: 'UiAutomator2',
deviceName: process.env.ANDROID_DEVICE_NAME || DEFAULT_ANDROID_DEVICE_NAME,
platformVersion: process.env.ANDROID_PLATFORM_VERSION || DEFAULT_ANDROID_PLATFORM_VERSION,
app: undefined, // Will be added in tests
};
const serverConfig = {
host: process.env.APPIUM_HOST || 'localhost',
port: process.env.APPIUM_PORT || 4723
};
export { iosCaps, androidCaps, serverConfig };

View File

@@ -1,3 +0,0 @@
--compilers babel-core/register
--require babel-polyfill
--timeout 1800000