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

Parse YAML files automatically in cy.readFile() #489

Closed
jennifer-shehane opened this issue Apr 28, 2017 · 2 comments
Closed

Parse YAML files automatically in cy.readFile() #489

jennifer-shehane opened this issue Apr 28, 2017 · 2 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: wontfix Cypress does not regard this as an issue or will not implement this feature

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Apr 28, 2017

Current behavior:

In order for me to parse a YAML file, I have to add this code to my tests:

YAML = require('yamljs')

it('displays links', function () {
  cy.readFile('source/_data/sidebar.yml').then(function (yamlString) {
    var sidebar = YAML.parse(yamlString);
    expect(sidebar.api.and).to.equal('and.html')
  })
})

Expected behavior:

I'd like Cypress to parse the YAML file for me, similar to how it does for JSON files. So I could write this:

it('displays links', function () {
  cy.readFile('source/_data/sidebar.yml').then(function (sidebar) {
    expect(sidebar.api.and).to.equal('and.html')
  })
})
  • Operating System: N/A
  • Cypress Version: 0.19.2
@jennifer-shehane jennifer-shehane added pkg/driver This is due to an issue in the packages/driver directory type: feature New feature that does not currently exist labels Apr 28, 2017
@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope difficulty: 1️⃣ labels Feb 1, 2019
@jennifer-shehane jennifer-shehane added the good first issue Good for newcomers label Jul 13, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Oct 3, 2019
@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: needs review The PR code is done & tested, needs review labels Oct 15, 2019
@jennifer-shehane
Copy link
Member Author

We have decided to go a different direction than was originally planned when this issue was opened over 2 years ago.

I will be closing this issue since we do not want to integrate Yaml file parsing directly into the Cypress product at this time.

We think this would be a good use case for a Cypress plugin, if there is demand for that, that others could pull into their Cypress tests.

@jennifer-shehane jennifer-shehane added stage: wontfix Cypress does not regard this as an issue or will not implement this feature and removed Hacktoberfest good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope type: feature New feature that does not currently exist labels Oct 16, 2019
@MiguelNiblock
Copy link

I was looking specifically for how to load yml files. Thank you @jennifer-shehane for documenting this use case. I might be able to create a custom cypress command to load yml files in a simplified manner. Please update this thread should you learn of a better practice/ plugin for reading yml files as fixtures in cypress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: wontfix Cypress does not regard this as an issue or will not implement this feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants