-
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
Improve the stability of SAML integ test #1237
Conversation
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.
Could you provide more details as to why the driver.findElement(...)
path didn't work out? It seems like if we can't verify this scenario from the UX something is wrong with the product
@@ -326,12 +326,14 @@ describe('start OpenSearch Dashboards server', () => { | |||
|
|||
await driver.wait(until.elementsLocated(By.xpath(tenantNameLabelXPath)), 10000); | |||
|
|||
const tenantName = await driver.findElement(By.xpath(tenantNameLabelXPath)).getText(); | |||
const localStorageItem = await driver.executeScript( |
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 after login
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:
- Go to the overview page
- Sign in (Not as clear how this is actually done in the test...)
- Select the global tenant, confirm
- Sign out
- Sign back in
- Skip the popup-ux
- Wait until the tenant label appears and show
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.
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.
However, it just doesn't switch to the expected tenant (It sometimes stays as "private" [1])
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
Any updates for this PR, or anything we can help with? |
Hi @peternied I was working with @scrawfor99 for the windows support for CI. This one I may need the help from @anijain-Amazon . Since he is the author of the original SAML integ test. |
d60060e
to
920df4f
Compare
Signed-off-by: Ryan Liang <[email protected]>
920df4f
to
6b31de1
Compare
Codecov Report
@@ Coverage Diff @@
## main #1237 +/- ##
=======================================
Coverage 71.78% 71.78%
=======================================
Files 88 88
Lines 2027 2027
Branches 269 269
=======================================
Hits 1455 1455
Misses 509 509
Partials 63 63 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I updated this PR with a temporary fix/enhancement by adding another tenant switching and check if it is the scenario that the webdriver doesn't reload to update the tenant info according to local storage. This will do both of improving the stability and testing the actual UI elements. |
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.
SMART! I love that while something is busted, this will increase the reliable and remove the pressure while attempting to validate the scenario as well as we can.
@RyanL1997 Looks like both CI checks failed due to same reason: |
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.
Nice workaround and for persisting through this issue! It looks like this is an issue with the headless browser and not with the actual code for switching to a tenant based on the value in local storage.
Signed-off-by: Ryan Liang <[email protected]> (cherry picked from commit 7ffbf09)
Signed-off-by: Ryan Liang <[email protected]> (cherry picked from commit 7ffbf09) Co-authored-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang [email protected]
Description
Fix the stability of SAML integ test
Category
Enhancement
Issues Resolved
Testing
[Please provide details of testing done: unit testing, integration testing and manual testing]
Check List
New functionality includes testingNew functionality has been documentedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.