Currently, I am working on Jasmine and my goal is to ensure that the test cases run only when the site's response status is okay (200).
If the site fails to load, I do not want the test cases to execute. To achieve this, I am checking the site's response in the beforeAll function.
For each individual test case, I need to verify if the global variable storing the response is true before proceeding. I am wondering if there is a way to implement this globally, similar to the before each step.
let response;
describe('', ()=>{
beforeAll (async () => {
//this function return the statusCode of http request
response= await sendQuery('Http://...');
})
beforeEach(async(), =>{
});
it('', async()=> {
if (response = 200){
//do something 1...
}
it('', async()=> {
if (response = 200){
//do something 2...
}
it('', async()=> {
if (response = 200){
//do something 3...
}
v
it('', async()=> {
if (response = 200){
//do something 4...
}
it('', async()=> {
if (response = 200){
//do something 5...
}
it('', async()=> {
if (response = 200){
//do something 6...
}