Saucelabs is having issues with executing mocha tests within the expected time limits

Recently, I've been diving into the world of mocha and Saucelabs, but it seems like I might be making a beginner's mistake.

Everything runs smoothly when I test in my browser or through a manual session on Saucelabs. However, when I try to run them using the REST interface, they end up timing out. Despite the screen capture showing that all tests passed successfully, Sauce Labs doesn't seem to acknowledge it.

The command I used for the REST interface was:

curl \ -X POST \ -u gbthr:00000000-0000-0000-0000-000000000000 \ -H 'Content-Type: application/json' \ --data '{ "platforms": [ ["Linux", "googlechrome", ""]], "url": "", "framework": "mocha"}'

I made sure to replace those 0000's with my own id.

Could there be an extra step I'm missing in my test setup to properly notify Saucelabs?

Answer №1

I stumbled upon the solution right here: https://github.com/axemclion/grunt-saucelabs

After completing the test, you can store the outcomes in window.mochaResults.

var runner = mocha.run();

var failedTestsArray = [];
runner.on('end', function(){
  window.mochaResults = runner.stats;
  window.mochaResult.reports = failedTestsArray;
});

runner.on('fail', recordFailure);

function recordFailure(test, error){

  var getTitles = function(test){
    var titlesList = [];
    while (test.register.title){
      titlesList.push(test.register.title);
      test = test.register;
    }
    return titlesList.reverse();
  };

  failedTestsArray.push({name: test.name, resultStatus: false, errorMessage: error.message, errorStack: error.stack, titles: getTitles(test) });
};

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

Overlapping Divs - HTML Elements Crossing Paths

My challenge is to position the Social Icons at the bottom of the screen and align the Image Gallery in the middle. However, the social Icons keep moving to the center of the screen and the Image gallery ends up overlapping them, making it difficult for me ...

Guide to getting methods and functions up and running in JavaScript

Having trouble with the following method and function, can anyone provide assistance? hasMoreOscarsThan - A method that takes an actor object as a parameter and determines if they have more Oscars than the specified object. Returns true or false. Cr ...

The server sends a response with a MIME type that is not for JavaScript, it is empty

I am trying to integrate an angular application with cordova. Upon running "cordova run android" and inspecting it in Chrome, the console displays the following message: "Failed to load module script: The server responded with a non-JavaScript MIME t ...

Load JavaScripts asynchronously with the function getScripts

Asynchronously loading scripts on my login page: $.when( $.getScript("/Scripts/View/scroll-sneak.js"), $.getScript("/Scripts/kendo/kendo.custom.min.js"), $.Deferred(function (defer ...

Utilizing ReactJS: Expanding my knowledge of updating array object indexes dynamically when removing elements

Currently, I am in the process of creating a to-do list application to improve my skills in working with ReactJS. This is how my initial state looks like: const [listx, setlistx] = useState( [ {id: 0, flavor: 'strawberry', ...

Using multiple html files with ui-router's ui-view feature

Is it possible to create a complex UI using multiple HTML files with ui-view in AngularJS? I am trying to achieve a layout similar to this: I attempted to implement something on Plunker, but it seems like I'm struggling to grasp the underlying concep ...

Personalized information boxes for particular data points within highcharts

When hovering over specific points, I want to display unique warnings or explanations in the tooltip. I have included custom text like 'WARNING' and 'WARNING 2' within the series data but am struggling to retrieve that data for each too ...

What causes the occurrence of "undefined" after multiple iterations of my code?

I've encountered a curious issue with the code snippet below. Everything seems to be running smoothly except for one thing - after a few iterations, I start getting "undefined" as an output. You can test this for yourself by running the code multiple ...

Guide on adjusting the CSS styling of elements in real-time from the backend using a user customization panel to modify the appearance of various web pages

Imagine a scenario where we have a website consisting of multiple pages, including a user account page. The user has the ability to modify the color, font size, and style of certain elements on other pages for their own viewing preferences. How can this fu ...

Understanding the variance between the created and mounted events in Vue.js

According to Vue.js documentation, the created and mounted events are described as follows: created The created event is called synchronously after the instance is created. By this point, the instance has completed setting up data observation, compute ...

What could be causing my function to return undefined instead of an array?

I have been working on a function to query my database and retrieve specific details for the selected item. While it successfully finds the items, it seems to be returning undefined. var recipefunc = function(name) { Item.find({name: name}, function ...

Strange values are found in the Underlying ArrayBuffer of a Buffer generated using Buffer.from in Node.js version 8.6.0

After spending half a day debugging my application, I came across a strange behavior that has left me puzzled. Take a look at the code snippet below: const buffer = Buffer.from([12, 34, 56, 78, 90]); const dataView = new DataView(buffer.buffer); console. ...

How come the express.static() function is failing to load my .js and .css files from the intended path?

const express = require('express'); const app = express(); const server = require('http').Server(app); const io = require('socket.io').listen(server); const path = require('path'); let lobbies = new Array(); app.us ...

Is it possible for two buttons to have the same 'click' function?

I am encountering an issue with duplicated buttons in my code. I have two buttons, one named Update and the other named View. Initially, both buttons work perfectly fine. However, when I duplicate these buttons, only the View button retains its functionali ...

Create a Vue JS component that enables the rendering of checkbox inputs and sends the selected values back to the

I am working on a Vue JS project where I am creating a custom component to display multiple checkboxes on the page. The challenge I am facing is sending back the value to the component in order to attach a v-model to it. Currently, all my checkboxes allow ...

Activate onchange when including/excluding an option in a dropdown menu (ReactJs)

I need to activate a function whenever a new option is added to a select element. The following code shows the select element: <select name="projects" id="projects" onChange={handleChange}> {Object.keys(items.project ...

Raycaster in Three.js fails to detect objects in the scene mesh

Currently working with three.js r67 on Chrome Version 35.0.1916.153 m I am trying to intersect some custom meshes I created in my scene, but the raycaster doesn't seem to be detecting them even though they are present in scene.children. Here is my m ...

Using Javascript to group elements by JSON data

I have an array of JSON objects and I'm attempting to organize it by a specific element. I came across some code example on grouping JSON format from this link const groupBy = prop => data => { return data.reduce((dict, item) => { ...

What could be causing my server to not fully read my json file?

I created a function that sends a get request for fav.json and assigned the id="fav_button" button to execute this function. Additionally, I configured an express server. However, upon clicking the button, only the last item in the json file is displayed. ...

What is the best way to store user inputs in a text file using ReactJS?

I have a contact form with three input fields and I would like to save the input values into a text file when users click on a button. How can I achieve this? Can you provide an example? Here is my code: import React, { } from 'react'; import l ...