Skip to content
This repository was archived by the owner on Feb 28, 2023. It is now read-only.
This repository was archived by the owner on Feb 28, 2023. It is now read-only.

Add ability to change spec text before executing it #82

@bahmutov

Description

@bahmutov

Example: we mount the DOM markup in a div, while some tests might assume they use the full iframe

// By default, root is the document
cy.root().should('match', 'html')

Screen Shot 2020-04-11 at 2 27 56 PM

So this test fails, but would pass if we ran

// By default, root is the document
cy.root().should('match', 'div#live')

It would be nice to give us ability to have hidden text processing over test code before executing it in Cypress

<!-- fiddle -->
```js
// By default, root is the document
cy.root().should('match', 'html')
```
```js transform
code.replace('html', 'div#live')
```

Where we execute js transform block if found by giving it a variable code with the current test code and then we evaluate the returned code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmarkdownIssues and features relevant to Markdown fiddles

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions