0

Updates

  • Based on comments and further tests I now suspect that the problem has somewhat to do with access restriction on the path, not the path itself. It's however not clear to me what actually is the cause, as there is no clear hints of it.
  • I now use another project for my evaluation, without access control, and it works. So the problem seems to be related to access control.
  • I leave the question as is, for future reference.

I am following this Cypress Quickstart: Vue guide to try out the new component testing for Vue. I already have "e2e" Cypress test working, and it's seemingly some basePath or other configuration/path issues, specifically with component test, I am dealing with now.

Problem

The browser does not carry out the test, waiting forever, saying in the dev tools console:

http://localhost:8080/__cypress/iframes/C:/work/swisscom/prixx/WebGui/Web/cypress/components/PersonEdit.cy.js....404 Not Found

Error received when test is running

I get the following error in the VS Code terminal:

GET /__cypress/iframes/C:/work/swisscom/prixx/WebGui/Web/cypress/components/PersonEdit.cy.js 404 49.560 ms - 105

Setup

Here's my cypress.config.ts

import { defineConfig } from 'cypress';

export default defineConfig({
    ...    

    e2e: {
        // We've imported your old cypress plugins here.
        // You may want to clean this up later by importing these.
        setupNodeEvents(on, config) {
            return require('./cypress/plugins/index.js')(on, config);
        },
        baseUrl: 'http://localhost:2623/'
    },
    component: {
        devServer: {
            framework: 'vue',
            bundler: 'webpack'
        }
    }
});

It's Vue2, Webpack, Cypress v10.6.0, using Google Chrome.

  • I start the Cypress controlled Browser from the Cypress App (Google Chrome points at http://localhost:8080/__/#/specs)
  • When clicking the test, the address bar in the browser now shows "http://localhost:8080/__/#/specs/runner?file=cypress/components/PersonEdit.cy.js" which looks reasonable

What I have tried/found

  • The test file exists a the given absolute location. However, I consider the use of this absolute path a telltale sign of my problem.
  • I have a baseUrl configured for e2e, but I can not find a way to configure one for component testing
  • The config, when inspected with the controlled browser shows the following:

From http://localhost:8080/__/#/settings, "Resolved Configuration":

//...
arch: 'x64',
baseUrl: null,
//...

Somehow, the controlled browser translates the relative path to an absolute path. Why is that?

Question

How can I fix/configure the path for fetching my Cypress Component Test spec?

Marcel
  • 15,039
  • 20
  • 92
  • 150
  • 1
    Just so you know, I have the same "absolute path" you are seeing in the network tab - but status is 200. Try renaming the components folder to something else, restart Cypress and when prompted let it place an empty test. Then see if that one 404's. – Fody Aug 29 '22 at 10:22
  • @fody I have deleted the folder altogether, and created a new test using the "Create new empty spec*. It's been created, it's there, but it has the same behaviour, returning a 404. In the browser, as before, I still get a "connection refused" error displayed. – Marcel Aug 29 '22 at 11:43
  • @fody I have now used another project for my experiments, and it also displays the absolute paths, as you mention, and it works. I now believe that I was misled with the paths, and the problem lies with failing access restriction. – Marcel Aug 29 '22 at 13:17

0 Answers0