I want to use Cy.Session to login once and run multiple Test #29114
Closed
subhasis-imagine
started this conversation in
General
Replies: 1 comment
-
Resolved the issue . the issue was with the base URL cypress config must me like this module.exports = defineConfig({ }, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Support Folder helper function for Login
Cypress.Commands.add('login',(username,password)=>
{
cy.session('user',()=>
{
// cy.visit('/')
cy.visit("https://xxx.qa.f.com/")
cy.get('#username').click().type(username)
cy.get("input[placeholder='Password']").click().type(password)
cy.get("button[type='submit']").click()
})
})
describe('Login Scenario',()=>{
// })
})
it('login to the sytem',()=>{
//cy.visit('/customer')
cy.visit('/')
cy.get('.logoutIcon').should('be.visible', { timeout: 12000 })
cy.get('.logoutIcon',{ timeout: 10000 }).click()
cy.get('.profileItemHeader:last-child').should('exist')
})
it('login to the sytem 2',()=>{
cy.visit('/')
//cy.visit('/customer')
cy.get('.logoutIcon',{ timeout: 10000 }).click()
cy.get('.profileItemHeader:last-child').should('be.visible')
})
})
It throws me an error
CypressError
cy.visit() failed trying to load:
/
We failed looking for this file at the path:
/Users/subhasis.patra/cy/
The internal Cypress web server responded with:
Beta Was this translation helpful? Give feedback.
All reactions