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

cy.saveHar is not a function #396

Open
zubairPlanera opened this issue Jan 15, 2024 · 2 comments
Open

cy.saveHar is not a function #396

zubairPlanera opened this issue Jan 15, 2024 · 2 comments
Assignees
Labels
Type: bug Something isn't working

Comments

@zubairPlanera
Copy link

Current behavior
Description:
Encountering an issue where the cy.saveHar function is not recognized in my Cypress setup, despite following the correct implementation steps.

Environment:

Node.js version: v18.4.0
Cypress version: 13.5.1
Operating System: macOs Monterey
Error Message: Cypress throws an error, stating that cy.saveHar is not a function when attempting to utilize it in the test file.
Steps Taken:

Installed @neuralegion/cypress-har-generator as a development dependency.
Updated cypress/plugins/index.js and cypress.config.js as per the plugin documentation.
Registered commands in cypress/support/index.js.
Implemented code in the test file to generate and save a HAR file.
Additional Information:

Confirmed correct plugin installation.
Cypress plugin setup appears to be correctly configured.
cypress/support/index.js is properly set up.
Other plugin functions (e.g., cy.recordHar()) are working as expected.
Desired behavior
Expect cy.saveHar to be recognized as a valid Cypress command and save the generated HAR file.

Test code to reproduce
describe.only('Project Creation', () => {

let projectName

before(() => {
cy.viewport(viewportsize)
cy.recordHar();
cy.loginDevPlanera()
projectName = createProjectPageConstant.generateProjectName()
})

after(() => {
cy.logout();
cy.saveHar();
})

it('TC1| Create Project, [Smoke-Test]', { tags: ['Smoke'] }, () => {
cy.log('Project Creation Initiated')
createCanvasObject.createProject(projectName)
cy.log('Project Creation completed')

})

})

Cypress Version
13.5.1

Node version
18.4.0

Operating System
macOS 12.0

Debug Logs
No response

Other
Possible Solutions Attempted:

Restarted Cypress.
Verified Cypress version compatibility.
Checked and ensured correct plugin implementation based on documentation.

@zubairPlanera zubairPlanera added the Type: bug Something isn't working label Jan 15, 2024
@sadhishsk
Copy link

@derevnjuk Even I face the same issue in my current setup. Cypress-har-generator is not compatible with Cypress 13.6.4. In my case, its showing cy.task('recordHar')failed with the following error: > Failed to connect to Chrome Debugging Protocol Possible reasons for failure: - Chrome not running in headless mode - Using Chrome version 58 or earlier - Inconsistent RDP configuration settings. The stack trace for this error is: https://on.cypress.io/api/task Because this error occurred during abefore each` hook we are skipping all of the remaining tests.

@bartonhammond
Copy link

Any update?

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

4 participants