This repository was archived by the owner on Nov 23, 2026. It is now read-only.
Repository navigation
[tests-only][full-ci] Add e2e tests for access token renewal flows (iframe and refresh_token) - #11296
Merged
Merged
Conversation
amrita-shrestha
force-pushed
the
add-tests-for-refreshing-token
branch
9 times, most recently
from
August 2, 2024 09:50
cf9493b to
0a94876
Compare
saw-jan
force-pushed
the
add-tests-for-refreshing-token
branch
2 times, most recently
from
August 8, 2024 04:14
d775a7a to
943a4f3
Compare
saw-jan
reviewed
Aug 8, 2024
saw-jan
force-pushed
the
add-tests-for-refreshing-token
branch
from
August 8, 2024 06:45
7490c3d to
ea50eb1
Compare
saw-jan
reviewed
Aug 8, 2024
Comment on lines
+79
to
+94
| async waitForTokenRenewalViaRefreshToken(): Promise<void> { | ||
| await Promise.all([ | ||
| this.#page.waitForResponse( | ||
| (resp) => !resp.url().includes('/oidc-silent-redirect.html'), | ||
| // timeout after 50 seconds | ||
| { timeout: (config.timeout - 10) * 1000 } | ||
| ), | ||
| this.#page.waitForResponse( | ||
| (resp) => | ||
| resp.url().includes('/token') && | ||
| resp.status() === 200 && | ||
| resp.request().method() === 'POST' && | ||
| resp.request().postDataJSON().grant_type === 'refresh_token' && | ||
| resp.request().postDataJSON().hasOwnProperty('refresh_token') && | ||
| resp.request().postDataJSON().refresh_token && | ||
| resp.request().postDataJSON().hasOwnProperty('scope') && | ||
| resp.request().postDataJSON().scope.includes('offline_access'), | ||
| // timeout after 50 seconds | ||
| { timeout: (config.timeout - 10) * 1000 } | ||
| ) | ||
| ]) | ||
| } |
Member
There was a problem hiding this comment.
we added this function to check that the token renewal was done using the refresh_token.
Comment on lines
+128
to
+142
| await Promise.all([ | ||
| this.#page.waitForResponse( | ||
| (resp) => | ||
| resp.url().includes('/oidc-silent-redirect.html') && | ||
| resp.status() === 200 && | ||
| resp.request().method() === 'GET', | ||
| // timeout after 50 seconds | ||
| { timeout: (config.timeout - 10) * 1000 } | ||
| ), | ||
| this.#page.waitForResponse( | ||
| (resp) => | ||
| resp.url().endsWith('/token') && | ||
| resp.status() === 200 && | ||
| resp.request().method() === 'POST' && | ||
| resp.request().postDataJSON().grant_type === 'authorization_code' && | ||
| resp.request().postDataJSON().hasOwnProperty('code') && | ||
| resp.request().postDataJSON().code, | ||
| // timeout after 50 seconds | ||
| { timeout: (config.timeout - 10) * 1000 } | ||
| ), | ||
| waitForIframe | ||
| ]) | ||
| } |
Member
There was a problem hiding this comment.
and to check that token renewal was done via iframe
saw-jan
marked this pull request as ready for review
August 8, 2024 06:50
saw-jan
force-pushed
the
add-tests-for-refreshing-token
branch
from
August 8, 2024 11:27
ea50eb1 to
197a88e
Compare
saw-jan
reviewed
Aug 9, 2024
dschmidt
approved these changes
Aug 12, 2024
dschmidt
left a comment
Member
There was a problem hiding this comment.
This is great! Thanks a lot, I wouldn't have wanted to write this code :)
saw-jan
force-pushed
the
add-tests-for-refreshing-token
branch
2 times, most recently
from
August 12, 2024 08:28
f4b504a to
d607d05
Compare
saw-jan
force-pushed
the
add-tests-for-refreshing-token
branch
from
August 12, 2024 08:29
d607d05 to
7981baa
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR adds tests coverage for access token refresh flow. Currently, we have two flows in
weboCIS / oidc with refresh token (i.e.
offline_accessin requested scopes) works (WEB_OIDC_SCOPE="openid profile email offline_access" IDP_ACCESS_TOKEN_EXPIRATION=30)oCIS / oidc without refresh token (i.e. token renewal via iframe) works (IDP_ACCESS_TOKEN_EXPIRATION=10)
iframe visible for a short period of time so it's hard to detect the iframe using the playwrightlocator/framelocatoruse webUI steps only for oidc journey so that we don't have to update access token at certain interval and after hook
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Open tasks: