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:
Isaac A. Murchie
2019-01-03 09:40:53 -05:00
committed by GitHub
parent 844094a7bb
commit e0c4106d22
21 changed files with 124 additions and 86 deletions

View File

@@ -5,29 +5,31 @@ const assert = require("chai").assert;
iosOptions.capabilities.app = app;
describe("Basic IOS interactions", function() {
describe("Basic IOS interactions", function () {
let client;
beforeEach(async function() {
beforeEach(async function () {
client = await webdriverio.remote(iosOptions);
});
afterEach(async function() {
await client.deleteSession();
afterEach(async function () {
await client.deleteSession();
});
it("should send keys to inputs", async function() {
const elementId = await client.findElement("accessibility id","TextField1");
it("should send keys to inputs", async function () {
const elementId = await client.findElement("accessibility id", "TextField1");
client.elementSendKeys(elementId.ELEMENT, "Hello World!");
const elementValue = await client.findElement("accessibility id","TextField1");
await client.getElementAttribute(elementValue.ELEMENT,"value").then((attr) => {
assert.equal(attr,"Hello World!");
const elementValue = await client.findElement("accessibility id", "TextField1");
await client.getElementAttribute(elementValue.ELEMENT, "value").then((attr) => {
assert.equal(attr, "Hello World!");
});
});
it("should click a button that opens an alert", async function() {
const element = await client.findElement("accessibility id","show alert");
it("should click a button that opens an alert", async function () {
const element = await client.findElement("accessibility id", "show alert");
await client.elementClick(element.ELEMENT);
assert.equal(await client.getAlertText(),"Cool title\nthis alert is so cool.");
assert.equal(await client.getAlertText(), "Cool title\nthis alert is so cool.");
});
});