datopian / ckan-integration-tests

Cypress toolkit to run integration tests against a CKAN instance
https://tech.datopian.com/ckan/
MIT License
4 stars 3 forks source link

Error: Could not find Cypress test run results #16

Open kmanaseryan opened 3 years ago

kmanaseryan commented 3 years ago

Following the instruction in the docs to can't run the specs.

When I run node test.js I get the following error:

The support file is missing or invalid.

Your `supportFile` is set to `/var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js/index.js`, but either the file is missing or it's invalid. The `supportFile` must be a `.js` or `.coffee` file or, if you're using a preprocessor plugin, it must be supported by that plugin.

Correct your `cypress.json`, create the appropriate file, or set `supportFile` to `false` if a support file is not necessary for your project.

Or you might have renamed the extension of your `supportFile` to `.ts`. If that's the case, restart the test runner.

Learn more at https://on.cypress.io/support-file-missing-or-invalid
{ failures: 1, message: 'Could not find Cypress test run results' }

I have Cypress installed and setup with it's default folder structure.

//test.js
import cypress from "cypress";
import { CKANIntegrationTests } from "ckan-integration-tests/index.js";

const assets = new CKANIntegrationTests();
assets.addAllSpecs();

cypress
  .run(assets.options)
  .then(console.log)
  .catch(console.error)
  .finally(() => assets.cleanUp());

package.json

{
  "name": "test-int-tests",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ckan-integration-tests": "git+https://github.com/datopian/ckan-integration-tests.git",
    "ckanClient": "git+https://github.com/datopian/ckan-client-js.git#bfa869866c3bf50ada2bbc30376e0191c9c263c7",
    "cypress": "4.9.0",
    "frictionless": "git+https://github.com/frictionlessdata/frictionless-js.git#1e48a2d0c545e4294107197fa6100308ab8488e1"
  }
}

cypress.json

{
  "chromeWebSecurity": false,
  "baseUrl": "https://ckan.myserver.org/",
  "pageLoadTimeout": 120000,
  "env": {
    "FRONTEND_URL": "https://ckan.myserver.org/",
    "API_KEY": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "CKAN_USERNAME": "joanne.doe",
    "CKAN_PASSWORD": "joannes-very-secret-password",
    "ORG_NAME_SUFFIX": "_organization_test",
    "DATASET_NAME_SUFFIX": "_dataset_test"
  }
}

Environment

Cypress: 4.9.0 Node: v14.15.1 OS: Mac 11.0.1 Tried also with Cypress v6.0.0 but didn't work.

cuducos commented 3 years ago

By this file path /var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js/index.js I would say it might be a bug in creating the supportFile path — wouldn't it make sense to be /var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js instead?

Maybe we can review the code that handles this to check whether the functions and methods have changed behavior in recent versions:

https://github.com/datopian/ckan-integration-tests/blob/252e559fcef1f7ce7a95417b7eded307bb31ddd7/index.js#L46-L65

It's really unexpected, for me, to have const file = path.join(tmp, "support", "index.js"); resulting in whatever/index.js/index.js

kmanaseryan commented 3 years ago

@cuducos great catch! I also noticed that and it's really weird. On line 52 if I change "index.js" to lets say "index1.js" then output in the error will be: watever/index1.js/index1.js I think this might be OS level issue, as @cotts tried at his end he didn't have this error.

I use Mac OS, version 11.0.1

cuducos commented 3 years ago

I think this might be OS level issue

Makes sense. As far as I can remember, @cotts and I are running on Linux, so if you're on macOS, there is a chance that this behavior is OS-related…