diff --git a/webapp/e2e/steps/play-battery.steps.js b/webapp/e2e/steps/play-battery.steps.js index cdd50d57..a7317852 100644 --- a/webapp/e2e/steps/play-battery.steps.js +++ b/webapp/e2e/steps/play-battery.steps.js @@ -19,6 +19,40 @@ defineFeature(feature, (test) => { await page.goto("http://localhost:3000", { waitUntil: "networkidle0", }); + await page.setRequestInterception(true); + page.on('request', (req) => { + if (req.method() === 'OPTIONS'){ + req.respond({ + status: 200, + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': '*' + } + }); + } else if (req.url().includes('/questions')) { + req.respond({ + status: 200, + headers: { + 'Access-Control-Allow-Origin': '*' + }, + contentType: 'application/json', + body: JSON.stringify([{ + pregunta: 'Test question', + respuestas: ['Test answer 1', 'Test answer 2', 'Test answer 3', 'Test correct answer'], + correcta: 'Test correct answer', + + }, { + pregunta: 'Test question 2', + respuestas: ['Test answer 1', 'Test answer 2', 'Test answer 3', 'Test correct answer'], + correcta: 'Test correct answer' + }] + ) + }); + } else { + req.continue(); + } + }); }); let username; let password; diff --git a/webapp/e2e/steps/play-calculator.steps.js b/webapp/e2e/steps/play-calculator.steps.js index 73ae60d1..4f6e8e1c 100644 --- a/webapp/e2e/steps/play-calculator.steps.js +++ b/webapp/e2e/steps/play-calculator.steps.js @@ -19,6 +19,7 @@ defineFeature(feature, (test) => { await page.goto("http://localhost:3000", { waitUntil: "networkidle0", }); + }); let username; let password; diff --git a/webapp/e2e/steps/play-classic.steps.js b/webapp/e2e/steps/play-classic.steps.js index 7439b175..3302a4e7 100644 --- a/webapp/e2e/steps/play-classic.steps.js +++ b/webapp/e2e/steps/play-classic.steps.js @@ -19,6 +19,41 @@ defineFeature(feature, (test) => { await page.goto("http://localhost:3000", { waitUntil: "networkidle0", }); + + await page.setRequestInterception(true); + page.on('request', (req) => { + if (req.method() === 'OPTIONS'){ + req.respond({ + status: 200, + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': '*' + } + }); + } else if (req.url().includes('/questions')) { + req.respond({ + status: 200, + headers: { + 'Access-Control-Allow-Origin': '*' + }, + contentType: 'application/json', + body: JSON.stringify([{ + pregunta: 'Test question', + respuestas: ['Test answer 1', 'Test answer 2', 'Test answer 3', 'Test correct answer'], + correcta: 'Test correct answer', + + }, { + pregunta: 'Test question 2', + respuestas: ['Test answer 1', 'Test answer 2', 'Test answer 3', 'Test correct answer'], + correcta: 'Test correct answer' + }] + ) + }); + } else { + req.continue(); + } + }); }); let username; let password;