sorry-cypress / cy2

Integrate Cypress with alternative cloud services like Sorry Cypress or Currents
https://docs.sorry-cypress.dev/cypress-agent/cy2
GNU General Public License v3.0
32 stars 5 forks source link

Cy2 doesnt respect configuration files not found in the application root #72

Closed Capocaccia closed 10 months ago

Capocaccia commented 1 year ago

Before opening, please confirm:

Environment information

``` # Put output below this line System: OS: macOS 13.2.1 CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz Memory: 20.01 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node Yarn: 1.22.18 - ~/.yarn/bin/yarn npm: 8.6.0 - ~/.nvm/versions/node/v16.12.0/bin/npm Browsers: Chrome: 110.0.5481.100 Firefox: 109.0 Safari: 16.3 npmPackages: @ampproject/toolbox-optimizer: undefined () @babel/core: undefined () @babel/runtime: 7.15.4 @cypress/angular: 0.0.0-development @cypress/mount-utils: 0.0.0-development @cypress/react: 0.0.0-development @cypress/react18: 0.0.0-development @cypress/svelte: 0.0.0-development @cypress/vue: 0.0.0-development @cypress/vue2: 0.0.0-development @cypress/webpack-preprocessor: 5.15.6 => 5.15.6 @dynatrace/dtrum-api-types: 1.223.5 => 1.223.5 @edge-runtime/primitives: 1.1.0-beta.31 @faker-js/faker: 7.6.0 => 7.6.0 @gitbeaker/node: 35.8.0 => 35.8.0 @googlemaps/markerclustererplus: 1.2.10 => 1.2.10 @graphql-codegen/add: 3.2.1 => 3.2.1 (3.2.3) @graphql-codegen/cli: 2.12.0 => 2.12.0 @graphql-codegen/import-types-preset: 2.2.3 => 2.2.3 @graphql-codegen/near-operation-file-preset: 2.4.1 => 2.4.1 @graphql-codegen/plugin-helpers: 1.18.4 => 1.18.4 (2.7.2, 3.1.2, 1.17.7, 1.18.8) @graphql-codegen/schema-ast: 2.5.1 => 2.5.1 @graphql-codegen/testing: 1.17.7 => 1.17.7 @graphql-codegen/typescript: 1.23.0 => 1.23.0 @graphql-codegen/typescript-compatibility: 2.1.5 => 2.1.5 @graphql-codegen/typescript-document-nodes: 2.3.3 => 2.3.3 @graphql-codegen/typescript-operations: 1.18.4 => 1.18.4 @graphql-codegen/typescript-react-query: 1.3.0 => 1.3.0 @graphql-codegen/visitor-plugin-common: 1.19.1 => 1.19.1 (2.12.1, 1.22.0) @graphql-tools/optimize: 1.3.1 => 1.3.1 @hapi/accept: undefined () @napi-rs/triples: undefined () @neuralegion/cypress-har-generator: 5.2.3 => 5.2.3 @next/react-dev-overlay: undefined () @nrwl/cli: 15.6.0 => 15.6.0 @nrwl/cypress: 15.6.0 => 15.6.0 @nrwl/devkit: 15.6.0 => 15.6.0 @nrwl/eslint-plugin-nx: 15.6.0 => 15.6.0 @nrwl/express: 15.6.0 => 15.6.0 @nrwl/jest: 15.6.0 => 15.6.0 @nrwl/js: 15.6.0 => 15.6.0 @nrwl/linter: 15.6.0 => 15.6.0 @nrwl/next: 15.6.0 => 15.6.0 @nrwl/node: 15.6.0 => 15.6.0 @nrwl/nx-plugin: 15.6.0 => 15.6.0 @nrwl/react: 15.6.0 => 15.6.0 @nrwl/storybook: 15.6.0 => 15.6.0 @nrwl/tao: 15.6.0 => 15.6.0 @nrwl/web: 15.6.0 => 15.6.0 @nrwl/workspace: 15.6.0 => 15.6.0 @reach/combobox: 0.16.5 => 0.16.5 @reach/dialog: 0.16.2 => 0.16.2 @reach/menu-button: 0.16.2 => 0.16.2 @reach/rect: 0.16.0 => 0.16.0 @reach/slider: 0.18.0 => 0.18.0 @reach/tabs: 0.16.4 => 0.16.4 @reach/utils: 0.16.0 => 0.16.0 (0.18.0) @segment/ajv-human-errors: undefined () @storybook/addon-a11y: 6.5.14 => 6.5.14 @storybook/addon-cssresources: 6.2.9 => 6.2.9 @storybook/addon-docs: 6.5.14 => 6.5.14 (6.5.16) @storybook/addon-essentials: ^6.5.15 => 6.5.16 @storybook/addon-links: 6.5.14 => 6.5.14 @storybook/addon-postcss: 2.0.0 => 2.0.0 @storybook/addon-toolbars: 6.5.14 => 6.5.14 (6.5.16) @storybook/addons: 6.5.14 => 6.5.14 (6.5.16, 6.2.9, 6.5.15) @storybook/builder-webpack5: ^6.5.15 => 6.5.16 @storybook/core: 6.5.14 => 6.5.14 (6.5.16) @storybook/core-server: 6.5.15 => 6.5.15 (6.5.14, 6.5.16) @storybook/manager-webpack5: ^6.5.15 => 6.5.16 @storybook/mdx2-csf: 0.0.3 => 0.0.3 @storybook/react: ^6.5.15 => 6.5.16 @storybook/types: 7.0.0-alpha.44 => 7.0.0-alpha.44 @swc-node/register: ^1.4.2 => 1.5.5 @swc/core: 1.3.25 => 1.3.25 @tailwindcss/custom-forms: 0.2.1 => 0.2.1 @tailwindcss/forms: 0.5.3 => 0.5.3 @tailwindcss/typography: 0.5.2 => 0.5.2 @testing-library/cypress: 8.0.3 => 8.0.3 @testing-library/jest-dom: 5.16.5 => 5.16.5 @testing-library/react: 13.4.0 => 13.4.0 @testing-library/user-event: 14.4.3 => 14.4.3 @types/cors: 2.8.12 => 2.8.12 @types/debounce: 1.2.1 => 1.2.1 @types/express: 4.17.14 => 4.17.14 (4.17.16, 4.17.15) @types/google-map-react: 2.1.3 => 2.1.3 @types/google.maps: 3.51.0 => 3.51.0 @types/i18next-fs-backend: 1.1.2 => 1.1.2 @types/jest: 29.1.2 => 29.1.2 (29.2.5) @types/lodash: 4.14.170 => 4.14.170 (4.14.191) @types/node: 18.11.9 => 18.11.9 (18.11.18, 16.18.11, 14.18.36, 8.10.66) @types/react: 18.0.25 => 18.0.25 (18.0.26) @types/react-dom: 18.0.9 => 18.0.9 (18.0.10) @types/uuid: 8.3.1 => 8.3.1 @types/webpack-bundle-analyzer: 4.6.0 => 4.6.0 @types/yup: 0.26.0 => 0.26.0 @typescript-eslint/eslint-plugin: 5.48.1 => 5.48.1 @vercel/nft: undefined () acorn: undefined () amphtml-validator: undefined () apollo-server-errors: 3.3.1 => 3.3.1 arg: undefined () assert: undefined () async-retry: undefined () async-sema: undefined () auto-bind: 4.0.0 => 4.0.0 autoprefixer: 10.4.13 => 10.4.13 (9.8.8) axe-core: 4.6.3 => 4.6.3 (4.6.2) babel-jest: 28.1.3 => 28.1.3 (29.3.1) babel-loader: 8.1.0 => 8.1.0 (9.1.2, 8.3.0) babel-packages: undefined () browserify-zlib: undefined () browserslist: undefined () buffer: undefined () bytes: undefined () card-validator: 8.1.1 => 8.1.1 chalk: undefined () change-case-all: 1.0.14 => 1.0.14 (1.0.15, 1.0.12) ci-info: undefined () classnames: 2.3.1 => 2.3.1 cli-select: undefined () comment-json: undefined () compression: undefined () conf: undefined () constants-browserify: undefined () content-disposition: undefined () content-type: undefined () cookie: undefined () copy-webpack-plugin: 11.0.0 => 11.0.0 (10.2.4) cors: 2.8.5 => 2.8.5 credit-card-type: 9.1.0 => 9.1.0 cross-spawn: undefined () crypto-browserify: undefined () cssnano-simple: undefined () cy2: 4.0.6 => 4.0.6 cypress: 12.6.0 => 12.6.0 cypress-axe: 1.3.0 => 1.3.0 cypress-if: 1.10.3 => 1.10.3 cypress-iframe: 1.0.1 => 1.0.1 cypress-image-snapshot: 4.0.1 => 4.0.1 cypress-wait-until: 1.7.2 => 1.7.2 date-fns: 2.29.3 => 2.29.3 (2.8.1, 2.14.0) debounce: 1.2.0 => 1.2.0 (1.2.1) debug: undefined () devalue: undefined () devcert: 1.1.3 => 1.1.3 domain-browser: undefined () dotenv: 10.0.0 => 10.0.0 (16.0.3, 8.6.0) downshift: 7.0.4 => 7.0.4 edge-runtime: undefined () eslint: 8.15.0 => 8.15.0 eslint-config-next: 13.1.1 => 13.1.1 eslint-config-prettier: 8.1.0 => 8.1.0 eslint-plugin-cypress: ^2.10.3 => 2.12.1 eslint-plugin-import: 2.25.2 => 2.25.2 (2.26.0) eslint-plugin-jsx-a11y: 6.6.1 => 6.6.1 (6.7.0) eslint-plugin-lodash: 7.2.0 => 7.2.0 eslint-plugin-mdx: 2.0.5 => 2.0.5 eslint-plugin-no-only-tests: 3.1.0 => 3.1.0 eslint-plugin-react: 7.31.11 => 7.31.11 (7.32.0) eslint-plugin-react-hooks: 4.6.0 => 4.6.0 eslint-plugin-security: 1.4.0 => 1.4.0 eslint-plugin-storybook: 0.6.8 => 0.6.8 events: undefined () express: 4.18.1 => 4.18.1 (4.18.2) fast-memoize: 2.5.2 => 2.5.2 fetch-mock: 9.11.0 => 9.11.0 find-cache-dir: undefined () find-up: undefined () formik: 2.2.9 => 2.2.9 fresh: undefined () fs-extra: 10.0.0 => 10.0.0 (9.1.0, 10.1.0, 8.1.0, 11.1.0, 7.0.1) get-orientation: undefined () glob: 8.0.3 => undefined (7.2.3, 7.1.7, 7.1.4, 7.1.3, 8.0.3, ) google-map-react: 2.1.10 => 2.1.10 got: 11.8.1 => 11.8.1 (11.8.6) graphql: 15.5.1 => 15.5.1 (14.7.0, 15.8.0) graphql-tag: 2.12.4 => 2.12.4 (2.12.6) graphql-tag-transform.macro: 1.1.1 => 1.1.1 graphql-tools: 5.0.0 => 5.0.0 gzip-size: undefined () helmet: 4.6.0 => 4.6.0 history: 5.3.0 => 5.3.0 html-react-parser: 3.0.4 => 3.0.4 http-proxy: undefined () http-proxy-middleware: 2.0.1 => 2.0.1 (2.0.6) https-browserify: undefined () https-proxy-agent: 5.0.0 => 5.0.0 (5.0.1) husky: 7.0.1 => 7.0.1 (4.2.5) i18next: 22.0.7 => 22.0.7 (21.10.0) i18next-chained-backend: 4.2.0 => 4.2.0 i18next-fs-backend: 1.1.1 => 1.1.1 (2.1.1) i18next-http-backend: 1.2.4 => 1.2.4 icss-utils: undefined () ignore-loader: undefined () image-size: undefined () intl-format-cache: 4.3.1 => 4.3.1 is-animated: undefined () is-docker: undefined () is-wsl: undefined () jest: 29.3.1 => 29.3.1 jest-diff: 29.1.2 => 29.1.2 (28.1.3, 29.3.1) jest-environment-jsdom: 29.3.1 => 29.3.1 jest-express: 1.12.0 => 1.12.0 jest-fetch-mock: 3.0.3 => 3.0.3 jest-junit: 14.0.1 => 14.0.1 jest-worker: undefined () json5: undefined () jsonwebtoken: undefined () lint-staged: 11.0.0 => 11.0.0 (10.5.4) loader-utils: undefined () lodash: 4.17.21 => 4.17.21 (4.17.15) lodash.curry: undefined () lru-cache: undefined () markdown-to-jsx: 7.1.5 => 7.1.5 (7.1.8) micromatch: undefined () mini-css-extract-plugin: undefined () mockdate: 3.0.5 => 3.0.5 moment: 2.23.0 => 2.23.0 (2.29.4) msw: 0.35.0 => 0.35.0 nanoid: 3.3.4 => undefined (3.3.4, ) native-url: undefined () neo-async: undefined () next: 12.3.1 => 12.3.1 next-build-id: 3.0.0 => 3.0.0 next-i18next: 13.0.1 => 13.0.1 next-i18next-create-client: undefined () node-fetch: 2.6.1 => 2.6.1 (2.6.7, 1.7.3, ) node-html-parser: undefined () ora: undefined () os-browserify: undefined () p-limit: undefined () path-browserify: undefined () postcss: 8.4.19 => 8.4.19 (8.4.21, 7.0.39, 8.4.14) postcss-custom-properties: 10.0.0 => 10.0.0 postcss-flexbugs-fixes: undefined () postcss-import: 13.0.0 => 13.0.0 (14.1.0) postcss-modules-extract-imports: undefined () postcss-modules-local-by-default: undefined () postcss-modules-scope: undefined () postcss-modules-values: undefined () postcss-preset-env: undefined () postcss-safe-parser: undefined () postcss-scss: undefined () postcss-value-parser: undefined () prettier: 2.7.0 => 2.7.0 (2.3.0) prettier-plugin-tailwindcss: 0.2.0 => 0.2.0 pretty-quick: 3.1.0 => 3.1.0 process: undefined () punycode: undefined () query-string: 7.1.1 => 7.1.1 (7.1.3) querystring: 0.2.1 => 0.2.1 (0.2.0) querystring-es3: undefined () raw-body: undefined () raw-loader: 4.0.2 => 4.0.2 react: 18.2.0 => 18.2.0 react-dates: 21.6.0 => 21.6.0 react-dom: 18.2.0 => 18.2.0 (16.8.6) react-error-boundary: 3.1.4 => 3.1.4 react-hook-form: 7.33.0 => 7.33.0 react-i18next: 12.0.0 => 12.0.0 react-icons: 4.2.0 => 4.2.0 react-idle-timer: 5.4.0 => 5.4.0 react-intersection-observer: 9.4.1 => 9.4.1 react-is: 17.0.2 react-json-view: 1.21.3 => 1.21.3 react-query: 3.39.2 => 3.39.2 react-redux: 8.0.5 => 8.0.5 react-refresh: 0.12.0 react-responsive: 8.0.1 => 8.0.1 react-server-dom-webpack: undefined () react-svg: 13.0.5 => 13.0.5 redux: 4.2.0 => 4.2.0 redux-sessionstorage: 0.4.0 => 0.4.0 regenerator-runtime: 0.13.4 resize-observer-polyfill: 1.5.1 => 1.5.1 sass-loader: undefined () schema-utils: undefined () semver: undefined () send: undefined () setimmediate: undefined () simple-git: 2.47.0 => 2.47.0 source-map: undefined () stream-browserify: undefined () stream-http: undefined () string-hash: undefined () string_decoder: undefined () strip-ansi: undefined () strip-js: 1.2.0 => 1.2.0 tailwind-override: 0.0.10 => 0.0.10 tailwindcss: 3.2.4 => 3.2.4 tar: undefined () terser: undefined () text-table: undefined () timers-browserify: undefined () ts-jest: 29.0.3 => 29.0.3 ts-keycode-enum: 1.0.6 => 1.0.6 ts-node: 10.9.1 => 10.9.1 tslib: 2.4.1 => 2.4.1 (2.0.3, 2.2.0, 2.1.0, 1.14.1, 2.3.1) tty-browserify: undefined () typescript: 4.8.4 => 4.8.4 ua-parser-js: undefined () unistore: undefined () universal-cookie: 4.0.4 => 4.0.4 util: undefined () vm-browserify: undefined () watchpack: undefined () web-vitals: undefined () webpack: undefined () webpack-bundle-analyzer: 4.7.0 => 4.7.0 (4.5.0) webpack-sources: undefined () whatwg-fetch: 3.6.2 => 3.6.2 ws: undefined () yaml: 1.10.2 => 1.10.2 yup: 0.24.1 => 0.24.1 npmGlobalPackages: corepack: 0.10.0 npm: 8.6.0 ```

Describe the bug

Hey looking for some help on this one. Were using NX 15.6.0, Cypress 12.6.0, and Cy2 4.0.6. Every time we try to run Cypress, we receive the following error message: Could not find a Cypress configuration file in this folder: /Users/ccapocaccia/code/myRepo

Here is our implementation of Cy2

`import { ExecutorContext } from '@nrwl/devkit'; import cypress, { CypressExecutorOptions } from '@nrwl/cypress/src/executors/cypress/cypress.impl';

// @ts-ignore import { run } from 'cy2';

export default async function cypressExecutor( options: CypressExecutorOptions & { ciParallelRunners: number }, context: ExecutorContext ) { try { await run('https://sorry-cypress-director.myurl.com/', options); } catch (e) { console.log('error patching cypress', e); return { success: false }; }

return cypress(options, context); }`

And here a copy of the options object referenced above

{ "cypressConfig": "./apps/e2e/cypress.config.ts", "baseUrl": "https://www.myurl.com/", "testingType": "e2e", "record": true, "parallel": true, "ciParallelRunners": 5, "browser": "chrome", "watch": false, "headed": false, "headless": false, "exit": true, "skipServe": false }

Expected behavior

The expected behavior is that cy2 is able to find the configuration file using the path passed in via the options object.

Command and Setup

