How to save cookies in global setup
amrsa1 opened this issue · 3 comments
amrsa1 commented
How to save the cookies in global setup so it can authenticate all other test in it block
`describe ('Backend Validation', function () {
frisby.globalSetup({
request: {
url: 'https://example.com/EAI/Login',
method: 'POST',
body:{
redirect: 'https://example.com/',
reprompt: 'https://iotidentity.example.com/login?redirect=https://example.com/',
username: 'username',
password: 'password'
},
headers: {
origin: 'https://iotidentity.example.com',
}
}
});
it('1- Verify backend and API will retrun 200', function () {
return frisby
.get('https://example.com/')
.expect('status',200)
.inspectBody()
});
it('2- Verify all user comapny service can be fetched', function () {
return frisby
.get('https://example.com/mcapi/users/current')
.expect('status', 200)
.inspectBody()
})
});
`
console error for test number 2
FAILURE Status: 403
JSON: {
"message": "Missing Authentication Token"
}
vlucas commented
Use beforeAll
to run a frisby login that returns a cookie, then call frisby.globalSetup
after that with the value of it.
amrsa1 commented
Thanks for reply
can you provide sample how to return the cookies in before all and call it frisby global setup