Hi, here is my e2e test file
There are two simple test case. At first I used before() to open the google search home page
/// <reference types="cypress" />
describe('Test google search', {
'env': {
'HOME_PAGE': 'https://www.google.com/?hl=zh_tw'
}
},() => {
before(() => {
cy.visit(Cypress.env('HOME_PAGE'))
})
afterEach(() => {
if (cy.url() != Cypress.env('HOME_PAGE')) {
cy.visit(Cypress.env('HOME_PAGE'))
}
})
it('Check Element For Search Page', () => {
// check google logo
cy.get('img[alt="Google"][src]').should('be.visible')
// check seach input
cy.get('input[name="q"][type="text"]').should('be.visible')
// check seach button
cy.get('div.FPdoLc input[value="Google 搜尋"]').should('be.visible')
})
it('Search Keyword Should Succeed', () => {
// type keyword
cy.get('input[name="q"][type="text"]').type('Facebook')
// submit keyword
cy.get('div.CqAVzb input[value="Google 搜尋"]').click()
})
})
The above cdoe works normally,
but the problem is that before() and afterEach() are not seen in the html report (I'm sure the html report's sidebar show hooks = Always)
https://i.imgur.com/bPc5xnt.png (report image)
Environment
What happened?
Hi, here is my e2e test file There are two simple test case. At first I used before() to open the google search home page
The above cdoe works normally, but the problem is that before() and afterEach() are not seen in the html report (I'm sure the html report's sidebar show hooks = Always) https://i.imgur.com/bPc5xnt.png (report image)
And I'm sure the "before all" part is executed in cypress https://i.imgur.com/dtuRBmH.png (cypress execute image)
Config file
cypress.config.js:
Relevant log output
No response
Anything else?
No response