-
-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regression tests for double suspense/double resource fetch (#3103)
* test: first cut of the instrumented suspense_tests - Based on initial concepts developed for reproducing #2937 and others, streamlined and instrumented for e2e testing and refined for inclusion as a standalone module to be plugged into some other App. * First cut of the fixtures and tests * Actually make it work properly - Instead of using examples, just feed it the table because examples will rerun the whole scenario from scratch, which isn't what we are trying to test here. - Provide a basic example with item listing to show how this will work. * Use ticketing system to disambiguate CSR calls - Keep all SSR calls on ticket 0 as a means to disambiguate them from CSR calls. For the mean time the focus of tests isn't on that behavior but this may be modified when suitable. * Update the baseline fixtures - Given the new understanding, the scenerios all being the baseline tests they are now moved into one file. - Have the checks against all calls at once for better diff output, and reword the new scenerios into more idomatic gherkin. - Streamline the steps and provide additional ones that will help with feature definitions. * Translate the reproduction steps into Gherkin * Comment out logging to avoid output interference. * Be able to reset CSR counters everywhere - Done by providing a button directly on the top level component with the navigation footer. This will be useful for the next test. * Test showing difference between hydrate and CSR - Specifically, under hydrated load, resources that shouldn't need refetching gets refetched, while CSR does not show this issue.
- Loading branch information
1 parent
d306a15
commit 0e73d18
Showing
11 changed files
with
1,129 additions
and
14 deletions.
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
94 changes: 94 additions & 0 deletions
94
examples/suspense_tests/e2e/features/check_instrumented.feature
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
@check_instrumented | ||
Feature: Instrumented Counters showing the expected values | ||
|
||
Scenario: I can fresh CSR instrumented counters | ||
Given I see the app | ||
When I access the instrumented counters via CSR | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 0 | | ||
| item_overview | 0 | | ||
| item_inspect | 0 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: I should see counter going up after viewing Item Listing | ||
Given I see the app | ||
When I select the following links | ||
| Instrumented | | ||
| Item Listing | | ||
| Counters | | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 0 | | ||
| item_inspect | 0 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 1 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
# the reload has happened in Item Listing, it follows a suspend | ||
# will be called as hydration happens. | ||
Scenario: Refreshing Item Listing should have only suspend counters | ||
Given I see the app | ||
When I access the instrumented counters via SSR | ||
And I select the component Item Listing | ||
And I reload the page | ||
And I select the component Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 0 | | ||
| item_inspect | 0 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Reset CSR Counters work as expected. | ||
Given I see the app | ||
When I access the instrumented counters via SSR | ||
And I select the component Item Listing | ||
And I click on Reset CSR Counters | ||
And I select the component Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 0 | | ||
| item_overview | 0 | | ||
| item_inspect | 0 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Standard usage of the instruments traversing down | ||
Given I see the app | ||
When I select the following links | ||
| Instrumented | | ||
| Item Listing | | ||
| Item 2 | | ||
| Inspect path3 | | ||
| Inspect path3/field1 | | ||
And I access the instrumented counters via CSR | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 1 | | ||
| item_inspect | 2 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 1 | | ||
| get_item | 1 | | ||
| inspect_item_root | 1 | | ||
| inspect_item_field | 1 | |
195 changes: 195 additions & 0 deletions
195
examples/suspense_tests/e2e/features/check_instrumented_suspense_resource.feature
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
@check_instrumented_suspense_resource | ||
Feature: Using instrumented counters for real | ||
Check that the suspend/suspense and the underlying resources are | ||
called with the expected number of times for CSR rendering. | ||
|
||
Background: | ||
|
||
Given I see the app | ||
And I select the mode Instrumented | ||
|
||
Scenario: Emulate steps 1 to 5 of issue #2961 | ||
Given I select the link Target 3## | ||
And I refresh the page | ||
When I select the following links | ||
| Item Listing | | ||
| Target 4## | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 2 | | ||
| item_inspect | 0 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 2 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Emulate step 6 of issue #2961 | ||
Given I select the link Target 41# | ||
And I refresh the page | ||
When I select the following links | ||
| Target 4## | | ||
| Target 42# | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 0 | | ||
| item_overview | 1 | | ||
| item_inspect | 2 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 1 | | ||
| inspect_item_root | 2 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Emulate step 7 of issue #2961 | ||
Given I select the link Target 42# | ||
And I refresh the page | ||
When I select the following links | ||
| Target 4## | | ||
| Target 42# | | ||
| Target 41# | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 0 | | ||
| item_overview | 1 | | ||
| item_inspect | 3 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 1 | | ||
| inspect_item_root | 3 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Emulate step 8, "not trigger double fetch". | ||
Given I select the link Target 3## | ||
And I refresh the page | ||
When I select the following links | ||
| Item Listing | | ||
| Target 4## | | ||
| Target 41# | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 2 | | ||
| item_inspect | 1 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 2 | | ||
| inspect_item_root | 1 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Like above, for the "double fetch" which shouldn't happen | ||
Given I select the link Target 3## | ||
And I refresh the page | ||
When I select the following links | ||
| Item Listing | | ||
| Target 4## | | ||
| Target 41# | | ||
| Target 3## | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 3 | | ||
| item_inspect | 1 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 3 | | ||
| inspect_item_root | 1 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Like above, but using 4## instead | ||
Given I select the link Target 3## | ||
And I refresh the page | ||
When I select the following links | ||
| Item Listing | | ||
| Target 4## | | ||
| Target 41# | | ||
| Target 4## | | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Suspend Calls | | | ||
| item_listing | 1 | | ||
| item_overview | 3 | | ||
| item_inspect | 1 | | ||
And the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 2 | | ||
| inspect_item_root | 1 | | ||
| inspect_item_field | 0 | | ||
|
||
# Currently, get_item is invoked with `3` as the argument upon | ||
# selection of `Item Listing` despite that `Item Listing` doesn't | ||
# need `get_item` calls. Seems like it may be due to the system | ||
# still reacting to the unmounting of the component that needed | ||
# view that generated the original `Item 3` (hydrated from SSR). | ||
# Tests above may also have this type of behavior, but is somewhat | ||
# masked because the direction of going down and then back up, but | ||
# if this behavior changes for the better (avoiding this spurious | ||
# resource fetch) then the above tests may need updating to reflect | ||
# the corrected behavior. Note the difference with the fully CSR | ||
# scenario after this one | ||
Scenario: Emulate part of step 8 of issue #2961 | ||
Given I select the link Target 3## | ||
And I refresh the page | ||
When I select the link Item Listing | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 1 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
# Instead of refreshing the page like above, CSR counters is reset | ||
# instead to keep the starting counter conditions identical. | ||
Scenario: Emulate above, instead of refresh page, reset csr counters | ||
Given I select the link Target 3## | ||
And I click on Reset CSR Counters | ||
When I select the link Item Listing | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | | ||
|
||
# Again, the following two sets demostrates resources making stale | ||
# and redundant requests when hydrated, and not do so when under | ||
# CSR. | ||
Scenario: Start with hydration from Target 41# and go up | ||
Given I select the link Target 41# | ||
And I refresh the page | ||
When I select the link Target 4## | ||
And I select the link Item Listing | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 1 | | ||
| inspect_item_root | 1 | | ||
| inspect_item_field | 0 | | ||
|
||
Scenario: Start with hydration from Target 41# and go up | ||
Given I select the link Target 41# | ||
And I click on Reset CSR Counters | ||
When I select the link Target 4## | ||
And I select the link Item Listing | ||
And I go check the Counters | ||
Then I see the following counters under section | ||
| Server Calls (CSR) | | | ||
| list_items | 0 | | ||
| get_item | 0 | | ||
| inspect_item_root | 0 | | ||
| inspect_item_field | 0 | |
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
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
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
Oops, something went wrong.