Unable to execute JavaScript tests within a Docker container

I've experimented with a few docker containers that have Google Chrome installed, attempting to run them in headless mode. Some of the images I tried are:

  • selenium/standalone-chrome

  • zenika/alpine-chrome

Installed nvm and all necessary packages

However, when I try to run commands for testing or building, it just hangs indefinitely.

npm test

or

npm run build

Here is the configuration in testee.json

{
    "port": 3621,
    "root": ".",
    "reporter": "Spec",
    "timeout": 120,
    "delay": 1000,
    "tunnel": {
        "type": "local"
    },
    "launch": {
        "type": "local"
    },
    "browsers": [{
        "browser": "chrome",
        "args": [
            "--headless",
            "--disable-gpu",
            "--remote-debugging-port=9222"
        ]
    }]
}

Answer №1

To ensure proper functionality, it is important to include the argument '--no-sandbox' in the browsers -> args object within your testee.json file.

{
      "port": 3621,
      "root": ".",
      "reporter": "Spec",
      "timeout": 120,
      "delay": 1000,
      "tunnel": {
          "type": "local"
      },
      "launch": {
          "type": "local"
      },
      "browsers": [{
          "browser": "chrome",
          "args": [
              "--headless",
              "--no-sandbox',
              "--disable-gpu",
              "--remote-debugging-port=9222"
          ]
      }]
}

For additional details and guidance, please refer to this resource.

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

Jquery doesn't support adding click events to dynamically generated list items

Jquery Code Here is my jQuery code that retrieves a dynamically generated list of categories from a database. I have added a click event to each list item, but it is not triggering the alert as expected. <script type="text/javascript" src="<?= base ...

Installation of Vue Material failed after post-installation process

I've been working on a Vue.js project for a while now and I've encountered a new issue that's stumping me. Whenever I try to pull the project from Git onto another computer or download it as a zip file, I run into trouble when it comes time ...

What are the challenges associated with using replaceChild?

function getLatestVideos(url) { var http = new XMLHttpRequest(); http.open("GET", url, false); // false for synchronous request http.send(null); return http.responseText; } var videosText = getLatestVideos("https://www.googleapis.com/youtube/v3/se ...

What are the required permissions for installing Bower on Vagrant in Windows?

During the installation of Bower via NPM on a Windows 7 machine running a precise32 Ubuntu Box on Vagrant, I encountered a recurring error. Despite trying various command combinations, the errors persisted. I attempted local, global, sudo, non-sudo instal ...

Issues with JQuery Beginner using the .after Method

Can you help me figure out what's wrong with this code snippet? I've double-checked the path to the JavaScript file and it seems correct, so I suspect there might be an issue within the code itself. The inserted paragraph is not being displayed a ...

The property 'body' cannot be read because it is undefined

I have been attempting to incorporate passport logic into my controllers file, but I encountered an issue. When I place the logic inside the controllers, it gives me an error message saying "Cannot read property 'body' of undefined." However, whe ...

The excessive offset of pixels is causing the popup dialog to appear misaligned

I'm having an issue with my modal popups where the dialog is rendering 200px to the left and about 100px above its intended position. Just updated jQuery. DevicesRightClickActionsMenuController.prototype.showActionsMenu = function(event) { right ...

I successfully linked expressjs, nodejs, reactjs, and mysql in my project. I'm puzzled as to why everything runs smoothly after I restart my express server, but encounters issues when I refresh the page

express path users.js var express = require('express'); var router = express.Router(); const connection = require('./MySQL.js') /* Accessing user data. */ router.get('/', function(req, res, next) { connection.connect() ...

Can studying Titanium Appcelerator enhance my comprehension of NodeJS?

As I dive into the world of building mobile JavaScript Applications in Titanium Appcelerator, I've come across documentation that mentions the use of the V8 Engine as their JS interpreter for Android. Additionally, some of the approaches seem to be in ...

Sending an AJAX request will only transmit a portion of an array when using the JSON.stringify

I have a JavaScript array that is constantly updated. Here's how I initially set up the array... columnArray = ["userID", "Date", "trialType", "cue", "target", "response", "accuracy", "lenAcc", "strictAcc", "fkpl", "totalTime"]; var dataArray = []; ...

Prevent anchor tags from modifying the current URL

In the realm of React, I am endeavoring to incorporate an anchor tag that directs users to an external website "https://www.google.com/". Within my code, there exist two instances of this very anchor tag. The initial tag functions as intended, effortless ...

Set up a basic JavaScript file according to a value stored in the Redux state

After creating an application with RN and Redux, I have a unique colors.js file structured as follows: const Colors = { mainColorDark: '#E34b3d', mainColor: '#e3596d', mainColorLight: '#F0965C', } export default Colo ...

Creating a webpage header with Javascript to mimic an existing design

I am in the process of building a website with 5 different pages, but I want the header to remain consistent across all pages. To achieve this, I plan to use an external JavaScript file (.js). The header includes the website name (displayed as an image) an ...

Error encountered on Windows_NT 6.1.7601: ENOENT - file or directory not found

After successfully setting up my new Angular application, I faced some npm errors while trying to restore the packages by clicking on package.json file and selecting Restore Packages. Can someone please guide me on how to resolve these errors? I came acro ...

How to assign the 'src' attribute to an HTML element using Node.js

I am currently using 'express' in Node.js and have implemented the following code to send a URL input into text: <form method="GET" action='/download' class="my-5"> <div class="form-group"> ...

What is the ideal location for the jsoncallback to be placed?

function initiate(){ $('#detailsPage').on('pageshow', function(event) { var username = getUrlVars()["username"]; //var username = "studentB"; $.getJSON('http://mywebsite.com/fetchStudent.php?username='+username+&a ...

Experiencing the Pause: A Fresh Take on

I'm currently using this slideshow for a project, and I need to understand if it's possible to resume its interval. The current issue is that when you hover over the slideshow, the progress bar stops. But once you remove the mouse, it continues f ...

Enhancing the functionality of LI elements by making them clickable when dynamically inserted into the webpage

I have successfully implemented a code using the Google Maps API that allows users to input a location, look it up on the map, and display the search result next to the map. The only part I'm struggling with is making these search results clickable so ...

Utilizing user input to execute an API request

I am working with a form that allows the user to input a city name. I want to use an API call to retrieve weather data for that specific city and display it in the console. Unfortunately, I'm encountering an error where the variable containing the in ...

Tips for checking the type radio button input with Angular.js

I want to implement validation for a radio button field using Angular.js. Below is the code snippet I am working with: <form name="myForm" enctype="multipart/form-data" novalidate> <div> <input type="radio" ng-model="new" value="true" ng- ...