Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix c8yclient authentication error #1

Closed
thomaswinkler opened this issue Oct 24, 2023 · 0 comments · Fixed by #3
Closed

Fix c8yclient authentication error #1

thomaswinkler opened this issue Oct 24, 2023 · 0 comments · Fixed by #3
Assignees
Labels
bug Something isn't working

Comments

@thomaswinkler
Copy link
Collaborator

If c8yclient authentication fails in authenticateClient, the error is not mapped to CypressError. This results in wrong and unreadable error output.

Error
the object {
  "codeFrame": {
    "absoluteFile": "/Users/twi/Projects/oee/oee-ui/node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
    "column": 1
    "frame": "  229 | // Cookie authentication. Client.authenticate() only works with BasicAuth\n  230 | function authenticateClient(auth, baseUrl) {\n> 231 |   return cy.then(async () => {\n      | ^\n  232 |     const clientCore = new FetchClient(auth, baseUrl);\n  233 |     clientCore.defaultHeaders = {\n  234 |       "content-type": "application/json","
    "language": "js"
    "line": 231
    "originalFile": "node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
    "relativeFile": "node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
  }

  "isCyFailErr": true
  "isPending": true
  "name": "CypressError"
  "parsedStack": [
    {
      "message": "[object Object]"
      "whitespace": ""
    }
    {
      "message": "From Your Spec Code:"
      "whitespace": ""
    }
    {
      "absoluteFile": "/Users/twi/Projects/oee/oee-ui/node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "column": 0
      "fileUrl": "http://localhost:9000/__cypress/tests?p=cypress/support/e2e.ts"
      "function": "authenticateClient"
      "line": 231
      "originalFile": "webpack://oee/./node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "relativeFile": "node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "whitespace": "    "
    }
    {
      "absoluteFile": "/Users/twi/Projects/oee/oee-ui/node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "column": 0
      "fileUrl": "http://localhost:9000/__cypress/tests?p=cypress/support/e2e.ts"
      "function": "Context.eval"
      "line": 203
      "originalFile": "webpack://oee/./node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "relativeFile": "node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js"
      "whitespace": "    "
    }
  ]
  "res": "[object Response]"
  "stack": "[object Object]\nFrom Your Spec Code:\n    at authenticateClient (webpack://oee/./node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js:231:0)\n    at Context.eval (webpack://oee/./node_modules/@iota/cumulocity-cypress-shared-dev/lib/commands/c8yclient.js:203:0)"
} was thrown, throw an Error :)

Because this error occurred during a before all hook we are skipping all of the remaining tests.
@thomaswinkler thomaswinkler added the bug Something isn't working label Oct 24, 2023
@thomaswinkler thomaswinkler self-assigned this Oct 24, 2023
@thomaswinkler thomaswinkler linked a pull request Oct 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant