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
fixes #5954 feat(nimbus): group home page experiment tabs by all statuses #5969
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.
Awesome! Thank you @jodyheavener , so much easier to navigate. The session thing is a neat idea but please pull that out of this pr and file a separate ticket for it, we explicitly wanted it to always land on Live
on a fresh load. We should look at the idea of storing the current tab separately. I'd like it to persist in the URL, we can look at that separately.
@@ -105,14 +105,10 @@ function expectTableCells(testId: string, cellTexts: string[]) { | |||
} | |||
|
|||
describe("DirectoryTable", () => { | |||
it("renders as expected with default columns", () => { | |||
fit("renders as expected with default columns", async () => { |
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.
Re: it
=> fit
,
What dat about? I'm a bit unclear after https://jestjs.io/docs/api#testonlyname-fn-timeout about which tests will be run with that tweaked. If this describe("DirectoryTable", ...)
suite has three it
tests set, but one of them is fit
, does that mean it will only run the 1 of the 3 tests now?
✅ fit("renders as expected with default columns", async () => {...}
❌ it("renders as expected without experiments", () => {...}
❌ it("renders as expected with custom columns", () => {...}
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.
Whoops! Leftover from testing. Good catch.
bfcecc5
to
394a089
Compare
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.
Yeyeyeyeyeye hypehypehypehype 🙏 🙏 🙏 🙏 🙏
394a089
to
92f3940
Compare
92f3940
to
698fd23
Compare
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.
Also LGTM! Thanks for the Storybook refactoring to the new pattern. 😁
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.
Preemptively requesting changes until the integration tests are greenish.
@@ -7,7 +7,7 @@ class HomePage(Page): | |||
"""Nimbus Home page.""" | |||
|
|||
_create_new_btn_locator = (By.CSS_SELECTOR, "#create-new-button") | |||
_page_wait_locator = (By.CSS_SELECTOR, ".table") | |||
_page_wait_locator = (By.CSS_SELECTOR, ".directory-table") |
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 might not be understanding the exact role of data-testid
.
Above we have the following snippet:
<table className="table" data-testid="DirectoryTable">
I don't know I'd expect this CSS selector to work if we're only setting a .table
class, but then trying to use .directory-table
here. Not sure if the selector should be something weird like table.table[data-testid="DirectoryTable"]
or if just [data-testid="DirectoryTable"]
works here (or heck, even just .table
since we're now following The Highlander rules of "there can be only one").
But now that we've split the 3 sub-tables on live into separate tabs, the tests might need to be tweaked further if we were trying to do a lookup of experiments in "Review" or "Preview" states. /cc @jrbenny35
@jodyheavener rebasing this on main may clear up the integration failure |
698fd23
to
4aabcb9
Compare
@jrbenny35 @pdehaan I'm a little stuck on these integration test failures. It appears to be having trouble finding the element to indicate the page is loaded. This was previously |
4aabcb9
to
9b893f1
Compare
Ah, curious, so we should always have a It looks like the current
experimenter/app/tests/integration/nimbus/pages/home.py Lines 20 to 25 in 568f4cf
So, re: <div className="directory-table pb-2 mt-4">
{experiments.length ? (
<table className="table" data-testid="DirectoryTable"> I'll have to poke around a bit more and see where the |
@pdehaan Oh that's interesting, locally my tests fail with:
|
Curious, since that code is now: _page_wait_locator = (By.CSS_SELECTOR, ".directory-table") And I thought that |
976b7f8
to
51b5ba1
Compare
Eyyyyyy green finally 🍏 📗 🟢 💚 🥗 |
@@ -124,7 +124,7 @@ def test_create_new_experiment_remote_settings(selenium, base_url): | |||
# Check it's live | |||
home = HomePage(selenium, base_url).wait_for_page_to_load() | |||
live_experiments = home.tables[0] | |||
assert "live experiments" in live_experiments.table_name.lower() | |||
assert home.active_tab_text, "Live" |
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 should check that the active tab has "live experiments" within it, currently, this assert will always pass.
See: https://www.w3schools.com/python/ref_keyword_assert.asp
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.
@jrbenny35 Hmm, would it always pass? I want to assert that the tab is selected (contains the .active
class). So if "Review" was selected the active_tab_text
would not equal "Live"
. I changed it to this since we removed the element/text that previously displayed "live experiments"
Edit: oh I see what you meant about the usage of assert
. Updated that, but I'm still checking for "Live" in the tab text and since "Live experiments" no longer exists.
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.
Great job!
Just 2 small questions.
@@ -105,14 +105,10 @@ function expectTableCells(testId: string, cellTexts: string[]) { | |||
} | |||
|
|||
describe("DirectoryTable", () => { | |||
it("renders as expected with default columns", () => { | |||
it("renders as expected with default columns", async () => { |
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.
Q: Why did we add async
here?
I think this is the only test in this file that is async (but I don't see any await
or returning a promise.
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.
Whoops, must have thought I was going to add an async method here and then didn't. Will update.
className={`border-top-0 ${ | ||
i === 0 ? "font-weight-bold" : "font-weight-normal" | ||
}`} | ||
className="border-top-0" | ||
key={label} | ||
data-testid="directory-table-header" |
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.
Q: does a data-testid
have to be unique?
Not a regression or change, more of a personal curiosity and didn't see any obvious answers on testing-library docs.
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.
Q: does a data-testid have to be unique?
Nope! You can use the queryAllBy*
/ findAllBy*
/ getAllBy*
methods to look up multiple elements of the same criteria. In fact, we are doing exactly that in this test file.
a0464c9
to
f476c08
Compare
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.
Closes #5954
This PR changes the directory/home page view to display for all experiment lifecycle statuses, instead of grouping them together.
As a bonus, I also added a mechanism to remember which tab you were last on.