quasarframework / quasar-testing

Testing Harness App Extensions for the Quasar Framework 2.0+
https://testing.quasar.dev
MIT License
179 stars 65 forks source link

Cypress E2E testing WorkspaceRoot detection #326

Closed radoslavirha closed 1 year ago

radoslavirha commented 1 year ago

Hi,

when testing Quasar + Cypress (component tests) in multiple workspaces, build server does not recognise project root and tests are failing.

My issue is similar to https://stackoverflow.com/questions/74902697/error-the-request-url-is-outside-of-vite-serving-allow-list-after-git-init

It can be fixed in quasar.config.js with:

    extendViteConf(viteConf) {
      if (!viteConf.server) {
        viteConf.server = { fs: {} };
      }
      viteConf.server.fs = {
        allow: [
          searchForWorkspaceRoot(process.cwd())
        ]
      };
    }

Normal Quasar build/dev works fine without ^^ piece of code, but it's necessary for component tests.

The question is if it can be fixed/set in @quasar/quasar-app-extension-testing-e2e-cypress or me (maybe others) should stick with my solution.

Thanks

IlCallo commented 1 year ago

It should be possible to fix this via our index file behind a api.hasVite check, or even commit it upstream to Cypress vite dev server, see https://github.com/cypress-io/cypress/blob/9db5251a0ee954b260abdd1ddf217834667818bc/npm/vite-dev-server/src/resolveConfig.ts#L111

We would prefer to have it fixed upstream, but if it's too much hassle to deal with Cypress team we'll accept a PR to fix it into this app extension

radoslavirha commented 1 year ago

Hi @IlCallo I opened PR in Cypress .... It seems to be complicated to merge something into cypress repo. I don't have example repo for them (my is private). Hopefully it will be OK.

https://github.com/cypress-io/cypress/pull/26036

IlCallo commented 1 year ago

Thanks, I tried to bring some attention on the issue, as it's related to a similar problem we just had to tackle to make own Quasar tests to work

radoslavirha commented 1 year ago

There are some failing tests in cypress repo. If you want and have few spare minutes, feel free to help me with PR. I'll continue in the evening.

Thanks

IlCallo commented 1 year ago

I can't unluckily, but they may be just failing snapshot tests which need to be refreshed, it happened to a PR of mine last month too

lmiller1990 commented 1 year ago

Thanks for the PR, we will get this reviewed in the Cypress repo 👍

radoslavirha commented 1 year ago

@lmiller1990 @IlCallo I tracked down where the problem first appeared, and it seems to be related to the typescript references in the tsconfig.json file, where I reference another workspace (some tools).