Very slow Appium execution in Azure Pipelines - ios

WebdriverIO Use
wdio.conf.js
maxInstances: 1,
capabilities: [{
platformName: 'iOS',
noReset: true,
fullReset: false,
maxInstances: 1,
automationName: 'XCUITest',
deviceName: 'iPhone 11',
platformVersion: '14.5',
app: path.resolve(`. /{app}.zip`),
}],
waitforTimeout: 10000,
connectionRetryTimeout: 50000,
connectionRetryCount: 6,
services: [
'appium'.
],
appium: {
command: 'appium',
args: {},
},
port: 4723,
path: '/wd/hub',
azure-pipelines.yml
- script: |
npm install -g appium
appium &.
sudo xcode-select -s /Applications/Xcode_12.5.app/Contents/Developer
xcrun simctl list
After running the test, it takes about 10 minutes before the test actually starts.
Why is this?

Related

Dockerize Vue.js: hot-reload is not working for vue/cli#4.5 or later versions

I greatly appreciate your effort and the time to solve unresponsive hot-reload function when trying to run Vue.js app on Docker container using Docker engine on Windows 10 while WSL2 active, please take a look at below configurations:
Vue.Setup.Dockerfile
FROM node:17-alpine
EXPOSE 8080
WORKDIR /app/frontend
RUN npm --force install -g #vue/cli#4.5.15
COPY /frontend /app/frontend
ENV PATH /app/frontend/node_modules/.bin:$PATH
CMD [ "npm", "run", "serve" ]
docker-compose.yml
version: "3.8"
services:
vue:
build:
context: .
dockerfile: dockerfiles/Vue.Setup.Dockerfile
restart: always
ports:
- "127.0.0.1:8080:8080"
container_name: vue_ui
volumes:
- ./frontend/:/app/frontend/
- /app/frontend/node_modules
environment:
- CHOKIDAR_USEPOLLING=true
vue.config.js
module.exports = {
publicPath:
process.env.NODE_ENV === "production"
? "/static/dist/"
: "http://127.0.0.1:8080",
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
title: 'QuestionTime',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
},
// Webpack configuration
devServer: {
host: "0.0.0.0",
port: "8080",
hot: true,
headers: {"Access-Control-Allow-Origin": "*"},
devMiddleware: {
publicPath: "http://127.0.0.1:8080",
writeToDisk: (filePath) => filePath.endsWith("index.html"),
},
static: {
watch: {
ignored: "/node_modules/",
usePolling: true,
},
},
client: {
webSocketURL: {
/* You need to config this option, otherwise the below error will occur
in your browser console when trying to connect to development server
from another Docker container:
WebSocket connection to 'ws://127.0.0.1:<port-number>/ws' failed
*/
hostname: "0.0.0.0",
pathname: "/ws",
port: 8080,
},
},
},
};
Note: When run the command:
docker-compose up
The below message will show:
It seems you are running Vue CLI inside a container.
Since you are using a non-root publicPath, the hot-reload socket
will not be able to infer the correct URL to connect. You should
explicitly specify the URL via devServer.public.
Access the dev server via http://localhost:<your container's
external mapped port>
FYI: the option:
devServer.public
is no longer available in Vue/cli#4 or later versions.
WORKAROUND
solution
Thanks,

Running Electron with webdriverio throws chrome not reachable

