Selenium & Docker: I can't load custom chrome user profile - selenium

I opened the following issue a cuple days ago but apparently it isn't an issue but my problem persist. I hope someone can help me to understand what is wrong :D
https://github.com/SeleniumHQ/docker-selenium/issues/790
Resume:
I'm trying to run a test using selenium + javascript in a docker machine.
The test run ok but I can't load the user profile adding:
options.addArguments(`user-data-dir=/miCustomProfilePath`);
If I execute my test using the image node-chrome-debug I can check in the configuration that always the path is something like:
/tmp/.org.chromium.Chromium.iBLIx2/Default
Docker compose:
version: "2"
services:
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug:latest
depends_on:
- selenium-hub
ports:
- "5900:5900"
volumes:
- /dev/shm:/dev/shm
- /Users/osvaldo/profiles/custom_profile:/home/seluser/custom_profile
environment:
- HUB_HOST=selenium-hub
- NODE_MAX_INSTANCES=5
- NODE_MAX_SESSION=5
Javascript code:
let options = new chrome.Options();
options.addArguments(`user-data-dir=/home/seluser/custom_profile`);
driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.usingServer('http://localhost:4444/wd/hub')
.build();
I tried generate the profile from the console and running a test with a new user-data-dir.
Same issue on Debian and Mac.
Have you an idea where is the issue?
Thanks!

I figured out that we should set the capabilities of goog:chromeOptions instead of chromeOptions. It should be done automatically if we have the correct binding. I changed my selenium version to 3.14 and it sets the capabilities to goog:chromeOptions and it loads my custom chrome profile
I found it from this link
https://github.com/elgalu/docker-selenium/issues/201

Related

CircleCI is triggering slack notification before my Cypress tests run

I'm totally new to testing, CircleCI, and software engineering generally. I put in a big shift today to try and write a simple Cypress test, use CircleCI to run it every hour, and post to Slack whether it was successful.
The first two I've managed, but integration with Slack has proven more difficult than I imagined. I suspect it's because I'm getting the config.yml wrong. Here's the code.
version: 2.1
orbs:
node: circleci/node#4.5.1
cypress: cypress-io/cypress#1.28.0
slack: circleci/slack#4.4.2
jobs:
notify:
executor:
name: node/default
steps:
- slack/notify:
channel: general
event: fail
template: basic_fail_1
mentions: '#Jac'
- slack/notify:
channel: general
event: pass
template: success_tagged_deploy_1
mentions: '#Jac'
workflows:
version: 2
commit-workflow:
jobs:
- cypress/run:
record: true
store_artifacts: true
- notify:
context: slack-secrets
thirty-min-workflow:
triggers:
- schedule:
cron: "0,30 * * * *"
filters:
branches:
only:
- main
jobs:
- cypress/run
- notify:
context: slack-secrets
The tests are running fine, as scheduled, and a notification is pushing to Slack, but the notification triggers as soon as the build starts and is not dependent on the outcome of the tests.
I've racked my brain on this final point for hours, so I'm hoping it's an easy fix!
I managed to figure this out. Fairly simple in the end. I added a post-steps property beneath cypress/run, which will run after the tests. By placing slack/notify beneath post-steps, it successfully ran after my tests and reflected the result.
Here's the config.yml file.
version: 2.1
orbs:
node: circleci/node#4.5.1
cypress: cypress-io/cypress#1.28.0
slack: circleci/slack#4.4.2
workflows:
version: 2
commit-workflow:
jobs:
- cypress/run:
post-steps:
- slack/notify:
channel: general
event: fail
template: basic_fail_1
mentions: '#Jack'
You can also add a when attribute to the cypress job and check for on_success value, if the job is successful then trigger slack notify job - for more help - https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

Error running Karate ui test in containers

I am having an issue running karate UI tests in the containers.
I am able to clearly run the tests in the local .But my test runs in container says "ERROR com.intuit.karate - driver config / start failed:"
I am using driver config as below
configure driver = { type: 'chrome', headless: true, showDriverLog: true, addOptions: ['--incognito'], httpConfig: { readTimeout: 120000 }}
I am not using any other configs.
Has anyone been in this situation
Containers are not easy and you seem to be trying some approach of your own (also headless). Please follow the Karate documentation and use the recommended Docker containers.
https://github.com/intuit/karate/tree/master/karate-core#karate-chrome
If still stuck kindly follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and help up improve / fix the framework (and provide more details).

