Friday, June 10, 2016

Protractor : How to implement HTML report in Protractor

In our last post we have seen that how we can generate XML report using XML reporter. Here we see how we can implement Jasmine HTML reporters.

In this post we will use our sample projects that was built in our previous post.

Step 1 : Open the project.

Step 2 :  Open Terminal window and install protractor-jasmine2-html-reporter package using the following command.

npm install protractor-jasmine2-html-reporter --save-dev

image

It installs the following packages

image

Step 3 : Now open config.js file and the following variable for Jasmine2HtmlReporter

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');

Write the following script in onPrepare() function,

image

Here,

jasmine.getEnv().addReporter(): It create report after executing the script.

Jasmine2HtmlReporter() : It generate HTML report.

savePath: Report folder where report is generated. User can define his own path.

Step 4 : Now config.js file will look like the following,

image

Step 5 : Now open terminal window and run selenium server.

image

Step 6 : Open another terminal window and run the script.

image

Step 7 : Note that script executes and report file is created at ‘reports’ folder.

image

Now double click on the htmlReport.html file and see the result. You can also open it through a browser.

image

image

Clicking on right side screenshot image you will see the screenshot in browser.

That’s all for now.

In the next post we will see how we can generate HTML report with different options.

Happy end to end testing using Protractor!!!

Protractor : How to implement HTML report in Protractor

In our last post we have seen that how we can generate XML report using XML reporter. Here we see how we can implement Jasmine HTML reporters.
In this post we will use our sample projects that was built in our previous post.
Step 1 : Open the project.
Step 2 :  Open Terminal window and install protractor-jasmine2-html-reporter package using the following command.
npm install protractor-jasmine2-html-reporter --save-dev
image
It installs the following packages
image
Step 3 : Now open config.js file and the following variable for Jasmine2HtmlReporter
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
Write the following script in onPrepare() function,
image
Here,
jasmine.getEnv().addReporter(): It create report after executing the script.
Jasmine2HtmlReporter() : It generate HTML report.
savePath: Report folder where report is generated. User can define his own path.

Step 4 : Now config.js file will look like the following,
image
Step 5 : Now open terminal window and run selenium server.
image
Step 6 : Open another terminal window and run the script.
image
Step 7 : Note that script executes and report file is created at ‘reports’ folder.
image
Now double click on the htmlReport.html file and see the result. You can also open it through a browser.
image
image
Clicking on right side screenshot image you will see the screenshot in browser.
That’s all for now.
In the next post we will see how we can generate HTML report with different options.
Happy end to end testing using Protractor!!!
























Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...