Selenium Tests running locally but failing on Azure DevOps Pipeline - selenium

I'm kind new to the DevOps world, and I'm having an issue where my test team can run their tests locally however some of them are failing when using a Pipeline.
The tests that are failing are upload files ones, however this only happens on a specific webpage of our solution.
Any idea of what can be happening?
Pipeline Steps:
We are using an Azure Agent (windows 2019)
1 - We install Google chrome webdrive (its then configured on the code)
2 - We run the following Maven script
mvn clean verify -P $(MavenProfiles) -e -Dcucumber.options="--tags $(Tags)" -
Dheadless=$(headless) -Denv=$(Environment) -Dlog4j.configurationFile=src/log4j2.xml
This is the error the the test throws:
java.lang.IllegalStateException: WebElement 'By.cssSelector: [id='Client_Name']' was not found on page. Exception: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for ui.controllers.GlobalUtilities$1#29a33620 (tried for 16 second(s) with 2000 milliseconds interval)
I noticed this error all through the pipeline logs, however only fail on specific tests.

Related

Unable to run testcafe tests on CI/CD gitlab but works fine locally on the runner

I am seeing an issue running testcafe tests on the gitlab runner. The tests runs fine locally on the gitlab runner, but when run off the CI/CD pipeline it fails. Below is my .yaml code -
test-e2e-windows:
stage: test
cache:
<<: *global_cache
policy: pull
#needs: ['yarn-install']
tags:
- win32
script:
- yarn install
- yarn run test:e2e
Below is the error I see -
$ yarn run test:e2e
Running tests in:
Chrome 99.0.4844.82 / Windows 10
Audio Configuration Combination
× Inbuilt_Mic_Recording_1Ch_48 khz_16 bit_64 kbps_opus_webm
A JavaScript error occurred on
"https://dolby-web-sdk-dev.net/sandbox/index.html".
Repeat test actions in the browser and check the console for errors.
To ignore client-side JavaScript errors, enable the
"--skip-js-errors" CLI option, or set the "skipJsErrors"
configuration file property to "true".
If the website only throws this error when you test it with
TestCafe, please create a new issue at:
"https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md".
JavaScript error details:
NotFoundError: Requested device not found
No stack trace available
Am I missing something here?
According to the "Requested device not found" error message, this issue is related to your application implementation:
DOMException: Requested device not found GetUserMedia.
Requested device not found - Unable to access Camera and Microphone
I can assume that it tries to access some device on a virtual machine but fails due to the fact that this device does not exist. In my opinion, the best way to resolve this issue is to manually handle this error in your application.
If my assumptions are wrong, please create a new GitHub issue using this template and share a minimal working example illustrating the issue.

can't trigger a test of some appllication via Jenkins job

I am a beginner at the field of Devops.
I have created a simple web application (jsp), using 3 Jenkins jobs to store the code in GIT, to deploy the this app into Tomcat, and also to site-monitor this app (respectively).
Now, I have been trying - with no success -to automate a simple test with 2 verifications of my app functionality, using Selenium IDE and triggering it via Jenkins job (the fourth one in my project).
In order to perform it , I created the following job on Jenkins, with the needed plugin added (which is SeleniumHQ htmlsuite Run).
Here is the job:
https://i.stack.imgur.com/6Pm6a.png
The job running has failed,giving the following error which I cant handle.
When I run it, I get the following error :
https://i.stack.imgur.com/hXGmI.png
Any help would be very appreciated
Just tick Delete workspace before build starts box under Build Environment stanza
If you don't have the option in your Jenkins job configuration - make sure that Workspace Cleanup Plugin is installed
If you're running your Selenium tests via Jenkins Pipeline - all you need to do is to put cleanWS() directive somewhere in your pipeline code or Jenkinsfile

Unexpected job aborting in jenkins when using katalon to execute automatic tests

