-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(E2E) : fix Keyclock issue #4143
base: develop
Are you sure you want to change the base?
Conversation
Important Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent update introduces a new Cypress command Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- centreon/tests/e2e/support/commands.ts (3 hunks)
Additional comments not posted (1)
centreon/tests/e2e/support/commands.ts (1)
27-27
: Integration ofrewriteHeaders
inloginKeycloak
looks appropriate for handling authentication-related header issues.
Cypress.Commands.add('rewriteHeaders', () => { | ||
cy.intercept('*', (req) => | ||
req.on('response', (res) => { | ||
const setCookies = res.headers['set-cookie']; | ||
res.headers['set-cookie'] = ( | ||
Array.isArray(setCookies) ? setCookies : [setCookies] | ||
) | ||
.filter((x) => x) | ||
.map((headerContent) => | ||
headerContent.replace( | ||
/samesite=(lax|strict)/gi, | ||
'secure; samesite=none' | ||
) | ||
); | ||
}) | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rewriteHeaders
function correctly handles cookie settings for cross-site requests. Consider adding comments to explain the rationale behind replacing 'samesite' attributes, which will aid future maintenance.
+ // This function intercepts all HTTP requests and modifies 'set-cookie' headers.
+ // It replaces 'samesite=lax' or 'samesite=strict' with 'secure; samesite=none' to ensure cookies are always sent securely and without restrictions across sites.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Cypress.Commands.add('rewriteHeaders', () => { | |
cy.intercept('*', (req) => | |
req.on('response', (res) => { | |
const setCookies = res.headers['set-cookie']; | |
res.headers['set-cookie'] = ( | |
Array.isArray(setCookies) ? setCookies : [setCookies] | |
) | |
.filter((x) => x) | |
.map((headerContent) => | |
headerContent.replace( | |
/samesite=(lax|strict)/gi, | |
'secure; samesite=none' | |
) | |
); | |
}) | |
); | |
}); | |
Cypress.Commands.add('rewriteHeaders', () => { | |
// This function intercepts all HTTP requests and modifies 'set-cookie' headers. | |
// It replaces 'samesite=lax' or 'samesite=strict' with 'secure; samesite=none' to ensure cookies are always sent securely and without restrictions across sites. | |
cy.intercept('*', (req) => | |
req.on('response', (res) => { | |
const setCookies = res.headers['set-cookie']; | |
res.headers['set-cookie'] = ( | |
Array.isArray(setCookies) ? setCookies : [setCookies] | |
) | |
.filter((x) => x) | |
.map((headerContent) => | |
headerContent.replace( | |
/samesite=(lax|strict)/gi, | |
'secure; samesite=none' | |
) | |
); | |
}) | |
); | |
}); |
Code coverage report for centreon component 🚀Coverage after merging fixAuthTests into develop will be
Coverage Report for Changed Files
|
Description
PLEASE MAKE SURE THAT THE BRANCH PR INCLUDES JIRA TICKET ID (for centreon-internal)
Please include a short resume of the changes and what is the purpose of PR. Any relevant information should be added to help:
Fixes # (issue)
Type of change
Target serie
How this pull request can be tested ?
Please describe the procedure to verify that the goal of the PR is matched. Provide clear instructions so that it can be correctly tested.
Any relevant details of the configuration to perform the test should be added.
Checklist
Community contributors & Centreon team