This repository has been archived by the owner on Mar 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdc9535
commit 68ac912
Showing
16 changed files
with
1,447 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
"use strict"; | ||
|
||
require("./helpers/setup"); | ||
|
||
var wd = require("wd"); | ||
var assert = require('assert'); | ||
var serverConfigs = require('./helpers/appium-servers'); | ||
// var args = process.args.slice(2); | ||
// var config = require('./helpers/config') | ||
// var actions = require('/helpers/actions') | ||
//var elements = require('/helpers/elements') | ||
var desired; | ||
var simulator = false | ||
var _ = require('underscore'); | ||
var localServer = require('./helpers/local-server'); | ||
// wd.addPromiseChainMethod('swipe', actions.swipe); | ||
|
||
|
||
describe("android local server", function () { | ||
this.timeout(30000); | ||
var driver; | ||
var allPassed = true; | ||
|
||
before(function () { | ||
localServer.start(); | ||
var serverConfig = serverConfigs.local; | ||
driver = wd.promiseChainRemote(serverConfig); | ||
require("./helpers/logging").configure(driver); | ||
|
||
var desired = process.env.npm_package_config_sauce ? | ||
_.clone(require("./helpers/caps").android18) : | ||
_.clone(require("./helpers/caps").android19); | ||
desired.app = require("./helpers/apps").i360Walk; | ||
if (process.env.npm_package_config_sauce) { | ||
desired.name = 'android - local server'; | ||
desired.tags = ['sample']; | ||
} | ||
return driver.init(desired); | ||
}); | ||
|
||
after(function () { | ||
localServer.stop(); | ||
return driver | ||
.quit() | ||
.finally(function () { | ||
if (process.env.npm_package_config_sauce) { | ||
return driver.sauceJobStatus(allPassed); | ||
} | ||
}); | ||
}); | ||
/* | ||
afterEach(function () { | ||
allPassed = allPassed && this.currentTest.state === 'passed'; | ||
}); | ||
*/ | ||
|
||
it("should open the app", function () { | ||
return driver | ||
.elementById('com.i360.i360Walk:id/etLoginUsername') | ||
.sendKeys('test_1654wseward') | ||
.elementById('com.i360.i360Walk:id/etPassword') | ||
.sendKeys('asdf') | ||
.elementById('com.i360.i360Walk:id/btnLogin') | ||
.click() | ||
.sleep(4000) | ||
}); | ||
|
||
it("should open Walkbooks", function() { | ||
return driver | ||
.elementByName('Walkbooks') | ||
.click() | ||
.sleep(4000) | ||
.elementByName('and another one') | ||
.click() | ||
.elementByName('Preview Survey Questions') | ||
.click() | ||
.sleep(1000) | ||
.back() | ||
.elementByName('Start') | ||
.click() | ||
.waitForElementByName('Select Walkbook') | ||
.elementByXPath("//android.widget.TextView[@text='List']") | ||
.click() | ||
.waitForElementById('com.i360.i360Walk:id/line1') | ||
.text().should.eventually.include('Walkbook 28') | ||
.elementByName('Walkbook 28') | ||
.click() | ||
.sleep(4000) | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use strict"; | ||
|
||
require("./helpers/setup"); | ||
|
||
var wd = require("wd"); | ||
var assert = require('assert'); | ||
var serverConfigs = require('./helpers/appium-servers'); | ||
// var args = process.args.slice(2); | ||
// var config = require('./helpers/config') | ||
// var actions = require('/helpers/actions') | ||
// var elements = require('/helpers/elements') | ||
var desired; | ||
var simulator = false | ||
var _ = require('underscore'); | ||
var localServer = require('./helpers/local-server'); | ||
// wd.addPromiseChainMethod('swipe', actions.swipe); | ||
|
||
|
||
describe("android local server", function () { | ||
this.timeout(30000); | ||
var driver; | ||
var allPassed = true; | ||
|
||
before(function () { | ||
localServer.start(); | ||
var serverConfig = serverConfigs.local; | ||
driver = wd.promiseChainRemote(serverConfig); | ||
require("./helpers/logging").configure(driver); | ||
|
||
var desired = process.env.npm_package_config_sauce ? | ||
_.clone(require("./helpers/caps").android18) : | ||
_.clone(require("./helpers/caps").android19); | ||
desired.app = require("./helpers/apps").i360Walk; | ||
if (process.env.npm_package_config_sauce) { | ||
desired.name = 'android - local server'; | ||
desired.tags = ['sample']; | ||
} | ||
return driver.init(desired); | ||
}); | ||
|
||
after(function () { | ||
localServer.stop(); | ||
return driver | ||
.quit() | ||
.finally(function () { | ||
if (process.env.npm_package_config_sauce) { | ||
return driver.sauceJobStatus(allPassed); | ||
} | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
allPassed = allPassed && this.currentTest.state === 'passed'; | ||
}); | ||
|
||
|
||
it("should open the app and wait for input", function () { | ||
return driver | ||
.elementById('com.i360.i360Walk:id/etLoginUsername') | ||
.sendKeys('test_1654wseward') | ||
.elementById('com.i360.i360Walk:id/etPassword') | ||
.sendKeys('asdf') | ||
.elementById('com.i360.i360Walk:id/btnLogin') | ||
.click() | ||
.sleep(400000) | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
"use strict"; | ||
|
||
require("./helpers/setup"); | ||
|
||
var wd = require("wd"), | ||
_ = require('underscore'), | ||
actions = require("./helpers/actions"), | ||
serverConfigs = require('./helpers/appium-servers'), | ||
_p = require('./helpers/promise-utils'), | ||
Q = require('q'); | ||
|
||
wd.addPromiseChainMethod('swipe', actions.swipe); | ||
|
||
describe("android complex", function () { | ||
this.timeout(300000); | ||
var driver; | ||
var allPassed = true; | ||
|
||
before(function () { | ||
var serverConfig = process.env.npm_package_config_sauce ? | ||
serverConfigs.sauce : serverConfigs.local; | ||
driver = wd.promiseChainRemote(serverConfig); | ||
require("./helpers/logging").configure(driver); | ||
|
||
var desired = process.env.npm_package_config_sauce ? | ||
_.clone(require("./helpers/caps").android18) : | ||
_.clone(require("./helpers/caps").android19); | ||
desired.app = require("./helpers/apps").androidApiDemos; | ||
if (process.env.npm_package_config_sauce) { | ||
desired.name = 'android - complex'; | ||
desired.tags = ['sample']; | ||
} | ||
return driver | ||
.init(desired) | ||
.setImplicitWaitTimeout(5000); | ||
}); | ||
|
||
after(function () { | ||
return driver | ||
.quit() | ||
.finally(function () { | ||
if (process.env.npm_package_config_sauce) { | ||
return driver.sauceJobStatus(allPassed); | ||
} | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
allPassed = allPassed && this.currentTest.state === 'passed'; | ||
}); | ||
|
||
it("should find an element", function () { | ||
return driver | ||
.elementByXPath('//android.widget.TextView[@text=\'Animation\']') | ||
.elementByXPath('//android.widget.TextView') | ||
.text().should.become('API Demos') | ||
.elementsByXPath('//android.widget.TextView[contains(@text, "Animat")]') | ||
.then(_p.filterDisplayed).first() | ||
.then(function (el) { | ||
if (!process.env.npm_package_config_sauce) { | ||
return el.text().should.become('Animation'); | ||
} | ||
}).elementByXPath('//android.widget.TextView[@text=\'App\']').click() | ||
.sleep(3000) | ||
.elementsByAndroidUIAutomator('new UiSelector().clickable(true)') | ||
.should.eventually.have.length.above(10) | ||
.elementByXPath('//android.widget.TextView[@text=\'Action Bar\']') | ||
.should.eventually.exist | ||
.elementsByXPath('//android.widget.TextView') | ||
.then(_p.filterDisplayed).first() | ||
.text().should.become('API Demos') | ||
.back().sleep(1000); | ||
}); | ||
|
||
it("should scroll", function () { | ||
return driver | ||
.elementByXPath('//android.widget.TextView[@text=\'Animation\']') | ||
.elementsByXPath('//android.widget.TextView') | ||
.then(function (els) { | ||
return Q.all([ | ||
els[7].getLocation(), | ||
els[3].getLocation() | ||
]).then(function (locs) { | ||
console.log('locs -->', locs); | ||
return driver.swipe({ | ||
startX: locs[0].x, startY: locs[0].y, | ||
endX: locs[1].x, endY: locs[1].y, | ||
duration: 800 | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it("should draw a smiley", function () { | ||
function findTouchPaint() { | ||
return driver | ||
.elementsByClassName('android.widget.TextView') | ||
.then(function (els) { | ||
return Q.all([ | ||
els[els.length - 1].getLocation(), | ||
els[0].getLocation() | ||
]).then(function (locs) { | ||
return driver.swipe({ | ||
startX: locs[0].x, startY: locs[0].y, | ||
endX: locs[1].x, endY: locs[1].y, | ||
duration: 800 | ||
}); | ||
}); | ||
}).elementByXPath('//android.widget.TextView[@text=\'Touch Paint\']') | ||
.catch(function () { | ||
return findTouchPaint(); | ||
}); | ||
} | ||
|
||
return driver | ||
.elementByXPath('//android.widget.TextView[@text=\'Graphics\']').click() | ||
.then(findTouchPaint) | ||
.click() | ||
.sleep(5000) | ||
.then(function () { | ||
var a1 = new wd.TouchAction(); | ||
a1.press({x: 150, y: 100}).release(); | ||
var a2 = new wd.TouchAction(); | ||
a2.press({x: 250, y: 100}).release(); | ||
var smile = new wd.TouchAction(); | ||
smile | ||
.press({x:110, y:200}) | ||
.moveTo({x:1, y:1}) | ||
.moveTo({x:1, y:1}) | ||
.moveTo({x:1, y:1}) | ||
.moveTo({x:1, y:1}) | ||
.moveTo({x:1, y:1}) | ||
.moveTo({x:2, y:1}) | ||
.moveTo({x:2, y:1}) | ||
.moveTo({x:2, y:1}) | ||
.moveTo({x:2, y:1}) | ||
.moveTo({x:2, y:1}) | ||
.moveTo({x:3, y:1}) | ||
.moveTo({x:3, y:1}) | ||
.moveTo({x:3, y:1}) | ||
.moveTo({x:3, y:1}) | ||
.moveTo({x:3, y:1}) | ||
.moveTo({x:4, y:1}) | ||
.moveTo({x:4, y:1}) | ||
.moveTo({x:4, y:1}) | ||
.moveTo({x:4, y:1}) | ||
.moveTo({x:4, y:1}) | ||
.moveTo({x:5, y:1}) | ||
.moveTo({x:5, y:1}) | ||
.moveTo({x:5, y:1}) | ||
.moveTo({x:5, y:1}) | ||
.moveTo({x:5, y:1}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:0}) | ||
.moveTo({x:5, y:-1}) | ||
.moveTo({x:5, y:-1}) | ||
.moveTo({x:5, y:-1}) | ||
.moveTo({x:5, y:-1}) | ||
.moveTo({x:5, y:-1}) | ||
.moveTo({x:4, y:-1}) | ||
.moveTo({x:4, y:-1}) | ||
.moveTo({x:4, y:-1}) | ||
.moveTo({x:4, y:-1}) | ||
.moveTo({x:4, y:-1}) | ||
.moveTo({x:3, y:-1}) | ||
.moveTo({x:3, y:-1}) | ||
.moveTo({x:3, y:-1}) | ||
.moveTo({x:3, y:-1}) | ||
.moveTo({x:3, y:-1}) | ||
.moveTo({x:2, y:-1}) | ||
.moveTo({x:2, y:-1}) | ||
.moveTo({x:2, y:-1}) | ||
.moveTo({x:2, y:-1}) | ||
.moveTo({x:2, y:-1}) | ||
.moveTo({x:1, y:-1}) | ||
.moveTo({x:1, y:-1}) | ||
.moveTo({x:1, y:-1}) | ||
.moveTo({x:1, y:-1}) | ||
.moveTo({x:1, y:-1}) | ||
.release(); | ||
|
||
var ma = new wd.MultiAction().add(a1, a2, smile); | ||
return driver.performMultiAction(ma) | ||
// so you can see it | ||
.sleep(10000) | ||
.back().sleep(1000) | ||
.back().sleep(1000); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.