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

Add ability to change spec text before executing it #82

Open
bahmutov opened this issue Apr 11, 2020 · 0 comments
Open

Add ability to change spec text before executing it #82

bahmutov opened this issue Apr 11, 2020 · 0 comments
Labels
enhancement New feature or request markdown Issues and features relevant to Markdown fiddles

Comments

@bahmutov
Copy link
Contributor

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.

@bahmutov bahmutov added enhancement New feature or request markdown Issues and features relevant to Markdown fiddles labels Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request markdown Issues and features relevant to Markdown fiddles
Projects
None yet
Development

No branches or pull requests

1 participant