Has anyone tried working with electron and webdriverio? I am using the latest electron 16 version with "wdio-chromedriver-service": "^7.2.2" and chromedriver "96.0.0" version. I am getting the following error:
$ npx wdio run ./wdio.conf.js --spec welcome-test.e2e.js
Execution of 1 workers started at 2021-11-30T11:14:38.431Z
2021-11-30T11:14:38.516Z INFO #wdio/cli:launcher: Run onPrepare hook
2021-11-30T11:14:38.517Z INFO chromedriver: Start Chromedriver (C:\Projects\abc\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --silent --port=9515 --url-base=/
2021-11-30T11:14:38.652Z INFO #wdio/cli:launcher: Run onWorkerStart hook
2021-11-30T11:14:38.657Z INFO #wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.js,--spec,welcome-test.e2e.js
[0-0] 2021-11-30T11:14:39.340Z INFO #wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - C:\Projects\abc\test\specs\welcome-test.e2e.js
[0-0] 2021-11-30T11:14:40.069Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-11-30T11:14:40.136Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2021-11-30T11:14:40.137Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] 'goog:chromeOptions': [Object]
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] 'goog:chromeOptions': {
[0-0] binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe',
[0-0] args: [Array]
[0-0] }
[0-0] }
[0-0] }
[0-0] 2021-11-30T11:14:45.557Z WARN webdriver: Request failed with status 500 due to unknown error: Chrome failed to start: exited normally.
[0-0] (chrome not reachable)
[0-0] (The process started from chrome location C:/Projects/abc/node_modules/electron/dist/electron.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
My wdio.conf.js file look like this:
capabilities: [{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
maxInstances: 1,
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe', // Path to your Electron binary.
args: ['app=C:/Projects/abc', '--no-sandbox', '--headless'], // Optional, perhaps 'app=' + /path/to/your/app/
},
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
// excludeDriverLogs: ['bugreport', 'server'],
}],
Any help is appreciated.

selenium with behat : Unable to find provider for session

So I'm trying to configure selenium in a docker container, to use with behat, and the hub has the status not ready when I reach http://localhost:4444/status :
{
"value": {
"ready": false,
"message": "Selenium Grid not ready.",
"nodes": [
{
"id": "f746de23-58e4-499d-85fd-9bad4f904488",
"uri": "http:\u002f\u002f172.22.0.5:5555",
"maxSessions": 2,
"stereotypes": [
{
"capabilities": {
"browserName": "chrome"
},
"count": 2
}
],
"sessions": [
]
}
]
}
}
And when I run the tests :
Could not open connection: Payload received from webdriver is valid but unexpected json: {
"value": {
"error": "session not created",
"message": "Unable to find provider for session: Capabilities {browser: firefox, browserName: chrome, ignoreZoomSetting: false, name: Behat feature suite, tags: [509f70556c1c, PHP 7.4.9]}, Capabilities {browserName: chrome}, Capabilities {browserName: firefox}, Capabilities {}\nBuild info: version: '4.0.0-alpha-7', revision: '117b9d61c9'\nSystem info: host: '7f39dcd595c7', ip: '172.22.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_265'\nDriver info: driver.version: unknown",
"stacktrace": "org.openqa.selenium.SessionNotCreatedException: Unable to find provider for session: Capabilities {browser: firefox, browserName: chrome, ignoreZoomSetting: false, name: Behat feature suite, tags: [509f70556c1c, PHP 7.4.9]}, Capabilities {browserName: chrome}, Capabilities {browserName: firefox}, Capabilities {}\nBuild info: version: '4.0.0-alpha-7', revision: '117b9d61c9'\nSystem info: host: '7 (Behat\Mink\Exception\DriverException)
I tried many configuration, mostly in the wd_host param in behat.yml, but everything I tried (different url, different port...) brought me errors.
My docker-composer.yml:
version: '3'
services:
chrome:
image: selenium/node-chrome:4.0.0-alpha-7-prerelease-20200907
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
ports:
- "6900:5900"
selenium-hub:
image: selenium/hub:4.0.0-alpha-7-prerelease-20200907
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
restart: always
My behat.yml:
extensions:
Behat\MinkExtension:
base_url: "http://localhost"
browser_name: 'chrome'
sessions:
my_session:
selenium2:
wd_host: "http://selenium-hub:4444"
browser: chrome
capabilities: { "browserName": "chrome"}
FriendsOfBehat\SymfonyExtension: null
For a moment I thought it was related to the "capabilities" parameter so I tried to put things in it but it didn't change anything, and I guess if it was just that, the hub would still tell me that it is ready.
Any idea ? Thank you
I made it work with a previous version the the image of chrome selenium/node-chrome:3.141.59-oxygen .
And I had to change the base_url in behat.yml for the container "url" of my webserver. (http://nginx is my case)

Understanding Appium Inspector log

I am starting to use Appium and I am trying to open up the simulated device. However, I do not understand this message. It starts getting looped again and again. What am I missing for this one?
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' appium/build/lib/main.js --debug-log-spacing --automation-name "Appium" --platform-name "Android" --platform-version "5.1" --app "/Users/wangeltamang/Downloads/AUT.apk" --avd "Nexus_S_API_19"
[Appium] Welcome to Appium v1.5.3
[Appium] Non-default server args:
[Appium] debugLogSpacing: true
[Appium] platformName: 'Android'
[Appium] platformVersion: '5.1'
[Appium] automationName: 'Appium'
[Appium] app: '/Users/wangeltamang/Downloads/AUT.apk'
[Appium] avd: 'Nexus_S_API_19'
[Appium] Deprecated server args:
[Appium] --platform-name => --default-capabilities '{"platformName":"Android"}'
[Appium] --platform-version => --default-capabilities '{"platformVersion":"5.1"}'
[Appium] --automation-name => --default-capabilities '{"automationName":"Appium"}'
[Appium] --app => --default-capabilities '{"app":"/Users/wangeltamang/Downloads/AUT.apk"}'
[Appium] --avd => --default-capabilities '{"avd":"Nexus_S_API_19"}'
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] platformName: 'Android'
[Appium] platformVersion: '5.1'
[Appium] automationName: 'Appium'
[Appium] app: '/Users/wangeltamang/Downloads/AUT.apk'
[Appium] avd: 'Nexus_S_API_19'
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.5.3"...
This part of the log is showing Appium being launched. It starts off with showing the used command, then moves on to show the DesiredCapabilities for your launch.
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' appium/build/lib/main.js --debug-log-spacing --automation-name "Appium" --platform-name "Android" --platform-version "5.1" --app "/Users/wangeltamang/Downloads/AUT.apk" --avd "Nexus_S_API_19"
[Appium] Welcome to Appium v1.5.3
[Appium] Non-default server args:
[Appium] debugLogSpacing: true
[Appium] platformName: 'Android'
[Appium] platformVersion: '5.1'
[Appium] automationName: 'Appium'
[Appium] app: '/Users/wangeltamang/Downloads/AUT.apk'
[Appium] avd: 'Nexus_S_API_19'
[Appium] Deprecated server args:
[Appium] --platform-name => --default-capabilities '{"platformName":"Android"}'
[Appium] --platform-version => --default-capabilities '{"platformVersion":"5.1"}'
[Appium] --automation-name => --default-capabilities '{"automationName":"Appium"}'
Below that you can see the GET command to check for the server status, as well as the response from the command (which is the section that's looping).
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.5.3"...
Also you should know about response codes in appium logs like
0 for success
7 NoSuchElement etc.
https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
After reading this webpage you will be able to easily understand appium logs
I am assuming that you are working with the GUI from the format of you appium log.
Make sure you select the "Prelaunch Application" in the General Settings
See screenshot

Codeception environments config in 2.1.1 (environment matrix)

I am trying to run a test suite using configs from two environments (this is a feature implemented in 2.1 - http://codeception.com/docs/07-AdvancedUsage#Environments) and when I run bin/codecept suite --env env1,env2 it just runs full resolution on chrome, which is the default setting in codeception.yml. Here is the contents of env1 and env2:
env2:
modules:
config:
WebDriver:
window_size: 320x450
capabilities: []
env1:
modules:
config:
WebDriver:
browser: 'firefox'
env1.yml and env2.yml are correctly placed in the _envs forlder, and the path to this folder is specified in codeception.yml.
The yml of the suite I am trying to run is:
class_name: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- WebDriver
This is codeception.yml:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
enabled:
- \Helper\Acceptance
- WebDriver
config:
WebDriver:
url: 'http://myurl.com/'
browser: 'chrome'
host: 127.0.0.1
port: 4444
window_size: 1920x1080
you have to run it with the following, otherwise codeception combines the settings:
--env env1 --env env2

Resources