Running selenium tests using Behat Drupal Extension inside DDEV containers

Problem: Get Behat Drupal Extension based testing working inside of ddev containers. This includes adding a separate selenium container to the existing configuration, being able to run Behat tests, and having the be able to reference the web host container.
Prerequisites: have a working ddev instance hosting Drupal. There are examples already to set that up, so I won't repeat that here.
The above task required the following additions:
selenium container: The container running selenium. I used the chrome standalone version. Add the following to your .ddev folder:
File: docker-compose.selenium.yml
version: '3.6'
services:
selenium:
container_name: ddev-${DDEV_SITENAME}-selenium
image: selenium/standalone-chrome-debug:3.13.0-argon
networks:
default:
aliases:
- web
The last bit is critical; the selenium container needs to know about the web container running the drupal instance to connect to it, but as it is a dependency of the web container, you can't use 'links'. You have to use the aliases approach, using the default network.
compose override: A file overriding the defaults for the web container to link the selenium container to it.
File: docker-compose.override.yml
version: '3.6'
services:
web:
depends_on:
- db
- selenium
links:
- db:db
- selenium:selenium
Behat configuration: The following Behat configuration for MinkExtension worked for me:
(modify file behat.yml)
default:
extensions:
"Behat\\MinkExtension":
goutte: null
base_url: 'http://web'
javascript_session: selenium2
selenium2:
browser: "chrome"
wd_host: http://selenium:4444/wd/hub
capabilities:
extra_capabilities:
idle-timeout: 50
base_url and wd_host entries were critical in getting this to work.
For more information on the last, see step 5 in the Behat Drupal Extension docs:
Configure your testing environment by creating a file called behat.yml with the following. Be sure that you point the base_url at the web site YOU intend to test. Do not include a trailing slash:
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Drupal\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://seven.l
Drupal\DrupalExtension:
blackbox: ~

Codeception acceptance test not working with firefox

I am trying to run an acceptance test on firefox using selenium 3.0.1. I am also using wp-browser WPWebDriver module. My acceptance-suit.yml looks like this.
class_name: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- WPWebDriver
config:
WPWebDriver:
url: 'url'
adminUsername: 'juhi.saxena#gmail.com'
adminPassword: '123456'
adminPath: '/wp-admin'
browser: firefox
webdriver.gecko.driver: 'bin/geckodriver.exe'
On runnuning this wpcept run acceptance testsCest.php I get [Facebook\WebDriver\Exception\UnknownServerException] The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded fro
m https://github.com/mozilla/geckodriver/releases
Try removing the '.exe'.
I'm running successfully with webdriver.gecko.driver: '/usr/local/bin/geckodriver'.
Also, have you placed the geckodriver.exe in the path?
I solved a similar problem with Codeception and Firefox by adding path='' to the WebDriver config section.

acceptance testing with selenium and codeception, browser shows blank page

I'm using codeception with Yii2 and my configuration is as follows:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://ucms.ac.ir/admin/index-test.php/'
browser: chrome
- tests\codeception\common\_support\FixtureHelper
- Yii2
config:
Yii2:
configFile: '../config/backend/acceptance.php'
tests run, and they finish successfully, but nothing appears on the new browser tab opened by selenium. I've seen some tutorials and in those tutorials browser actually shows process of testing. also, when an error occurs and a screenshot is taken by codeception for later reference, it's only a white empty page too.
I'm on ubuntu 14.10, selenium 2.47.1 and chrome 45. it also happens when I use firefox instead of chrome.
I asked same question in codeception's github repo and here's the answer:
Don't use Yii2 and WebDriver in the same suite.
My fault, this is corrected configs:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://ucms.ac.ir/admin/index-test.php/'
browser: chrome
- tests\codeception\common\_support\FixtureHelper