Skip to content

Commit bba3ca2

Browse files
fix(appium): update client and CI to appium v2 (#318)
* fix(appium-helper): update server base path * fix(appium-helper): update capabilities to use required vendor prefix * fix(appium-helper): update readme to mention appium driver installation * chore: update appium version in CI * chore: remove deprecated husky lines --------- Co-authored-by: Rafael Rollo <[email protected]>
1 parent ebf8639 commit bba3ca2

File tree

5 files changed

+25
-36
lines changed

5 files changed

+25
-36
lines changed

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
32

43
npx lint-staged

examples/e2e/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test": "tsc && yarn test:e2e"
1212
},
1313
"dependencies": {
14-
"@bam.tech/appium-helper": "^0.5.4",
15-
"@perf-profiler/e2e": "^0.11.3"
14+
"@bam.tech/appium-helper": "*",
15+
"@perf-profiler/e2e": "*"
1616
}
1717
}

packages/plugins/aws-device-farm/src/__tests__/__snapshots__/createTestSpecFile.ts.snap

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,17 @@ phases:
1111
- echo "Navigate to test package directory"
1212
- cd $DEVICEFARM_TEST_PACKAGE_PATH
1313
- npm install *.tgz
14-
- export APPIUM_VERSION=1.22.2
15-
- avm $APPIUM_VERSION
16-
- >-
17-
ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium
18-
/usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js
1914
- npm install --global yarn
2015
pre_test:
2116
commands:
2217
- echo "Start appium server"
18+
- npx [email protected] driver install uiautomator2
2319
- >-
24-
appium --log-timestamp --default-capabilities "{\\"deviceName\\":
25-
\\"$DEVICEFARM_DEVICE_NAME\\",
26-
\\"platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"app\\":\\"$DEVICEFARM_APP_PATH\\",
27-
\\"udid\\":\\"$DEVICEFARM_DEVICE_UDID\\",
28-
\\"platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}"
20+
npx appium@2.11.4 --log-timestamp --default-capabilities
21+
"{\\"appium:deviceName\\": \\"$DEVICEFARM_DEVICE_NAME\\",
22+
\\"appium:platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"appium:app\\":\\"$DEVICEFARM_APP_PATH\\",
23+
\\"appium:udid\\":\\"$DEVICEFARM_DEVICE_UDID\\",
24+
\\"appium:platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"appium:chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}"
2925
>> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
3026
- |-
3127
start_appium_timeout=0;
@@ -36,10 +32,10 @@ phases:
3632
echo "appium server never started in 60 seconds. Exiting";
3733
exit 1;
3834
fi;
39-
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
35+
grep -i "Appium REST http interface listener started on http://0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
4036
if [ $? -eq 0 ];
4137
then
42-
echo "Appium REST http interface listener started on 0.0.0.0:4723";
38+
echo "Appium REST http interface listener started on http://0.0.0.0:4723";
4339
break;
4440
else
4541
echo "Waiting for appium server to start. Sleeping for 1 second";
@@ -72,20 +68,16 @@ phases:
7268
- echo "Navigate to test package directory"
7369
- cd $DEVICEFARM_TEST_PACKAGE_PATH
7470
- npm install *.tgz
75-
- export APPIUM_VERSION=1.22.2
76-
- avm $APPIUM_VERSION
77-
- >-
78-
ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium
79-
/usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js
8071
pre_test:
8172
commands:
8273
- echo "Start appium server"
74+
- npx [email protected] driver install uiautomator2
8375
- >-
84-
appium --log-timestamp --default-capabilities "{\\"deviceName\\":
85-
\\"$DEVICEFARM_DEVICE_NAME\\",
86-
\\"platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"app\\":\\"$DEVICEFARM_APP_PATH\\",
87-
\\"udid\\":\\"$DEVICEFARM_DEVICE_UDID\\",
88-
\\"platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}"
76+
npx appium@2.11.4 --log-timestamp --default-capabilities
77+
"{\\"appium:deviceName\\": \\"$DEVICEFARM_DEVICE_NAME\\",
78+
\\"appium:platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"appium:app\\":\\"$DEVICEFARM_APP_PATH\\",
79+
\\"appium:udid\\":\\"$DEVICEFARM_DEVICE_UDID\\",
80+
\\"appium:platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"appium:chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}"
8981
>> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
9082
- |-
9183
start_appium_timeout=0;
@@ -96,10 +88,10 @@ phases:
9688
echo "appium server never started in 60 seconds. Exiting";
9789
exit 1;
9890
fi;
99-
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
91+
grep -i "Appium REST http interface listener started on http://0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
10092
if [ $? -eq 0 ];
10193
then
102-
echo "Appium REST http interface listener started on 0.0.0.0:4723";
94+
echo "Appium REST http interface listener started on http://0.0.0.0:4723";
10395
break;
10496
else
10597
echo "Waiting for appium server to start. Sleeping for 1 second";

