Skip to content

Commit e331b39

Browse files
dpgrahamjlipps
authored andcommitted
Upgrade sample code to Appium 1.6 (appium-boneyard#102)
1 parent ba2e716 commit e331b39

15 files changed

Lines changed: 480 additions & 93 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ build/
4545
*.iml
4646
*.iws
4747

48+
# VSCode
49+
.vscode/
50+
4851
# Mac
4952
.DS_Store
5053

.vscode/launch.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/index.js",
9+
"stopOnEntry": false,
10+
"args": [],
11+
"cwd": "${workspaceRoot}",
12+
"preLaunchTask": null,
13+
"runtimeExecutable": null,
14+
"runtimeArgs": [
15+
"--nolazy"
16+
],
17+
"env": {
18+
"NODE_ENV": "development"
19+
},
20+
"console": "internalConsole",
21+
"sourceMaps": false,
22+
"outFiles": []
23+
},
24+
{
25+
"name": "Attach",
26+
"type": "node",
27+
"request": "attach",
28+
"port": 5858,
29+
"address": "localhost",
30+
"restart": false,
31+
"sourceMaps": false,
32+
"outFiles": [],
33+
"localRoot": "${workspaceRoot}",
34+
"remoteRoot": null
35+
},
36+
{
37+
"name": "Attach to Process",
38+
"type": "node",
39+
"request": "attach",
40+
"processId": "${command.PickProcess}",
41+
"port": 5858,
42+
"sourceMaps": false,
43+
"outFiles": []
44+
}
45+
]
46+
}

sample-code/examples/java/junit/src/test/java/com/saucelabs/appium/iOSPageObjectTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ public void setUp() throws Exception {
4545
File app = new File(appDir, "TestApp.app");
4646
DesiredCapabilities capabilities = new DesiredCapabilities();
4747
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
48-
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.3");
48+
capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.6");
49+
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.1");
4950
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6");
5051
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
5152

5253
uiTestApp = new TestAppScreenSimple();
5354
driver = new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
5455

56+
System.out.println(driver.getPageSource());
5557
PageFactory.initElements(new AppiumFieldDecorator(driver), uiTestApp);
5658
}
5759

sample-code/examples/node/helpers/caps.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
exports.ios92 = {
22
browserName: '',
3-
appiumVersion: '1.5.3',
3+
'appium-version': '1.6',
44
platformName: 'iOS',
5-
platformVersion: '9.2',
5+
platformVersion: '10.1',
66
deviceName: 'iPhone 5s',
77
app: undefined // will be set later
88
};
99

1010
exports.ios81 = {
1111
browserName: '',
12-
appiumVersion: '1.5.3',
12+
'appium-version': '1.6',
1313
platformName: 'iOS',
14-
platformVersion: '8.1',
14+
platformVersion: '10.1',
1515
deviceName: 'iPhone Simulator',
1616
app: undefined // will be set later
1717
};
1818

