(不是那么有趣的事情)是直到昨天,相同的代码成功运行。它仍然在我的本地env中执行,但仍然无法弄清楚AWS中可能会发生什么变化以获取此错误。最糟糕的是,在搜索此错误时找不到任何东西。
BTW,尝试在本地和我的Bitbucket管道上构建有关APK,并且错误是相同的。任何想法?我在这里迷路了
thehere是YAML测试规格文件:
version: 0.1
android_test_host: amazon_linux_2
phases:
install:
commands:
- devicefarm-cli use node 20
- node --version
- devicefarm-cli use appium 2
- npm i -g [email protected]
- appium driver uninstall uiautomator2
- appium driver install [email protected]
- appium -v
- export APPIUM_BASE_PATH=/wd/hub
# Install the NodeJS dependencies.
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- npm i
pre_test:
commands:
- |-
appium --base-path=$APPIUM_BASE_PATH --log $DEVICEFARM_LOG_DIR --log-timestamp \
--log-no-colors --relaxed-security --default-capabilities \
"{\"appium:deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \
\"platformName\": \"$DEVICEFARM_DEVICE_PLATFORM_NAME\", \
\"appium:app\": \"$DEVICEFARM_APP_PATH\", \
\"appium:udid\":\"$DEVICEFARM_DEVICE_UDID\", \
\"appium:platformVersion\": \"$DEVICEFARM_DEVICE_OS_VERSION\", \
\"appium:chromedriverExecutableDir\": \"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE_DIR\", \
\"appium:automationName\": \"UiAutomator2\", \
\"appium:autoGrantPermissions\": true }" \
>> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
# This code will wait until the Appium server starts.
- |-
appium_initialization_time=0;
until curl --silent --fail "http://0.0.0.0:4723${APPIUM_BASE_PATH}/status"; do
if [[ $appium_initialization_time -gt 30 ]]; then
echo "Appium did not start within 30 seconds. Exiting...";
exit 1;
fi;
appium_initialization_time=$((appium_initialization_time + 1));
echo "Waiting for Appium to start on port 4723...";
sleep 1;
done;
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
# The test phase contains commands for running your tests.
test:
commands:
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- echo "Starting the Appium NodeJS test"
- npm run test
post_test:
commands:
- cp $DEVICEFARM_TEST_PACKAGE_PATH/test-report/* $DEVICEFARM_LOG_DIR/
- ls -l $DEVICEFARM_LOG_DIR
artifacts:
- $DEVICEFARM_LOG_DIR
import { type Options } from '@wdio/types';
import * as helper from "../helpers/basic-helper";
import {constants} from "../constants/constants";
import axios from "axios";
import moment = require("moment");
import {Auth0Api} from "../apis/auth0Api";
export const config: Options.Testrunner = {
//
runner: 'local',
port: 4723,
path: '/wd/hub/',
specs: [
'../specs/auth.e2e.ts',
'../specs/tracker.e2e.ts',
// '../specs/remove.e2e.ts',
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 1,
logLevel: 'info',
bail: 1,
baseUrl: 'http://localhost:8100',
//
// Default timeout for all waitFor* commands.
waitforTimeout: 20000,
//
// Default timeout in milliseconds for request
// if browser driver or grid doesn't send response
connectionRetryTimeout: 120000,
//
// Default request retries count
connectionRetryCount: 3,
services: [],
framework: 'jasmine',
reporters: [
'spec',
['junit', {
outputDir: './test-report/',
outputFileFormat: function(options) { // optional
return `test-output.xml`
}
}],
],
suites: {
authentication: ['../specs/auth.e2e.ts'],
tracker: ['../specs/tracker.e2e.ts'],
},
// Options to be passed to Jasmine.
jasmineOpts: {
// Jasmine default timeout
defaultTimeoutInterval: 60000,
stopOnSpecFailure: true,
stopSpecOnExpectationFailure: true,
expectationResultHandler: function(passed: any, assertion: any) {
// do something
},
},
afterTest: async function(test, context, { error, result, duration, passed, retries }) {
if(!passed) {
const fileName = `./test-report/${test.fullName}-${moment().unix()}-screenshot.png`;
const screenshotName = await browser.saveScreenshot(fileName);
}
},
};
SO,设法达到了AWS支持,他们立即随附了解决方案。如果任何人都遇到了同样的问题,更改这些版本就可以解决问题。似乎Appium和Uiautomator2在我的设置上存在一些不相容性。 there是需要更改的地方:
- npm i -g [email protected]
- appium driver install [email protected]
to