Having issues generating a report while using jasmine-reporters with Protractor

In the configuration, I utilized the code below:

var jasmineReporters = require('jasmine-reporters');    
onPrepare: function() {
    browser.driver.manage().window().maximize();
    browser.params.envi='DEVINT';
    //For output reports
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter('./test', true, true));

},

The test execution was successful when I ran it, but there are no generated reports visible.

Does anyone have any suggestions on how to resolve this?

Answer №1

I encountered a similar issue and managed to resolve it by:

framework: "jasmine2",  //make sure to include this if using JUnitXmlReporter

    onPrepare: function(){  //setting up junit xml report

        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            filePrefix: 'guitest-xmloutput',
            savePath: 'test/reports'
        }));

    },

You can find detailed instructions in the current documentation available at https://github.com/larrymyers/jasmine-reporters. Scroll down to the section for protractor setup. I resolved my issue by adding the provided code snippet to my protractor.conf.js file.

Answer №2

Here's a solution that has been effective for me:

onPrepare: function () {
    require("jasmine-reporters");

    // Setting up junit reporter
    var capsPromise = browser.getCapabilities();
    capsPromise.then(function (caps) {
        var browserName = caps.caps_.browserName.toUpperCase();
        var browserVersion = caps.caps_.version;
        var prePendStr = browserName + "-" + browserVersion + "-";
        jasmine.getEnv().addReporter(new
            jasmine.JUnitXmlReporter("test-results", true, true, prePendStr));
    });
},

Utilizing jasmine version 1.3, jasmine-reporters version 1.0.1, and protractor version 2.0.

Answer №3

s-patchamatla To resolve the issue, you must downgrade your version of Jasmine to [email protected]

The newer versions of jasmine reporters are no longer compatible with the Jasmine object.

If you are using jasmine-reporters with Protractor, make sure to use a 1.x version of jasmine-reporters.

Simply run npm install jasmine-reporters@~1.0.0

onPrepare: function () {
    require("jasmine-reporters");

    // junit reporter
    var capsPromise = browser.getCapabilities();
    capsPromise.then(function (caps) {
        var browserName = caps.caps_.browserName.toUpperCase();
        var browserVersion = caps.caps_.version;
        var prePendStr = browserName + "-" + browserVersion + "-";
        jasmine.getEnv().addReporter(new
            jasmine.JUnitXmlReporter(<report path>, true, true, prePendStr));
    });
}

This solution should effectively address the problem for you.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The visibility of the Bootstrap modal may vary depending on the version of Bootstrap being used

I am new to web programming and utilized various Twitter Bootstrap templates to build my website. The login page displays Bootstrap modals correctly with the following imports: <link rel="stylesheet" href="css/bootstrap.css" /> <link rel="styles ...

implement a Django for loop within the template by utilizing JavaScript

Is it possible to incorporate a {% for in %} loop and {{ variables }} in a Django template using JavaScript DOM (insertAdjacentText, or textContent) and dynamically load data from the views without refreshing the entire page? If so, can you please guide me ...

Simulating a mobile device screen size using an embedded iframe

Imagine this scenario: What if instead of adjusting the browser window size to showcase a responsive web design, we could load the site into an IFRAME with the dimensions of a mobile screen. Could this concept actually work? Picture having an IFRAME like ...

Error Encountered: "JSON Post Failure in ASP.net MVC resulting in 500

Whenever I attempt to send a variable to JSON on ASP.net MVC, I encounter the following error: jquery-2.2.3.min.js:4 GET http://localhost:58525/Order/GetAddress/?userid=42&email=asandtsale%40gmail.com 500 (Internal Server Error) This is my controller ...

Get a numerical value from a JSON object

Attempting to retrieve information from an API, but encountering an issue due to a numeric property name. The method for accessing the data is as follows: Success: data[i].price_usd Unsuccessful Attempt: data[i].24h_volume_usd Have experimented with ...

Tips for positioning a div next to an input box when it is in focus

I am working on a scenario where I have used CSS to extend the search box when focused. The idea is that when the search box is focused, it should decrease in size and a cancel button should appear next to it. This is the CSS code I am using: .clrble .fr ...

AngularJS: Setting the hash prefix for $locationProvider to "!"

Is there a way to show the URL as "www.test.com/!#" instead of "www.test.com/#!" when using $locationProvider.hashPrefix("!")? I want the exclamation mark before the hash, not after it. Thanks var app = angular.module('app', []); app.config(fu ...

Can inner function calls be mimicked?

Consider this scenario where a module is defined as follows: // utils.ts function innerFunction() { return 28; } function testing() { return innerFunction(); } export {testing} To write a unit test for the testing function and mock the return value ...

Executing a task on a deconstructed item within a JavaScript object

function transformTitle (string) { return string.charAt(0).toUpperCase() + string.slice(1) } Looking to capitalize the title directly after destructuring in a single line. const { question } = this.props const { title, Question_uuid: questionUUID } ...

Retrieving the chosen date from a calendar using a jQuery function

Hey there, I need help with showing tasks created on a specific date by selecting that date from a full month calendar. https://i.sstatic.net/hbLtp.jpg There are multiple tasks created on the selected date, and I want to trigger a jQuery event to fetch d ...

`Grab a portion of text from a different contenteditable div using code`

<div id="leftdiv" style="float:left;display:inline-block;height:100px;font-family:Helvetica;font-size:14px;width:300px;border:1px solid red;" contenteditable> <div> Unique first text </div> <div> Unique s ...

Angular JS - Enhance List Items to Display Upon Selection

I am working on a project where I have a list of items displayed. In my controller, I use the following code to generate the list: $scope.multipleOptions = [{ item: '1', checkmark:false}, { item: '2', checkmark:false},{ item: '3&a ...

Is there a way to determine if a div element is empty using JavaScript instead of jQuery?

I need to use JavaScript, without jQuery, to determine whether an element is empty or not. If the element is empty, the code should return true; if it contains content, it should return false." For instance, let's consider this div that needs to be ...

What is the best way to create a reactive prop within this Vue 3 application?

I've been developing a news application using Vue 3 along with the News API. My current focus is on implementing a search feature. Within my App.vue file, I have: <template> <TopBar @search="doSearch" /> <div class=" ...

Error message: When accessing react-native camera roll, the message "this.state.photos is not a valid object" appears

Encountering an error while attempting to implement camera roll functionality in my demo app. The error states, "null is not an object (evaluating 'this.state.photos')" View iOS Error Message. I am a beginner developer working on my first react-n ...

Issue with v-model not updating data correctly when using switch and select dropdown in VueJS

I am developing a dynamic admin panel that includes a CRUD generator using Laravel and Vue. Within my table, I am asynchronously loading data from an API. One specific column in the table, called is_featured, needs to function as a switch. This will allow ...

The blur effect isn't functional on the Firefox internet browser

When using the blur filter in my React application, everything works fine in Google Chrome and Microsoft Edge. However, I encountered an issue when testing it in Mozilla Firefox. Despite checking mozilla.org for solutions, I couldn't find anything spe ...

If the element is checked and equal to a specific value, take action

I am trying to hide one of the 3 radio buttons on my page. Although they all have the same class, each button has a different value. I attempted to write code to achieve this, but unfortunately, it is hiding all radio buttons instead of just one. Could s ...

What is the best way to transform an HTML <script> tag into React code?

I am new to the world of JavaScript and React. Can someone help me convert the script below into a React component? <div id="SOHUCS" sid="xxx"></div> <script charset="utf-8" type="text/javascript" sr ...

javascript horizontal text scroll

I am trying to implement horizontal scroll on my app. I have come across several examples, but none of them seem to fit my specific needs. The code snippet below is one that I thought would work, but it's not functioning as expected. Can someone pleas ...