1919
exports.android18 = {
2020
browserName: '',
21-
appiumVersion: '1.5.3',
21+
'appium-version': '1.6',
2222
platformName: 'Android',
2323
platformVersion: '5.1',
2424
deviceName: 'Android Emulator',
@@ -27,7 +27,7 @@ exports.android18 = {
2727

2828
exports.android19 = {
2929
browserName: '',
30-
appiumVersion: '1.5.3',
30+
'appium-version': '1.6',
3131
platformName: 'Android',
3232
platformVersion: '5.1',
3333
deviceName: 'Android Emulator',
@@ -36,7 +36,7 @@ exports.android19 = {
3636

3737
exports.selendroid16 = {
3838
browserName: '',
39-
appiumVersion: '1.5.3',
39+
'appium-version': '1.6',
4040
platformName: 'Android',
4141
platformVersion: '5.1',
4242
automationName: 'selendroid',

sample-code/examples/node/ios-actions.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe("ios actions", function () {
2020
var driver;
2121
var allPassed = true;
2222

23-
before(function () {
23+
beforeEach(function () {
2424
var serverConfig = process.env.npm_package_config_sauce ?
2525
serverConfigs.sauce : serverConfigs.local;
2626
driver = wd.promiseChainRemote(serverConfig);
@@ -55,21 +55,20 @@ describe("ios actions", function () {
5555
.then(function (el) {
5656
var action = new wd.TouchAction(driver);
5757
action
58-
.tap({el: el, x: 10, y: 10})
59-
.release();
58+
.tap({el: el, x: 10, y: 10});
6059
return driver.performTouchAction(action);
6160
})
6261
.elementByAccessibilityId('ComputeSumButton')
6362
.then(function (el) {
6463
var action = new wd.TouchAction(driver);
6564
action
66-
.tap({el: el, x: 10, y: 10})
67-
.release();
65+
.tap({el: el, x: 10, y: 10});
6866
return action.perform();
6967
});
7068
});
7169

72-
it("should execute a multi action", function () {
70+
// TODO: MultiAction not yet implemented. Re-enable this test when they are.
71+
xit("should execute a multi action", function () {
7372
return driver.chain()
7473
.then(function () {
7574
return driver
@@ -106,59 +105,61 @@ describe("ios actions", function () {
106105
it("should swipe", function () {
107106
return driver
108107
.waitForElementByName('Test Gesture', 5000).click()
109-
.sleep(1000)
110-
.elementByName('OK').click()
111-
.sleep(1000)
112-
.elementByXPath('//UIAMapView').getLocation()
108+
.sleep(3000)
109+
.elementByName('Allow').click()
110+
.sleep(3000)
111+
.elementByXPath('//XCUIElementTypeMap').getLocation()
113112
.then(function (loc) {
114113
return driver.swipe({ startX: loc.x, startY: loc.y,
115114
endX: 0.5, endY: loc.y, duration: 800 });
116115
});
117116
});
118117

119-
it("should pinch", function () {
118+
// TODO: MultiAction not yet implemented. Re-enable this test when they are.
119+
xit("should pinch", function () {
120120
return driver
121121
.waitForElementByName('Test Gesture', 5000).click()
122-
.sleep(1000)
123-
.elementByName('OK').click()
124-
.sleep(1000)
125-
.elementByXPath('//UIAMapView')
122+
.sleep(3000)
123+
.elementByName('Allow').click()
124+
.sleep(3000)
125+
.elementByXPath('//XCUIElementTypeMap')
126126
.then(function (el) {
127127
return driver.pinch(el);
128128
});
129129
});
130130

131-
it("should pinch el", function () {
131+
// TODO: MultiAction not yet implemented. Re-enable this test when they are.
132+
xit("should pinch el", function () {
132133
return driver
133134
.waitForElementByName('Test Gesture', 5000).click()
135+
.sleep(2000)
136+
.elementByName('Allow').click()
134137
.sleep(1000)
135-
.elementByName('OK').click()
136-
.sleep(1000)
137-
.elementByXPath('//UIAMapView')
138+
.elementByXPath('//XCUIElementTypeMap')
138139
.then(function (el) {
139140
return el.pinch();
140141
});
141142
});
142143

143-
it("should zoom", function () {
144+
xit("should zoom", function () {
144145
return driver
145146
.waitForElementByName('Test Gesture', 5000).click()
146-
.sleep(1000)
147-
.elementByName('OK').click()
148-
.sleep(1000)
149-
.elementByXPath('//UIAMapView')
147+
.sleep(3000)
148+
.elementByName('Allow').click()
149+
.sleep(3000)
150+
.elementByXPath('//XCUIElementTypeMap')
150151
.then(function (el) {
151152
return driver.zoom(el);
152153
});
153154
});
154155

155-
it("should zoom el", function () {
156+
xit("should zoom el", function () {
156157
return driver
157158
.waitForElementByName('Test Gesture', 5000).click()
159+
.sleep(3000)
160+
.elementByName('Allow').click()
158161
.sleep(1000)
159-
.elementByName('OK').click()
160-
.sleep(1000)
161-
.elementByXPath('//UIAMapView')
162+
.elementByXPath('//XCUIElementTypeMap')
162163
.then(function (el) {
163164
return el.zoom();
164165
});

0 commit comments

Comments
 (0)