Multithread Pytest - pytest

I wanted to create a test in PyTest where it will parallelly open two Chrome and Firefox browser and test two test cases one by one with valid and invalid sets of inputs. How should I achieve it?
Thanks for your advanced help.

You can achieve this using following methods
Selenium Grid and docker.
Download docker and pull the image for Selenium Hub and Image for Chrome and Image for Firefox. Start the containers and you are good to go.
You can follow the instruction from this page.
https://github.com/SeleniumHQ/docker-selenium
If you do not want to use docker then, you can download selenium grid jar file for hub and nodes in your local machine and manually trigger them using the command prompt. following link can be useful they have explained it very nicely
https://www.guru99.com/introduction-to-selenium-grid.html
https://www.selenium.dev/documentation/en/grid/grid_4/setting_up_your_own_grid/

Related

How to run exported Parameters Variation experiment in a headless environment automatically?

I would like to run an exported Parameters Variation experiment on my Linux machine. Although there is a way for setting a Simulation experiment to start automatically running the batch file (or .sh file for Linux) once the file is opened, I cannot find a similar option for Parameters Variation in which I am running 40 different replications of the same model. In Windows, you need to open the file and manually click the Run button for this.
Considering Linux OS, which is a headless environment, how can I make the model start automatically once I run the command ./mySimulationModel_linux.sh?
Currently when I run this command, the model does nothing. Any help will be appreciated.
The best option would be to add some code to your "Initial Experiment setup:" section to get it to run without any user input
just add run();
Of course, you can add any of other code as well there.

How to mark a jupyter lab document as trusted when building through mybinder.org so that all codecells are run automaticaly

I need all codecells in a jupyter lab document to run when opening it in binder. I've tried adding jupyter trust <filename> to the postbuild file but it does'nt work. Any tips are welcome.
When you say that it doesn’t work, does it at least show as trusted when you open the notebook? Because that approach is/was recommended way to set to trusted. Until the extension enabling example notebook was streamlined to only include an example that works in both the classic an JupyterLab interface, that was the way documented here. Here discusses how to check if trusted.
However, just setting trusted does not trigger the code to run when the notebook is launched.
Aside of coding extension that will run code like python-markdown, there is no simple way to trigger that in the Binderhub system at this time. When this question came up the other day in the binder gitter channel, I suggested a person could most likely make an empty notebook appear to have just been run by using a start config file to trigger execution of the notebook via nbconvert or papermill.
Alternatively, using Appmode as discussed here will execute all cells when run in app mode; however, the interface won’t be a notebook. Similarly, installing Voila and linking to the Voila render will run code in a notebook at launch. It will look like a web app interface and not a notebook though.

How to pass an browser env parameter for nightwatch-api formerly nightwatch-cucumber?

Nightwatch-cucumber is deprecated and we should use Nightwatch-api as per the author.
I have a set up where I use selenium grid with both a Firefox and Chrome nodes running waiting to be activated. I have not set any webdriver settings in my project. I am still able to run tests but it only takes the default test setting.
How would be able to run tests specifying a browser other than the default?
As per the examples from repo, you should be able to pass it through two files (links below) which will enable you to execute them in desired browser (provided, it is configured in nightwatch.conf.js file).
https://github.com/mucsi96/nightwatch-api/blob/master/packages/selenium-hub-example/test/server.js
https://github.com/mucsi96/nightwatch-api/blob/master/packages/selenium-hub-example/test/support/setup.js
Examples from Repo:
Selenium Grid : https://github.com/mucsi96/nightwatch-api/tree/master/packages/selenium-hub-example
Webdriver : https://github.com/mucsi96/nightwatch-api/tree/master/packages/cucumber-example
Selenium standalone : https://github.com/mucsi96/nightwatch-api/tree/master/packages/cucumber-selenium-example
Please accept this as answer if it helps in resolving your issue.

Running mapbox-gl-js locally (unable to serve debug page)

Edit:
Summary, I tried to follow only the steps listed in the below two links as applies to windows:
https://github.com/mapbox/mapbox-gl-js/blob/master/CONTRIBUTING.md
https://github.com/stackgl/headless-gl#windows
Here I have reattached the screenshot of the commands that I had problems with:
https://imgur.com/RCQCNU5
One more step I took that I should mention is I also did not find the headless gl when I downloaded the repository, when the install headless gl command did not work I manually copied the file and put it in my local copy under the nodemodules directory thinking it would work but it didnt solve anything. I do think this is related to access issues but I dont know what else I should try to get it working?
First, let's clarify your problem: you want a version of mapbox-gl.js which contains a recently fixed bug.
Your best option is to just wait a couple of weeks for a release.
Failing that, you should build your own, from master. You don't need to set up a debug server for that. You can skip straight to the "Creating a Standalone Build" section.
If the steps for building on Windows don't work for some reason, you could set up a local virtual machine running Ubuntu and use that.
But honestly, just wait a couple of weeks. :)
Just in case some one else need to run this on local server.
After clone
Run npm install
npm run start-debug
It will start listening on port 9966.
Test the debug html files entering to
localhost:9966/debug/FILE_NAME_TO_TEST.html

How to run a code analysis locally from the command line using a quality profile on the SonarQube server?

On my SonarQube server I have 2 quality profiles (1 for C# and 1 for JS).
How to run a code analysis from the command line locally using them (retain them on server, without using tools like SonaLint) or using a gulp task?
take a look at the documentation of sonarqube for analyzing source code ( current link https://docs.sonarqube.org/latest/analysis/overview/) - there you find a lot of useful scanners for different environments and languages.
You just need to configure them properly, but this is also something you can find within the docs of sonarqube.
Use the command line scanner. It will run an analysis locally from your command line.
Make sure, that you set sonar.host.url in sonar-project.properties, so that the correct quality profiles will be taken into account.