mirror of
https://github.com/appium/appium.git
synced 2026-04-26 05:18:53 -05:00
Lint and update JS sample code (#11927)
* Lint and update JS wd sample code * Lint and update JS webdriverio sample code * Add JS sample code to greenkeeper
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
import wd from 'wd';
|
||||
import chai from 'chai';
|
||||
import { androidCaps, serverConfig } from '../helpers/caps';
|
||||
|
||||
const {assert} = chai;
|
||||
|
||||
|
||||
const PACKAGE = 'io.appium.android.apis';
|
||||
const SEARCH_ACTIVITY = '.app.SearchInvoke';
|
||||
const ALERT_DIALOG_ACTIVITY = '.app.AlertDialogSamples';
|
||||
|
||||
describe('Basic Android interactions', function () {
|
||||
|
||||
let driver;
|
||||
|
||||
before(async function () {
|
||||
@@ -60,4 +59,4 @@ describe('Basic Android interactions', function () {
|
||||
// Close the dialog
|
||||
await closeDialogButton.click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import wd from 'wd';
|
||||
import chai from 'chai';
|
||||
import { iosCaps, androidCaps, serverConfig } from '../helpers/caps';
|
||||
import { androidCaps, serverConfig } from '../helpers/caps';
|
||||
|
||||
const {assert} = chai;
|
||||
|
||||
@@ -23,4 +23,4 @@ describe('Create Android session', function () {
|
||||
// Quit the session
|
||||
await driver.quit();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,24 +5,27 @@ 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 () {
|
||||
let driver;
|
||||
before(async function () {
|
||||
// Connect to Appium server
|
||||
const driver = await wd.promiseChainRemote(serverConfig);
|
||||
driver = await wd.promiseChainRemote(serverConfig);
|
||||
|
||||
// Start the session
|
||||
await driver.init({
|
||||
...androidCaps,
|
||||
browserName: 'Chrome'
|
||||
});
|
||||
|
||||
});
|
||||
after(async function () {
|
||||
// Quit the session
|
||||
await driver.quit();
|
||||
});
|
||||
it('should create and destroy Android browser session', async function () {
|
||||
// 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('Basic IOS selectors', function () {
|
||||
|
||||
it('should find elements by class chain', async function () {
|
||||
// This is also an IOS-specific selector strategy. Similar to XPath. This is recommended over XPath.
|
||||
const windowElement = await driver.elements('-ios class chain', 'XCUIElementTypeWindow[1]/*[2]');
|
||||
const windowElement = await driver.elements('-ios class chain', 'XCUIElementTypeWindow[1]/*');
|
||||
assert.equal(windowElement.length, 1);
|
||||
});
|
||||
|
||||
@@ -54,4 +54,4 @@ describe('Basic IOS selectors', function () {
|
||||
const buttons = await driver.elementsByXPath('//XCUIElementTypeWindow//XCUIElementTypeButton');
|
||||
assert.isAbove(buttons.length, 1, 'Should have more than one button');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user