-1

I am working on a Windows desktop. I am trying to run Cypress in a devcontainer which runs in my local Docker Desktop. I am using VcXsrv as local X Server to enable the GUI. Actually it works fine with one exception: the watchFileChanges is not working. When I modify a test file, it is not detected and I must restart Cypress so that it uses the latest version of the files. Has anyone tried something similar and managed to get the watchFileChanges to work? Not sure whether this is relevant but I am also using cypress-cucumber-preprocessor and cypress-ntlm in my test project.

{
    "name": "Cypress",
    "build": {
        "dockerfile": "dockerfile"
    },
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            // Set *default* container specific settings.json values on container create.
            "settings": {
        "cucumber.glue": [
          "**/common/*.js"
        ]
      },
            "extensions": [
        "CucumberOpen.cucumber-official"
      ]
        }       
  }
}

And here is the related Dockerfile

FROM cypress/included:12.14.0
ENV CYPRESS_INSTALL_BINARY=0
ENV HOST_IP host.docker.internal
ENV DISPLAY ${HOST_IP}:0.0
sebgamby
  • 59
  • 1
  • 3

1 Answers1

2

I have raised the issue to the Cypress team. The solution was to add an environment variable CHOKIDAR_USEPOLLING=true. Chokidar being the nodejs module used for monitoring file changes.

sebgamby
  • 59
  • 1
  • 3
  • This is the right answer! With CHOKIDAR_USEPOLLING=true, cypress detects finally the changes made in the tests files, while running in a devcontainer. – Darko P. Jul 18 '23 at 11:55