yarn nx run e2e:e2e

Full log and debug output

2023-03-01T14:33:10.229Z cypress:cli exporting Cypress module interface 2023-03-01T14:33:10.561Z cy2 Cypress API URL: https://sorry-cypress-director.myDomain.com 2023-03-01T14:33:10.561Z cy2 Package version: 4.0.6 2023-03-01T14:33:10.566Z cy2 Original environment variables {} 2023-03-01T14:33:10.566Z cy2 Sanitized environment variables { https_proxy: undefined, http_proxy: undefined, npm_config_proxy: undefined, npm_config_https_proxy: undefined, NO_PROXY: undefined, HTTP_PROXY: undefined, HTTPS_PROXY: undefined } 2023-03-01T14:33:10.569Z cy2-net Proxy is listening on port 52834 2023-03-01T14:33:10.575Z cy2 Resolved proxy environment variables { https_proxy: undefined, http_proxy: undefined, npm_config_proxy: undefined, npm_config_https_proxy: undefined, NO_PROXY: undefined, HTTP_PROXY: undefined, HTTPS_PROXY: 'http://127.0.0.1:52834', NODE_EXTRA_CA_CERTS: '/var/folders/mp/x9cj0g611yjgyzjtmz_wss6mkvn5k4/T/tmp-64651-vrTLUANoQdt1' } 2023-03-01T14:33:10.575Z cy2 Deleting env https_proxy 2023-03-01T14:33:10.575Z cy2 Deleting env http_proxy 2023-03-01T14:33:10.575Z cy2 Deleting env npm_config_proxy 2023-03-01T14:33:10.575Z cy2 Deleting env npm_config_https_proxy 2023-03-01T14:33:10.575Z cy2 Deleting env NO_PROXY 2023-03-01T14:33:10.576Z cy2 Deleting env HTTP_PROXY 2023-03-01T14:33:10.576Z cy2 Setting env HTTPS_PROXY=http://127.0.0.1:52834 2023-03-01T14:33:10.576Z cy2 Setting env NODE_EXTRA_CA_CERTS=/var/folders/mp/x9cj0g611yjgyzjtmz_wss6mkvn5k4/T/tmp-64651-vrTLUANoQdt1 2023-03-01T14:33:10.578Z cypress:cli verifying Cypress app 2023-03-01T14:33:10.579Z cypress:cli checking environment variables 2023-03-01T14:33:10.580Z cypress:cli checking if executable exists /Users/ccapocaccia/Library/Caches/Cypress/12.6.0/Cypress.app/Contents/MacOS/Cypress 2023-03-01T14:33:10.581Z cypress:cli Binary is executable? : true 2023-03-01T14:33:10.581Z cypress:cli binaryDir is /Users/ccapocaccia/Library/Caches/Cypress/12.6.0/Cypress.app 2023-03-01T14:33:10.581Z cypress:cli Reading binary package.json from: /Users/ccapocaccia/Library/Caches/Cypress/12.6.0/Cypress.app/Contents/Resources/app/package.json 2023-03-01T14:33:10.583Z cypress:cli Found binary version 12.6.0 installed in: /Users/ccapocaccia/Library/Caches/Cypress/12.6.0/Cypress.app 2023-03-01T14:33:10.585Z cypress:cli { verified: true } 2023-03-01T14:33:10.585Z cypress:cli is Verified ? true 2023-03-01T14:33:10.585Z cypress:cli:run processing run options { outputPath: '/var/folders/mp/x9cj0g611yjgyzjtmz_wss6mkvn5k4/T/tmp-64651-ZzkyAusu8iKN', key: null, spec: null, reporter: null, reporterOptions: null, project: '/Users/ccapocaccia/code/dx-ui' } 2023-03-01T14:33:10.585Z cypress:cli:run --key is not set, looking up environment variable CYPRESS_RECORD_KEY 2023-03-01T14:33:10.585Z cypress:cli:run run to spawn.start args ["--run-project","/Users/ccapocaccia/code/dx-ui","--output-path","/var/folders/mp/x9cj0g611yjgyzjtmz_wss6mkvn5k4/T/tmp-64651-ZzkyAusu8iKN"] 2023-03-01T14:33:10.585Z cypress:cli needs to start own Xvfb? false 2023-03-01T14:33:10.586Z cypress:cli spawning, should retry on display problem? false 2023-03-01T14:33:10.597Z cypress:cli spawn args [ '--no-sandbox', '--', '--run-project', '/Users/ccapocaccia/code/dx-ui', '--output-path', '/var/folders/mp/x9cj0g611yjgyzjtmz_wss6mkvn5k4/T/tmp-64651-ZzkyAusu8iKN', '--cwd', '/Users/ccapocaccia/code/dx-ui', '--userNodePath', '/Users/ccapocaccia/.nvm/versions/node/v16.12.0/bin/node', '--userNodeVersion', '16.12.0' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] } 2023-03-01T14:33:10.597Z cypress:cli spawning Cypress with executable: /Users/ccapocaccia/Library/Caches/Cypress/12.6.0/Cypress.app/Contents/MacOS/Cypress 2023-03-01T14:33:10.601Z cypress:cli piping child STDERR to process STDERR Could not find a Cypress configuration file in this folder: /Users/ccapocaccia/code/dx-ui

// Put your logs below this line

agoldis commented 1 year ago

@Capocaccia would you mind please sharing the debug log? We pass down the configuration to cypress as-is, having the log would help to identify what parameters cypress runner is using

Capocaccia commented 1 year ago

@agoldis - I just added the debug log to the bug ticket.