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

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.

Related

Selenium Tests running locally but failing on Azure DevOps Pipeline

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.

Selenium+Jenkins+Chromedriver = WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

I have problem with running my Selenium tests in Jenkins.
A result of execution is always:
WebDriverException: Message: unknown error: Chrome failed to start:
exited abnormally
My tests are written in Robot Framework and are using Chromium webdriver.
I'm setting needed paths in my command, which looks like this:
export PATH=$PATH:/usr/lib/chromium-browser; export PATH=$PATH:/usr/lib/chromium-browser/chromedriver; . /home/michal/robot_env/bin/activate; robot -L TRACE /home/michal/project_robot/tests
And when I run this command manually in terminal IT WORKS fine (Chromium starts automatically and the test goes on).
So the problem suppose to be in Jenkins. I have installed Xvfb plugin, but it didn't help.
Additionally, in /etc/init.d/jenkins I put these lines:
/usr/bin/X :0 vt7 -ac
export DISPLAY=:0
xhost +
And once again - nothing changed. What else should I set or check?
i got stuck same way.
The problem is that jenkins has it own user, called jenkins, and jenkins user cannot open the browser.
if you try to make "su jenkins" and then "chromium-browser" you obtain the display error.
That because you obtain this issue. The problem is not the webdriver, the problem is the user.
i removed the jenkins user created by jenkins and i createad a normal user called jenkins before installing jenkins.
then i installed jenkins.
now jenkins user can run the test (because it can open the browser) but jenkins itself will not load anymore.

Unable to run a test from MTM - Config issue

I have set up a Test Controller and Test Agent running in separate machines and they are able to communicate with each other.
When I try to run the test from MTM (Selenium Tests), the test failed with the below error message
(QTController.exe, PID 1104, Thread 15) Could not use lab service account to access the build directory.
Failure: Network path does not exist or is not accesible using following user:
https://mydevelopment.visualstudio.com/defaultcollection/c2f372df-8c45-487a-9b51-4ced6e8f6037/_apis/build/builds/969/artifacts?artifactName=drop&%24format=zip
using MYDEV\timothy.alex. Error Code: 67
(QTController.exe, PID 1104, Thread 15) TcmRunner: Error starting the test run: The build directory of the test run either does not exist or access permission is required..
This clearly mentions that the error is because of access issue. But when I try downloading the build from the url mentioned in the error log using the same credentials mentioned in the ERROR log, I am able to download the drop zip file.
Is there any thing I am missing in the set up. Any help would be really really great.
It looks like you're using the new task-based build system. You can't run automated tests from a task-based build from MTM at present -- you have to use the older XAML build system for that.

Failed to integrate Bugzilla Testopia with Jenkins with the aid of Testopia Plugin - cannot execute any iterative build step

I’m trying to integrate Bugzilla Testopia with Jenkins with the aid of the Testopia Plugin for Jenkins.
The general configuration is probably fine as the connection between Testopia and Jenkins is well established (Jenkins log says: ‘Connecting to Testopia to retrieve automated test cases’ and no error occurs then). However I’m unable to retrieve any information concerning Test Runs/Test Cases etc. from Testopia.
Moreover I cannot perform any of ‘Iterative Test Build Steps’. If I want to ‘Execute Shell’ in ‘Iterative Test Build Steps’ with Testopia Plugin no operation is carried out (even if I try: echo 12345 etc.). If I use ‘Single Test Build Steps‘ then shell command is executed.
My goal is to retrieve test class name from Testopia (it is stored in Testopia Test Case’s field - Automation/Scripts ) and then run maven build from Jenkins with this class name set as the parameter. Afterwards depending on the Jenkins build success or failure status I’d like to update the Test Case Status in Testopia.
How to fetch any information from Testopia into Jenkins?
Why any of ‘Iterative Test Build Steps’ is not executed?
Any clues? - Testopia Plugin site example wasn't too helpful for me.
Both Bugzilla and Jenkins are hosted on the same Ubuntu 14.04. I've got the latest stable versions of Jenkins, Bugzilla and Testopia.
Thanks in advance,
M.
EDIT:
Well this debugging does not work for me. I added a new log recorder with the 'ALL' level chosen and I cannot see any additional log neither in job's console output nor in the newly created logger output.
Maybe sth is wrong with my Testopia installation? Some more details concerning my configuration:
I've got Testopia installed on the same machine (as Jenkins) and usually I access it through: http://'ip_address'/bugzilla
- in Testopia plugin configuration my URL to Testopia installation is: http://'ip_address'/bugzilla/xmlrpc.cgi
- I've got only one bugzilla account - these admin's credentials I use in Jenkins
- sometimes in Jenkins I can see a warning concerning improper reverse proxy configuraiton - maybe it has sth to do with the problem
After job execution all Testopia's fields are 0 - Run Id, Build Id etc. - which obviously indicates that no information was successfully retrieved from Testopia.
Any ideas how to check why I cannot retrieve any information from Testopia?
EDIT 2:
In the meantime I think I've found a clue in the jenkins.log file in jenkins installation directory:
Exceptions like these occur:
INFO: TESTOPIA_TEST_SUITE_3 #13 main build action completed: SUCCESS
org.apache.xmlrpc.XmlRpcException: The requested method 'TestRun.get' was not found.
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
...
org.apache.xmlrpc.XmlRpcException: The requested method 'TestRun.get_test_cases' was not found.
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
Shall I insert the full stacktrace?
It looks like that plugin logs a fair amount of information, though not all of it to the build console output itself.
To debug further, you could try adding a new log recorder for the logger jenkins.plugins.testopia (with log level "all"), run a build, then refresh the web page for the newly-created log recorder to see the output.
You should at least see "Filtering for automated test cases" after connection, information about each test case found, and then log output for each iterative build step as it's run on each test case.
I got the similiar problem when I use python xmlrpc to commnicate with my bugzilla-testopia server.
I chekc the error code and find XMLRPC.pm under my bugzilla install location : "./WebService/Server/XMLRPC.pm".
I know the error was thrown by this sub function, which checks login status and forward to modules where the moduel.function must be in PUBLIC_METHODS:
sub handle_login {
...
if (none { $_ eq $method } $class->PUBLIC_METHODS) {
ThrowCodeError('unknown_method', { method => $full_method });
}
...
}
I don't know why but TestCase.get could not be found in PUBLIC_METHODS, so I just marked them as comment and then it works. You can do this quick way to make sure your client setting is correct. Then you should solve the "PUBLIC_METHODS" problem next.

Playframework test-runner selenium permission denied Location.href and Command Execution Failure

This test works locally, but when run from the Play test runner on our aws ci instance, I get the following permissions error in Firefox: Permission denied for HOST to get property Location.href and then Command execution error.
In Chrome, the remote message is different, but I sense the same underlying reason. Object <> has no method 'getCurrentWindow'.
Is it this issue? http://code.google.com/p/selenium/issues/detail?id=703
you are using the Play standard test runner from a remote location, which is the source of the issue (as far as I know).
Try to use play auto-test as described here to run the tests.