pytest-dev / pytest-dev/pytest-xdist

Xdist sends invalid URL to selenium?

Open
#512 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

Hello. Please help me to figure out issue launch in parallel selenium based test via pytest and xdsit.
I have two firefox instance at docker and launch 2 independent test this way:
pytest -k "crypto" -n2

My Pipfile:

pytest==5.1.2
pytest-bdd==3.2.1
pytest-xdist==1.31.0
pytest-base-url==1.4.1
pytest-selenium==1.17.0

gcloud==0.18.3
firebase==3.0.1
python_jwt==3.2.4
sseclient-py==1.7
py-postgresql==1.2.1
requests-toolbelt==0.9.1
arrow==0.15.4
kombu==4.6.7

My pytest.ini

[pytest]
bdd_features_base_dir = tests
base_url = https://projectname.com
sensitive_url = https://projectname.com
addopts = --driver Remote
          --port 4444
          --capability browserName firefox
          --html tests/logs/report.html
          --cucumberjson=tests/uploads/cucumber.json
          --cucumberjson-expanded
          -v
filterwarnings =
    ignore::DeprecationWarning
markers =
    smoke: fast result
    crypto: add calculations

Here is track trace:

result = call_fixture_func(fixturefunc, request, kwargs)
../../.pyenv/versions/3.6.8/envs/projectname/lib/python3.6/site-packages/_pytest/fixtures.py:778: in call_fixture_func
res = fixturefunc(**kwargs)
tests/functional/test_02_deposit_by_dash.py:20: in user_signed_in
page_main.open()
../../.pyenv/versions/3.6.8/envs/projectname/lib/python3.6/site-packages/pypom/page.py:130: in open
self.driver_adapter.open(self.seed_url)
../../.pyenv/versions/3.6.8/envs/projectname/lib/python3.6/site-packages/pypom/selenium_driver.py:48: in open
self.driver.get(url)
../../.pyenv/versions/3.6.8/envs/projectname/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:333: in get
self.execute(Command.GET, {'url': url})
../../.pyenv/versions/3.6.8/envs/projectname/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)


self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10faa6f98>
response = {'status': 400, 'value': '{"value":{"error":"invalid argument","message":"Malformed URL: / is not a valid URL.","stack...dArgumentError@chrome://marionette/content/error.js:304:5\nget@chrome://marionette/content/listener.js:1132:19\n"}}'}
E selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: / is not a valid URL.

See more at screenshoot.
It works without -n2:
pytest -k "crypto"

Screenshot 2020-03-09 at 16 14 51 Screenshot 2020-03-09 at 16 15 18

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported pytest.ini settings and the pytest -k "crypto" -n2 command, then inspect tests/functional/test_02_deposit_by_dash.py where page_main.open() triggers the failure. Compare the URL passed to Selenium in parallel and non-parallel runs; done means parallel execution no longer sends '/' as the browser URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.