I’m executing automatic tests using Katalon in console mode.
Sometimes job executed by Jenkins ends unexpectedly without any error.
Katalon Studio version 5.10.1,
Jenkins version 2.121.3
I've tried to find some Jenkins logs other than console logs, which logged why that job is aborted
Jenkins console logs:
/var/lib/jenkins/.katalon/5.10.1/Katalon_Studio_Linux_64-5.10.1/katalon -noSplash -runMode=console -projectPath=/var/lib/jenkins/workspace/(...) -browserType=Firefox -testSuitePath=Test Suites/MainTestingSuite
Delete folder: Libs
Opening project file: /var/lib/jenkins/workspace/(...).prj
Request sent successfully.
[EL Warning]: 2019-05-10 13:54:15.046–Ignoring attribute [lastRun] on class [TestSuiteEntity] as no Property was generated for it.
**Build step ‘Execute shell’ changed build result to UNSTABLE**
Got SIGTERM, exiting
In exit
Terminating xvnc.
$ vncserver -kill :80
Killing Xvnc4 process ID 29224
Archiving artifacts
‘Reports/MainTestingSuite/’ doesn’t match anything, but ‘’ does. Perhaps that’s what you mean?
No artifacts found that match the file pattern “Reports/MainTestingSuite/”. Configuration error?
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
Someone already had that problem? How to track that case?
I’m waiting for your answer.
I’ve finally found cause of that problem.
Katalon job failed like that, when you try executed two Katalon instances at the moment. I’ve changed number of executors at jenkins to 1, and problem is not occuring anymore.
Best Regards

Selenium and Jenkins, test suite works in commandline not on jenkins

I've got a Selenium stand alone server, I run a simple test suite with a simple test case in command line and it works, here is the command line :
java -jar D:\POC\selenium-server-standalone-2.45.0.jar -Dhttp.proxyHost=XXXX -Dhttp.proxyPort=8080 -Dhttp.proxyUser=XXXX -Dhttp.proxyPassword=XXXX -htmlSuite *firefox http://XXXXX D:\Users\XXXX\Desktop\test_selenium.html D:\Users\XXXX\Desktop\result_selenium.html -firefoxProfileTemplate "C:\Users\XXXXX\AppData\Roaming\Mozilla\Firefox\Profiles\1yd4vpna.selenium" -debug
The same command is used by jenkins to run the test, here is the selenium result file :
info: Starting test /selenium-server/tests/test_case_selenium.html
info: Executing: |open | /index.php/fr/ | |
warn: currentTest.recordFailure: Timed out after 30000ms
info: Executing: |clickAndWait | css=li.item-175.first > a.subMenuBtn > span | |
error: Element css=li.item-175.first > a.subMenuBtn > span not found
warn: currentTest.recordFailure: Element css=li.item-175.first > a.subMenuBtn > span not found
When I read command line logs, Jenkins and commandline are different from firefox launch. On command line I can see a firefox poping, not with jenkins.
Without -debug, jenkins stops at "checking resource aliases".
I launched tomcat for jenkins as admin, still got my problem.
Any ideas?
From the paths being referenced, it looks like your Selenium server is in a Windows environment.
Since Selenium interacts with the desktop, make sure that the user account your Jenkins service is running under has the appropriate permissions to do that. (ie, run it as a named account and give that account access to the desktop via Computer Management / Services).
That would explain why you're seeing different behaviour running from the command line (as your user account) compared to in Jenkins (as the Jenkins service user account).
You can try js-code to fix this error. JS-redirect. As:
storeEval window.location="http://yourWebsiteToOpen.com"; js
echo ${js}
At least It helped for us.

jenkins error FATAL: Unable to find build script at C:\selenium tests for moveon\moveon4tests1\build.xml

I am using Jenkins and Ant to run my selenium tests. It works fine when I run them on my local machine.
Now I have a Jenkins server which is on a different location and I have to run my tests on that server.
when I tried to run the tests on that server Its is failing because it couldn't find the build.xml file. can you please let me know how can I change the home directory path?
Started by user :**********
Building in workspace /var/lib/jenkins/jobs/moveon4 java tests/workspace
FATAL: Unable to find build script at C:\selenium tests for move\movetests1\build.xml
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
Are you using "Invoke Ant" in your Jenkins job configuration for the build step that executes your Ant build ? If so, the build file location is hidden away in the Advanced section - it's an annoying quirk of Jenkins.