Executing Cypress tests on Windows Subsystem for Linux (WSL

Encountering errors while attempting to run Cypress on WSL with Ubuntu:

$ cypress run
[29023:1018/155130.159647:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[29023:1018/155130.162020:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[29023:1018/155130.162068:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[29211:1018/155130.193707:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader

...

[29023:1018/155132.292604:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

Timed out waiting for the browser to connect. Retrying...
[29023:1018/155232.249036:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

Timed out waiting for the browser to connect. Retrying again...
[29023:1018/155332.249372:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
 (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
Error:  (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
    at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
    at Object.failListener (electron/js2c/browser_init.js:161:7699)
    at Object.emit (events.js:376:20)

In need of assistance as no related topics have been found.

Answer №1

To ensure that Cypress runs smoothly on Windows, it may be necessary to configure additional settings in order to run GUI applications in WSL, depending on your specific version:

  • Regardless of the Windows release you have, remember to install the required dependencies:

    apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
    

    This step might have already been completed if you followed the Cypress installation instructions using npm.

  • If you are using Windows 11, WSLg is included by default, enabling direct running of GUI applications on Windows. Update your WSL by executing wsl --update if you recently switched from Windows 10 to Windows 11.

    Additionally, make sure to remove any manual configurations of DISPLAY in startup files (e.g., ~/.bashrc) if you were attempting to run an X server on a previous Windows release.

  • Configuration for Windows 10 requires more steps. For detailed information, refer to this Super User question, as it delves into setting up third-party X servers and other solutions beyond basic programming tasks related to getting GUI applications to run correctly.

I can confirm that I successfully ran ./node_modules/.bin/cypress open following the Cypress installation guide with the help of my technique involving xrdp as outlined in the Super User answer, ensuring there were no unexpected hurdles in getting Cypress up and running.

Answer №2

We encountered a similar issue in our Azure Cypress pipeline too. Strangely, it only began occurring after we upgraded to Cypress 8.6.0, the latest version at that time. The problem was resolved by rolling back to version 8.4.0.

Answer №3

When browsing through various online discussions, I encountered challenges when using a VPN and corporate firewall.

I frequently encountered errors such as:

[14874:0408/102328.150664:ERROR:bus.cc(392)] Connection to the bus failed: Unable to interpret server address: Address type unknown (valid types are "tcp" and "unix" on UNIX)
[14874:0408/102328.150745:ERROR:bus.cc(392)] Connection to the bus failed: Unable to interpret server address: Address type unknown (valid types are "tcp" and "unix" on UNIX)
[15032:0408/102328.255402:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is
[14874:0408/102328.321306:ERROR:bus.cc(392)] Connection to the bus failed: Unable to interpret server address: Address type unknown (valid types are "tcp" and "unix" on UNIX)
[14874:0408/102328.331513:ERROR:bus.cc(392)] Connection to the bus failed: Unable to interpret server address: Address type unknown (valid types are "tcp" and "unix" on UNIX)
[14874:0408/102402.013363:ERROR:connection.cc(66)] Received X connection error.
[15032:0408/102402.014034:ERROR:connection.cc(66)] Received X connection error.
[15032:0408/102402.014064:ERROR:connection.cc(66)] Received X connection error.

After investigation, I discovered that WSL2 requires setting the display to the IP address of the host Windows machine. Despite sounding unconventional, this is necessary due to WSL2 having its own IP address and subnet, requiring it to utilize the IP of the display which differs from its own.

A detailed guide on resolving this issue can be found here: https://gist.github.com/pjobson/6b9fb926c59f58aa73d4efa10fe13654

The steps I followed were:

  1. Installation of Dependencies
  2. Setting up certificates for the corporate firewall
  3. Node installation
  4. Vcxsrv installation
  5. Configuration of $DISPLAY
  6. DBUS setup
  7. X-Server initialization
  8. Configuring Windows Firewall
  9. Cypress installation

Answer №4

After reviewing the Cypress troubleshooting page, it seems that these errors can be safely ignored. However, I am now questioning whether this error is truly insignificant or if it could indicate a larger issue.

https://docs.cypress.io/guides/references/troubleshooting#Run-the-Cypress-app-by-itself

The verbose Electron logging may display warnings that do not interfere with Cypress's normal functionality. An example of this is when the Test Runner launches successfully despite displaying intimidating messages like the following: [475:0617/150421.326986:ERROR:bus.cc(395)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [475:0617/150425.061526:ERROR:bus.cc(395)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [475:0617/150425.079819:ERROR:bus.cc(395)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

I have encountered this error during both timed out cypress runs and successful ones. This consistent occurrence makes me lean towards dismissing it as insignificant.

Answer №5

Had an issue with this error today, but managed to resolve it by updating my cypress version

npm install cypress@latest

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

Having trouble getting Next.js 404 page to function properly with the .tsx extension?

My latest project involved creating a Next.js application using regular JavaScript, which led to the development of my 404 page. 404.js import { useEffect } from "react"; import { useRouter } from "next/router"; import Link from " ...

Why does my Visual Studio Code always display "building" when I launch an extension?

https://code.visualstudio.com/api/get-started/your-first-extension I followed a tutorial to create a hello world extension. Why does my VSCode always display 'building' when I run the extension? Executing task: npm run watch < [email p ...

Creating Typescript packages that allow users to import the dist folder by using the package name

I am currently working on a TypeScript package that includes declarations to be imported and utilized by users. However, I have encountered an issue where upon publishing the package, it cannot be imported using the standard @scope/package-name format. I ...

Keep updating every second using setInterval

Currently, I have a function that refreshes a page every second and logs a message using console.log: function autoRefresh() { $.ajax({ type: "POST", url: "refresh.php", //data: dataString, dataType: "json", suc ...

"Using Nightwatch.js to Trigger a Click Event on a Text Link

My goal is to use Nightwatch for testing the login process by clicking on a log in text link. I came across this helpful article: How to click a link using link text in nightwatch.js. The article suggested using the following code: .useXpath() // ever ...

Identify the distinct item by its name within the array

I need assistance in filtering out unique place names from the list Array's places Array. Below is an example of the array data=> "list":[ { "id":1, "uID": 1 "places":[ { ...

Transferring information between two components in separate Angular 4 modules

Within my application, I have defined two modules named AppModule and UserModule. I am currently encountering an issue with data sharing between the AppComponent and the LoginComponent (which belongs to the UserModule). Below is a snippet of app.componen ...

Tips for integrating Excel files with NestJS

I'm in the process of developing a REST API that will utilize a third-party API to retrieve specific status information. The URLs needed for this API are stored in an Excel file, which is a requirement for this use case. My goal is to extract the URLs ...

The issue of an unexpected token '<' was encountered in both boostrap.js and chart.js

While trying to add boostrap.min.js to my hosting server, I encountered the error message Unexpected token <. However, when I used the bootstrap CDN, it worked perfectly. I thought I wouldn't have any further issues until integrating Angular-Chart. ...

Is there a way for me to generate a tab that shows content when hovered over?

Is it possible to create a tab that displays a vertical list of redirections when the mouse hovers over it, and hides when the mouse is moved away? This seems like a challenging task. Can someone guide me on how to achieve this, especially if it involves ...

Struggling to move forward with developing a task management app due to a roadblock

I am seeking guidance rather than a direct answer, as this is crucial for my final exam. I require a starting point to help me fill in the missing pieces. It's important to note that local storage cannot be used to store user input. // POST handler ad ...

What is the process for updating the ID within a Select2 ajax script function?

I am facing an issue with my select2 ajax script. The unique_ID in my table field is named "no", which is causing me to be unable to select an item in Select2 drop down. However, when I changed the name of my database table field from "no_donatur" to "ID", ...

What is the best approach to developing Vue components with unique templates while maintaining the same functionality without duplicating code?

I am working on a project to develop a custom and versatile datatable component. My goal is to be able to adjust the appearance of the datatable on each page, while maintaining consistent functionality. I want to pass data rows into the component and have ...

Transform JavaScript AJAX to HttpWebRequest implementation code

Is it possible to mimic an AJAX call to a web service within a console application using HttpWebRequest? Here is the source request: var webRequest = Sys.Net.WebServiceProxy.invoke('', 'MyMethod', false, {p1:aa,p2:bb,p3:123}, onSucc ...

Order of execution for Angular 2 components

import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms'; import {Router, ActivatedRoute, Params} from '@angular/router'; import { Country } from &ap ...

What could be causing my callback function to fail when used within a nested function?

I am currently utilizing the callback function in conjunction with Socket.io as shown below: loadData(callback) { var client = new SyncClient(this.socket, this.project); this.client = client; //From my data function client.on("connected", () => { ...

(perhaps) just a question regarding AJAX and PHP

Having a bit of trouble here - I have two files, main.html and processing.php. In the php file, I am trying to update a specific element on main.html, but I can't seem to retrieve either the html or javascript value from main.html For instance, main. ...

How to filter an array in Angular 4 without the need for creating a new array and then displaying the filtered results within the same

In my collection of students, I have their names paired with their academic outcomes. studentResults = [ {name: 'Adam', result : 'Passed'}, {name: 'Alan', result : 'Failed'}, {name : 'Sandy', result : &ap ...

Leveraging an Array of Objects in JavaScript

Need help with my JavaScript code! I want to adjust the date in a Date object by adding specific days and then save it. Here is what I have so far: let orderIdDateCorrectionDict = [ { "orderId": "2020053100", "dayCorrection": -146 }, { "orderId" ...

Experiencing a problem with a loop structure in my code

I've been trying to create a loop that will increase the temperature by 10 degrees every 2 minutes. However, I'm struggling to figure out how to stop the temperature at 120 degrees after 16 minutes. Any suggestions on how to solve this issue? va ...