Skip to content

Commit

Permalink
Arreglados los e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 25, 2024
1 parent 5a42271 commit 8aecc04
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
34 changes: 34 additions & 0 deletions webapp/e2e/steps/play-battery.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions webapp/e2e/steps/play-calculator.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defineFeature(feature, (test) => {
await page.goto("http://localhost:3000", {
waitUntil: "networkidle0",
});

});
let username;
let password;
Expand Down
35 changes: 35 additions & 0 deletions webapp/e2e/steps/play-classic.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8aecc04

Please sign in to comment.