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

Instances where har file isn't created #306

Open
9j0hn50n opened this issue Jun 27, 2023 · 2 comments
Open

Instances where har file isn't created #306

9j0hn50n opened this issue Jun 27, 2023 · 2 comments
Assignees
Labels
Type: bug Something isn't working

Comments

@9j0hn50n
Copy link

Description
Hi, I'm having instances where a .har file isn't generated by a number of my tests (only 1 of them succeeds to produce the expected behaviour).

I have cy.recordHar() at the top of the before hook and cy.saveHar({ waitForIdle: true }) at the bottom of the after hook in the tests and have followed the installation instructions shown in this repos readme.

I'm aware that there is are the following lines shown in the logs:

CYPRESS-HAR-GENERATOR 3722: Failed request: 5017.142. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 3722: Failed request: 5017.143. Reason: net::ERR_ABORTED

But the tests display no adverse behaviour whilst running except for the intentional failure I've added for testing this tool.

I'm using Node 14.17.3 and Cypress 12.13.0

Stack trace
An output of execution with NODE_DEBUG=cypress-har-generator in the environment:

npm run test:dev:e2e:chrome

> cat@1.0.0 test:dev:e2e:chrome
> make catalogue-urls.json && cypress_environment=dev cypress_grepTags=dev cypress_uniqueIdentifier=$RANDOM NODE_DEBUG=cypress-har-generator cypress run --e2e -C tests/e2e/cypress.config.js -b chrome -s tests/e2e/tests/onboarding.test.js

make: `catalogue-urls.json' is up to date.

DevTools listening on ws://127.0.0.1:57376/devtools/browser/b92d6a65-d02f-49d6-b12e-0b2e7cfb55ea
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
cypress-grep: filtering using tag(s) "dev"
cypress-grep: will omit filtered tests
grep and/or grepTags has eliminated all specs
grepTags: dev
Will leave all specs to run to filter at run-time

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        12.13.0                                                                        │
  │ Browser:        Chrome 114 (headless)                                                          │
  │ Node Version:   v14.17.3 (/Users/cat/.nvm/versions/node/v14.17.3/bin/node)           │
  │ Specs:          1 found (onboarding.test.js)                                                   │
  │ Searched:       tests/e2e/tests/onboarding.test.js                                             │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────

  Running:  onboarding.test.js                                                              (1 of 1)


  viewport width == 360px
CYPRESS-HAR-GENERATOR 3722: Attempting to connect to Chrome Debugging Protocol
CYPRESS-HAR-GENERATOR 3722: Connected to Chrome Debugging Protocol
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.55
userEmailAddress: e2e.tests.email.4323@cat.com
userId: 82483eb9-c2b8-4716-bccc-0cd3aaed6727
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 4EAA08720A91C6428669D0B2BF0EE5D1
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.68
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.69
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.70
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.71
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.74
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5D4183963B4533DE8B1CD0507EDF0E7D
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.131
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.132
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.133
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.94
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.134
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.135
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.136
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.57
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.137
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.138
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: B8C302F6E246C58E764B94EA82A9EC24
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.139
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 562EA8708DCDF329451B35B768D10602
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.140
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 32E0445CFEFE7BEDB6CEE082CEBDC497
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.141
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: BFF6AA43A4D2389CBC3428187F69F219
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 82E460A4DE2558D0A6528AB3DAE042A8
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.142
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.143
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 163AEF733A6FFF6637A5EA59A9ECA7A5
CYPRESS-HAR-GENERATOR 3722: Failed request: 5017.142. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 3722: Failed request: 5017.143. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.145
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.146
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.147
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.148
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.151
    navigate forwards
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.208
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 417F1DC88AF280F1C43C66C5DF026E0D
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 6A590ECD8789FA6D0F81DAC51EA2BAB2
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.209
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.210
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.211
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.212
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.213
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 1C3EA448BEEF6E3598008ED62C4D3B76
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.214
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.215
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.216
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.183
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.171
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.217
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.218
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: A2E41502AD63C117090F1558C4B2ABC5
      ✓ should show the 'welcome' page (6424ms)
      ✓ should show the 'your data is safe' page (29ms)
      ✓ should allow the user to view the 'privacy notice' and 'special category personal data' polices (29ms)
    navigate to the discovery form
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 538BA6F26B7ECE34DE3342227150D8CD
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.219
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: C876AB39018F7B2BE4CA4EFCD7ED4D96
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.220
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.221
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.222
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.223
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.224
/graphql assertions match
      ✓ should allow the user to go forwards and ensure the request and response match (620ms)
    question 1: what do you want to do?
      ✓ should allow the user to answer question 1 (1606ms)
    proceed to question 2
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.225
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 9A7478B54C38B33C02D5BD765354C642
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.226
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.227
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.228
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.229
CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.230
      (Attempt 1 of 2) should allow the user to proceed to question 2 and ensure the request and response match
      1) should allow the user to proceed to question 2 and ensure the request and response match
[fail-fast] Failed tests: 1/1
[fail-fast] Enabling skip mode
    question 2: what will be good about this?

  5 passing (17s)
  1 failing

  1) viewport width == 360px
       proceed to question 2
         should allow the user to proceed to question 2 and ensure the request and response match:
     AssertionError: Timed out retrying after 4000ms: Expected to find element: `[data-test="button:primary:net"]`, but never found it.
      at Context.eval (webpack:///./utils/commands/uiInteractions.js:93:5)



CYPRESS-HAR-GENERATOR 3722: Session 2AC1D167E7E72EB8E315255566A65280 associated with request: 5017.243
[fail-fast] Stopping Cypress runner due to a previous failure

  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        46                                                                               │
  │ Passing:      5                                                                                │
  │ Failing:      1                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      40                                                                               │
  │ Screenshots:  2                                                                                │
  │ Video:        true                                                                             │
  │ Duration:     17 seconds                                                                       │
  │ Spec Ran:     onboarding.test.js                                                               │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


  (Screenshots)

  -  tests/e2e/debug/dev/screenshots/onboarding.test.js/viewport width == 360px -- proceed to question 2 -- should allow the
     coachee to proceed to question 2 and ensure the request and response match (failed).png
  -  tests/e2e/debug/dev/screenshots/onboarding.test.js/viewport width == 360px -- proceed to question 2 -- should allow the
     coachee to proceed to question 2 and ensure the request and response match (failed) (attempt 2).png


  (Video)

  -  Started compressing: Compressing to 32 CRF
  -  Finished compressing: 1 second

  -  Video output: tests/e2e/debug/dev/videos/onboarding.test.js.mp4


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✖  onboarding.test.js                       00:17       46        5        1        -       40 │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✖  1 of 1 failed (100%)                     00:17       46        5        1        -       40```

Expected behavior
I would expect a .har file to be generated upon test fail.

Actual behavior
No .har file is generated upon test fail.

Many thanks!
Gavin

@9j0hn50n 9j0hn50n added the Type: bug Something isn't working label Jun 27, 2023
@derevnjuk
Copy link
Member

@9j0hn50n, thanks for the report. However, I'm unable to reproduce this behavior following your introduction. Could you provide the reproducible repository? You can use https://github.com/NeuraLegion/cypress-har-generator/tree/master/example as a reference for simplicity

@9j0hn50n
Copy link
Author

9j0hn50n commented Aug 15, 2023

Hi @derevnjuk, thanks for your response. The issue still persists for me.

I can't provide a reproducible repo I'm afraid due to IP issues.

Did you want me to create a branch off the example you provided to (hopefully) demonstrate the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants