-
Notifications
You must be signed in to change notification settings - Fork 164
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
Improve the stability of SAML integ test #1237
Merged
RyanL1997
merged 4 commits into
opensearch-project:main
from
RyanL1997:fix-saml-stability
Dec 14, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
Know why the text wasn't loading? These test are suppose to make sure the UX is rendering the correct content, and this change effectively works around inspecting the UI - this is a major hit to the functionality of the test to use the localstorage state.
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.
Hi @peternied, thanks for the review! I totally agree that we should test out the actual UI elements. However, according to the experiments @cwperks and I did on my local machine, it is not about the loading of that UI elements. It is something about the selenium webdriver, and I have also tried out different webdrivers such as chromedriver and they all have a very high chance for not go through the second
window.reload()
for updating the saved tenant according to the localstorage key. So there is nothing we can do about the webdriver for now :(However, I'm willing to figure out a work around as an another approach if it is necessary.
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.
@RyanL1997 I was just looking at the requests that happen after login and I believe what we can do is wait for a response from
http://<osd_baseurl>/api/v1/multitenancy/tenant
before clicking on the user dropdown and viewing the tenant info. This endpoint is called afterlogin
to get the current tenant info from what I can see.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.
With playwright its possible to do a
page.waitForResponse(urlOrPredicate...
, but I'm not sure if selenium has something similar.https://playwright.dev/docs/api/class-page#page-wait-for-response
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 we can dig into this a little more to see what the test should do verses what is hard to do, Quickly reading the test:
Global
Seems like knowing we are on the global tenant is a critical part of the test
Can we find an element that is blank until the tenant query has resolved? We could add an element with an ID that would be easy to find and wait for it to disappear when the tenant has loaded if that is part of the problem.
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.
@peternied Thanks for this info. The problem we are having right now is not about the loading of the UI. We are can load and locate this UI. However, it just doesn't switch to the expected tenant (It sometimes stays as "private" [1]). For now, I am trying to implement a retry for this scenario, and I am also taking a look into @cwperks 's suggestion to see how much effort will it take us to switch to another test frame work.
Reference:
[1]:
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.
This sounds like a product bug?
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.
I don think so, because, based on the experiment I did so far, it wont happen to the regular browser, and it is just the webdriver we are using got a high chance to not reload the window for updating tenant information according to the local storage.
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.
@RyanL1997 Another thought, maybe its possible to use
until.elementTextIs(element, text)
?https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html