Skip to content

Commit

Permalink
fix debug mode requests
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Jan 21, 2025
1 parent c9f0fb1 commit b213cf1
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,21 @@ Cypress.Commands.add('enableDebugMode', () => {
return;
}

cy.request({
method: 'POST',
url: '/ajax/switchdebug.php',
body: {
'debug': 'on',
},
}).then(() => {
cy.reload();
cy.getCsrfToken().then((csrf) => {
cy.request({
method: 'POST',
url: '/ajax/switchdebug.php',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest',
'X-Glpi-Csrf-Token': csrf,
},
body: {
'debug': 'on',
},
}).then(() => {
cy.reload();
});
});
});

Expand All @@ -448,14 +455,22 @@ Cypress.Commands.add('disableDebugMode', () => {
if (Cypress.$('#debug-toolbar-applet').length === 0) {
return;
}
cy.request({
method: 'POST',
url: '/ajax/switchdebug.php',
body: {
'debug': 'off',
},
}).then(() => {
cy.reload();

cy.getCsrfToken().then((csrf) => {
cy.request({
method: 'POST',
url: '/ajax/switchdebug.php',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest',
'X-Glpi-Csrf-Token': csrf,
},
body: {
'debug': 'off',
},
}).then(() => {
cy.reload();
});
});
});

Expand Down

0 comments on commit b213cf1

Please sign in to comment.