-
Notifications
You must be signed in to change notification settings - Fork 440
feat: poc integration tests for identities management express.js samples #2389
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
base: master
Are you sure you want to change the base?
feat: poc integration tests for identities management express.js samples #2389
Conversation
…n and signup tests
3729456 to
4c2f3ab
Compare
…-integration-tests
zepatrik
left a comment
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.
While the overall approach looks good, I'm thinking whether it makes more sense to have everything in one file. What you have is a bit more boilerplate (passing the SDK and exporting again), while the reader might want to have everything in one file in the end when copy-pasting. The current content is meant to be all in one file, while yours is meant to be split up. I'm pretty sure you can cut the code up into sections and only show parts of it for each code box. WDYT?
| ) | ||
| }) | ||
| export const registerSignUpRoute = (app, ory, baseUrl) => { | ||
| app.get("/", (req, res) => { |
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.
Maybe instead of this multi-router approach, it makes more sense to have the proper paths right here?
| app.get("/", (req, res) => { | |
| app.get("/signup", (req, res) => { |
| }) | ||
|
|
||
| // Routers that reuse the docs sample snippets. | ||
| const signupRouter = express.Router() |
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.
And then here we would not need all these routers, but just one?
| for (let cookieStr of cookieStrings) { | ||
| cookieStr = cookieStr.trim() | ||
| // Take only the name=value part (before first semicolon) | ||
| const nameValue = cookieStr.split(";")[0].trim() |
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.
Should we check that there is at least one element before trying to access it?
Same a few lines below.
This PoC introduces integration tests for Ory Identity session management flows, ensuring that the code examples in our documentation work correctly end-to-end.
The tests run against a test Express.js server that directly imports and uses code examples from the documentation.
While the tests use Ory's self-service API for login (via
selfServiceLogin()utility), they validate the complete end-to-end flows for:Logout Flow: After authenticating via self-service API, the tests verify that the logout endpoint in the example app correctly handles session termination and redirects appropriately.
Session Management Flow: Tests verify that authenticated sessions can be retrieved and validated through the example app's session endpoints.
Tests run in GitHub Actions with secrets injected for:
ORY_SDK_URL- Ory test account endpoint URLTEST_USER_EMAIL- Test user credentialsTEST_USER_PASSWORD- Test user credentialsChecklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
Further comments