Closed andreaschiffo closed 2 years ago
Hi, what command do you use to: a) start selenium server (or some browser driver / docker) b) start steward
What version of selenium / browsers do you use?
Could you also provide output of steward run
with -vvv
options?
Hi @OndraM thanks for taking care
a) start selenium server (or some browser driver / docker)
I'm using Chrome standalone for debugging locally (to which this issue referes),
java -jar -Dwebdriver.chrome.driver="./vendor/selenium/chromedriver" -jar ./vendor/selenium/selenium-server-4.0.0.jar standalone
though on CI it will be run against a docker container in headless mode; from docker-compose file:
[...]
services:
chrome:
image: selenium/node-chrome:4.0.0-20211013
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_GRID_URL=http://localhost:4444
ports:
- "6900:5900"
volumes:
- /tmp:/dev/shm:rw
[...]
acme-qa:
depends_on:
- selenium-hub
- chrome
- firefox
image: acme/qa-automation
environment:
- HUB_PORT_4444_TCP_ADDR=hub
- HUB_PORT_4444_TCP_PORT=4444
links:
- selenium-hub
volumes:
- .:/wd/src
selenium-hub:
image: selenium/hub:4.0.0-20211013
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
b) start steward
vendor/bin/steward run staging chrome --pattern CheckoutTest.php -vvv
Could you also provide output of steward run with -vvv options?
Using the above command, here it is:
aschiffo@mypc:~/Documents/Andrea/Acme/acme-qa-automation$ vendor/bin/steward run staging chrome --pattern CheckoutTest.php -vvv
Steward 3.0.0-DEV is running the tests... Just for you <3!
Browser: chrome
Environment: staging
Screen size:
Path to logs: /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs
Ignore delays: no
Parallel limit: 50
Selenium server (hub) url: http://localhost:4444/wd/hub, trying connection...OK
Searching for testcases:
- in directory "/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/tests"
- by pattern "CheckoutTest.php"
Found testcase file #1: /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/tests/CheckoutTest.php
Testcase "Acme\QAAutomation\CheckoutTest" is prepared to be run`
`Starting execution of testcases
-------------------------------
[2021-11-29 00:40:40] Execution of testcase "Acme\QAAutomation\CheckoutTest" started with command:
'/usr/bin/php7.4' '/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/lmc/steward/bin/phpunit-steward' '--log-junit=/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs/Acme-QAAutomation-CheckoutTest.xml' '--configuration=/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/lmc/steward/src/phpunit.xml' '--colors=always' '/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/tests/CheckoutTest.php'
[2021-11-29 00:40:40] Waiting (running: 1, queued: 0, done: 0)
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:40] Registering test results publisher "Lmc\Steward\Publisher\XmlPublisher"
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> PHPUnit 8.5.21 by Sebastian Bergmann and contributors.
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:40] --- Starting execution of test "testItemCanBePutInShoppingCart" ---
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:40] Initializing "chrome" WebDriver
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WARN] Error publishing test started status to "Lmc\Steward\Publisher\XmlPublisher" ("Argument 1 passed to Lmc\Steward\Selenium\SeleniumServerAdapter::getSessionExecutor() must be of the type string, null given, called in /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/lmc/steward/src/Publisher/XmlPublisher.php on line 277")
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> E 1 / 1 (100%)
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WARN] Error publishing test done status to "Lmc\Steward\Publisher\XmlPublisher" ("File "/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs/results.xml" was already opened by this XmlPublisher and closed")
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [DEBUG] Base URL set to "https://stg.acme.com/"
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Loading URL "https://stg.acme.com/us_en/bath/fittings/faucets"
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Executing command "get" with params {"url":"https://stg.acme.com/us_en/bath/fittings/faucets"}
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Executing command "setWindowSize" with params {"width":1280,"height":1024,":windowHandle":"current"}
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Executing command "findElement" with params {"using":"class name","value":"close-widget-newsletter"}
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Executing command "getCurrentUrl" with params []
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:44] [WebDriver] Executing command "screenshot" with params []
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WebDriver] Executing command "getPageSource" with params []
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45]
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WARN] Test failed on page "/session//url", taking page snapshots:
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] Screenshot: "/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs/Acme-QAAutomation-CheckoutTest-testItemCanBePutInShoppingCart-2021-11-29-00-40-44.png"
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] HTML snapshot: "/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs/Acme-QAAutomation-CheckoutTest-testItemCanBePutInShoppingCart-2021-11-29-00-40-44.html"
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45]
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] Destroying "chrome" WebDriver for session ""
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WebDriver] Executing command "close" with params []
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WebDriver] Executing command "quit" with params []
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] --- Finished execution of test "testItemCanBePutInShoppingCart" ---
Acme\QAAutomation\CheckoutTest> [2021-11-29 00:40:45] [WARN] Error publishing process done status to "Lmc\Steward\Publisher\XmlPublisher" ("File "/home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/logs/results.xml" was already opened by this XmlPublisher and closed")
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> Time: 4.6 seconds, Memory: 8.00 MB
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> There was 1 error:
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> 1) Acme\QAAutomation\CheckoutTest::testItemCanBePutInShoppingCart
Acme\QAAutomation\CheckoutTest> TypeError: Argument 1 passed to Facebook\WebDriver\Remote\JsonWireCompat::getElement() must be of the type array, string given, called in /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php on line 211
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/php-webdriver/webdriver/lib/Remote/JsonWireCompat.php:21
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:211
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/php-webdriver/webdriver/lib/WebDriverExpectedCondition.php:176
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/php-webdriver/webdriver/lib/WebDriverWait.php:54
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/lmc/steward/src/Test/SyntaxSugarTrait.php:320
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/vendor/lmc/steward/src/Test/SyntaxSugarTrait.php:48
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/tests/Pages/WWBasePage.php:54
Acme\QAAutomation\CheckoutTest> /home/aschiffo/Documents/Andrea/Acme/acme-qa-automation/tests/CheckoutTest.php:30
Acme\QAAutomation\CheckoutTest>
Acme\QAAutomation\CheckoutTest> ERRORS!
Acme\QAAutomation\CheckoutTest> Tests: 1, Assertions: 0, Errors: 1.
Acme\QAAutomation\CheckoutTest>
[2021-11-29 00:40:45] Finished execution of testcase "Acme\QAAutomation\CheckoutTest" (result: failed, time: 4.7 sec)
[2021-11-29 00:40:45] Waiting (running: 0, queued: 0, done: 1 [failed: 1])
[2021-11-29 00:40:45] All testcases done in 4.8 seconds
[ERROR] Testcases executed: 1 (failed: 1)`
I think this is related to https://github.com/php-webdriver/php-webdriver/issues/944
Resolved updating to latest chromedriver
I can confirm this happened right after updating chrome to the latest version. Updating chromedriver to the latest resolves. https://chromedriver.chromium.org/downloads
https://github.com/lmc-eu/steward/blob/5868bdf18eb060d607c6def84e2da92121b4c5f1/src/Test/SyntaxSugarTrait.php#L28
I have a test that does
hence goes through the SyntaxSugarTrait
waitForClass
method, which eventually fails in php-webdriverHere it is shown how waitForElement is correctly used. Even though in the end fails on the actual result found as it's a string instead of an expected array And also it seems it's returning that path without any session or similar instead of the actual Element.
Any ideas?