packages/plugins/aws-device-farm/src/buildYmlSpec.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import yaml from "js-yaml";
2+
3+
const APPIUM_VERSION = "2.11.4";
4+
25
export const Commands = {
36
INSTALL_NODE: ["devicefarm-cli use node 18", "node -v"],
47
UNPACKAGE_TEST_PACKAGE: [
58
'echo "Navigate to test package directory"',
69
"cd $DEVICEFARM_TEST_PACKAGE_PATH",
710
"npm install *.tgz",
811
],
9-
INSTALL_APPIUM: [
10-
"export APPIUM_VERSION=1.22.2",
11-
"avm $APPIUM_VERSION",
12-
"ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js",
13-
],
1412
START_APPIUM: [
1513
'echo "Start appium server"',
16-
`appium --log-timestamp --default-capabilities "{\\"deviceName\\": \\"$DEVICEFARM_DEVICE_NAME\\", \\"platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"app\\":\\"$DEVICEFARM_APP_PATH\\", \\"udid\\":\\"$DEVICEFARM_DEVICE_UDID\\", \\"platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}" >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &`,
14+
`npx appium@${APPIUM_VERSION} driver install uiautomator2`,
15+
`npx appium@${APPIUM_VERSION} --log-timestamp --default-capabilities "{\\"appium:deviceName\\": \\"$DEVICEFARM_DEVICE_NAME\\", \\"appium:platformName\\":\\"$DEVICEFARM_DEVICE_PLATFORM_NAME\\",\\"appium:app\\":\\"$DEVICEFARM_APP_PATH\\", \\"appium:udid\\":\\"$DEVICEFARM_DEVICE_UDID\\", \\"appium:platformVersion\\":\\"$DEVICEFARM_DEVICE_OS_VERSION\\",\\"appium:chromedriverExecutable\\":\\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\\"}" >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &`,
1716
`start_appium_timeout=0;
1817
while [ true ];
1918
do
@@ -22,10 +21,10 @@ do
2221
echo "appium server never started in 60 seconds. Exiting";
2322
exit 1;
2423
fi;
25-
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
24+
grep -i "Appium REST http interface listener started on http://0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
2625
if [ $? -eq 0 ];
2726
then
28-
echo "Appium REST http interface listener started on 0.0.0.0:4723";
27+
echo "Appium REST http interface listener started on http://0.0.0.0:4723";
2928
break;
3029
else
3130
echo "Waiting for appium server to start. Sleeping for 1 second";

packages/plugins/aws-device-farm/src/createTestSpecFile.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const buildAppiumYmlSpec = (commands: {
1313
installCommands: [
1414
...Commands.INSTALL_NODE,
1515
...Commands.UNPACKAGE_TEST_PACKAGE,
16-
...Commands.INSTALL_APPIUM,
1716
...(commands.installCommands || []),
1817
],
1918
preTestCommands: [...Commands.START_APPIUM, ...(commands.preTestCommands || [])],

0 commit comments

Comments
 (0)