Skip to content
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

test(e2e): Add tests for Recent Objects #6270

Merged
merged 7 commits into from
Feb 4, 2023
Merged

test(e2e): Add tests for Recent Objects #6270

merged 7 commits into from
Feb 4, 2023

Conversation

ozyx
Copy link
Member

@ozyx ozyx commented Feb 2, 2023

Closes #6150

Describe your changes:

Adds tests for Recent Objects to cover the following:

  • Basic smoke test
  • Object renames are reflected
  • Object deleted are reflected
  • Clicking on object path navigates and updates url hash
  • Persists on refresh
  • Displays objects and aliases uniquely
  • Clicking on target button scrolls object into view and highlights it
  • Enforces a limit of 20 objects

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

- Test for 'target button' scroll and animation

- Test for persistence on refresh

- Test for displaying objects and aliases uniquely
@ozyx ozyx added this to the Target:2.2.0 milestone Feb 2, 2023
@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Merging #6270 (be38c3e) into master (be38c3e) will not change coverage.
The diff coverage is n/a.

❗ Current head be38c3e differs from pull request most recent head de39e1d. Consider uploading reports for the commit de39e1d to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6270   +/-   ##
=======================================
  Coverage   55.14%   55.14%           
=======================================
  Files         607      607           
  Lines       26108    26108           
  Branches     2381     2381           
=======================================
  Hits        14398    14398           
  Misses      11040    11040           
  Partials      670      670           
Flag Coverage Δ *Carryforward flag
e2e-ci 39.49% <0.00%> (ø) Carriedforward from 0f312a8
e2e-full 51.23% <0.00%> (ø) Carriedforward from 0f312a8
e2e-stable 54.18% <0.00%> (ø)
unit 49.70% <0.00%> (ø)

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be38c3e...de39e1d. Read the comment docs.

@@ -50,14 +54,9 @@ test.describe('Recent Objects', () => {
await page.mouse.move(0, 100);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't leave a comment on line #48 but do we have a better locator for this element?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to not use nth-child. A bit more deterministic

// Creating 21 objects takes a while, so increase the timeout
test.slow();

// Create 19 more objects (2 in beforeEach() + 19 new = 21 total)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the case, i would add a

 // Assert that two recent objects are already available
  expect(await recentObjectsList.getByRole('listitem', { name: clock.name }).count()).toBe(2);

at the very beginning of the test

@@ -54,6 +54,7 @@
<div class="c-recentobjects-listitem__target-button">
<button
class="c-icon-button icon-target"
:aria-label="`Open and scroll to ${domainObject.name}`"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to our id conversation, is it possible to reference domainObject.name as an id and use aria-labelledby to compute this aria-label?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domainObject.name is actually not unique, so wouldn't make a very good id, but I wonder if we can use the navigationPath instead as an id and reference that? we could then use aria-labelledby.

lemme play around with that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can use something like recent-object:${navigationPath} to make a unique id for these list items, but we would still be missing a meaningful, unique a11y label to label it with. When you get some time let's chat about and revisit this

@@ -24,7 +24,7 @@
<ul
v-if="orderedPath.length"
class="c-location"
:aria-label="`${domainObject.name} Breadcrumb`"
:aria-label="`${domainObject.name}`"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice

}

// Assert that the list contains 20 objects
expect(await recentObjectsList.locator('.c-recentobjects-listitem').count()).toBe(20);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there anything else worth asserting at this point given the test execution time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the test to do another test for the "target" button, this time on an extremely deeply nested object

Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really comprehensive. I just wish we had the codecov inline reporter to show us what was missed. :)

Just a few questions, and a suggestion for a better locator on line 48.

I think we might want to add a single visual test for a "deeply nested object" within the tree and recent objects components. Could you put in a stub?

- Do deep nesting of objects instead of flat objects

- Collapse the tree completely and then test the "target" button for the most deeply nested item
@ozyx ozyx enabled auto-merge (squash) February 4, 2023 00:08
@ozyx ozyx merged commit 2ac463d into master Feb 4, 2023
@ozyx ozyx deleted the mct6150 branch February 4, 2023 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[e2e] More automated tests for Recent Objects
2 participants