cy.scope('#identifier') #16572
Answered
by
jennifer-shehane
dillingham
asked this question in
Component Testing
-
would be handy if a before() hook could scope all upcoming before(() => {
cy.visit('/page')
cy.scope('#notifications');
})
it('can see all notifications', () => {
cy.get('[test="trigger"]').click()
}) this selector cy.get('[test="trigger"]').click() would become cy.get('#notifications [test="trigger"]').click() behind the scenes |
Beta Was this translation helpful? Give feedback.
Answered by
jennifer-shehane
May 18, 2021
Replies: 1 comment 1 reply
-
This is similar to |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dillingham
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is similar to
.within()
, but you can likely overwrite existing commands or write your own to get similar functionality: https://on.cypress.io/custom-commands