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

[Fix] Additional tests and clean up for share modal redesign initiative #183643

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

rshen91
Copy link
Contributor

@rshen91 rshen91 commented May 16, 2024

Summary

Closes #181066
Closes epic https://github.com/elastic/kibana-team/issues/735
Closes #183752

Checklist

@rshen91 rshen91 self-assigned this May 16, 2024
@rshen91 rshen91 added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label May 16, 2024
@rshen91
Copy link
Contributor Author

rshen91 commented May 16, 2024

/ci

1 similar comment
@rshen91
Copy link
Contributor Author

rshen91 commented May 16, 2024

/ci

@rshen91 rshen91 marked this pull request as ready for review May 17, 2024 00:13
@rshen91 rshen91 requested review from a team as code owners May 17, 2024 00:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@rshen91 rshen91 added the release_note:skip Skip the PR/issue when compiling release notes label May 17, 2024
@kibanamachine kibanamachine requested a review from a team as a code owner May 17, 2024 15:41
@rshen91 rshen91 removed the request for review from a team May 17, 2024 15:50
@rshen91
Copy link
Contributor Author

rshen91 commented May 20, 2024

@elastic/kibana-operations or @elastic/kibana-qa Lens app - group 4 show underlying data should show the open button for a compatible saved visualization is passing for me locally. Any ideas what I might be missing? Thank you in advance for the help 🙇🏻

@Heenawter
Copy link
Contributor

Heenawter commented May 21, 2024

@rshen91 It looks like the default short URL is causing some flakiness with this test: #183752

Running it locally, you can see that, when clicking copy link, the data-share-url parameter defaults to the long URL (including all state) and then gets overwritten with the short URL once it is generated (you can see this param cycle from empty, to the long url, to the short URL in the following video):

Screen.Recording.2024-05-21.at.10.08.55.AM.mov

This is causing flakiness because sometimes the test is fetching it in time to get the long URL, but other times it's too slow and it grabs the short URL instead. In this case, this test is specifically expecting the long URL. Do you mind taking a look into this test here as well? 🙇 Thanks so much!!

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

I've been testing various scenarios here and catched a bug.
Will list of the tested scenarios:

  • Create a visualization via Visualize library

    • ✅ Create a chart in Lens and share it before saving
    • ✅ Create a chart in Lens, save the chart in library then share it
    • ❌ Create a chart in Lens, save the chart in a new dashboard, then edit the panel and share it
      • the URL leads to an empty editor
  • Create a visualization via Dashboard

    • ✅ Create a chart in Lens and share it before saving
    • ✅ Create a chart in Lens and click on Save in library, then share it
    • ❌ Create a chart in Lens, save and return to dashboard, then edit the panel again and share it
      • the URL leads to an empty editor

I think the problem root of both scenarios are the same. Mind that in that case the shared chart is not a SO, rather a snapshot with short URL.

@rshen91
Copy link
Contributor Author

rshen91 commented May 28, 2024

I've been testing various scenarios here and catched a bug. Will list of the tested scenarios:

  • Create a visualization via Visualize library

    • ✅ Create a chart in Lens and share it before saving

    • ✅ Create a chart in Lens, save the chart in library then share it

    • ❌ Create a chart in Lens, save the chart in a new dashboard, then edit the panel and share it

      • the URL leads to an empty editor
  • Create a visualization via Dashboard

    • ✅ Create a chart in Lens and share it before saving

    • ✅ Create a chart in Lens and click on Save in library, then share it

    • ❌ Create a chart in Lens, save and return to dashboard, then edit the panel again and share it

      • the URL leads to an empty editor

I think the problem root of both scenarios are the same. Mind that in that case the shared chart is not a SO, rather a snapshot with short URL.

@dej611 Can lens make these into saved objects vs the snapshot url? I think this is the expected behavior with snapshot urls (which is why we were discussing only saved object urls at one point). I don't think this is something that the share modal can really control for on our side. Thanks

@rshen91 rshen91 requested a review from dej611 May 28, 2024 16:54
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Unskipping of Dashboard tests LGTM 🙇 I am running the two test suites through the FTR just to make sure they aren't introducing flakiness, but still approving to unblock. Thanks so much!!

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#6166

[✅] test/functional/apps/dashboard/group3/config.ts: 50/50 tests passed.
[✅] test/functional/apps/dashboard/group5/config.ts: 50/50 tests passed.

see run history

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

Just left a few comments, but overall this is really great!

@rshen91 rshen91 requested a review from tsullivan May 30, 2024 21:25
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Looking good overall, just left a few questions about the Data Discovery test changes.

Also I see that discover_security.ts is checked off in the summary list, but it doesn't look like these tests have been restored yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused about the changes here. In #180406 some of the tests in this file were removed because the new share modal defaulted to short URLs, but is that no longer the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question - we are setting the data-share-url param to be long urls for their tests but yes they're going to be short urls for users.

@@ -103,8 +103,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('ecommerce');
});

// Discover defaults to short urls - is this test helpful? Clarify in separate PR
xit('generates a report with single timefilter', async () => {
it('generates a report with single timefilter', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the serverless version of this test in x-pack/test_serverless/functional/test_suites/common/discover/x_pack/reporting.ts hasn't been unskipped yet.

Also there were some other minor changes to these files in #180406, like removing gte:now-24h/h,lte:now)))) from the reportURL check, and removing await PageObjects.reporting.checkForReportingToasts() between tests. Can any of these be restored, or is the behaviour different now?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this question has been partially resolved: the serverless test isn't skipped.

I also wonder about the minor change, and wonder if we can restore the validation of the sharing URL that @davismcphee wrote about:

diff --git x-pack/test/functional/apps/discover/reporting.ts x-pack/test/functional/apps/discover/reporting.ts
index 0b193e5b850..ab5ee99448b 100644
--- x-pack/test/functional/apps/discover/reporting.ts
+++ x-pack/test/functional/apps/discover/reporting.ts
@@ -130,7 +130,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
         expect(timeFiltersNumberInReportURL).to.be(1);
         expect(
           decodeURIComponent(reportURL).includes(
-            'query:(range:(order_date:(format:strict_date_optional_time'
+            'query:(range:(order_date:(format:strict_date_optional_time,gte:now-24h/h,lte:now))))'
           )
         ).to.be(true);
 
diff --git x-pack/test_serverless/functional/test_suites/common/discover/x_pack/reporting.ts x-pack/test_serverless/functional/test_suites/common/discover/x_pack/reporting.ts
index c0e99978750..1a500817ddd 100644
--- x-pack/test_serverless/functional/test_suites/common/discover/x_pack/reporting.ts
+++ x-pack/test_serverless/functional/test_suites/common/discover/x_pack/reporting.ts
@@ -143,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
         expect(timeFiltersNumberInReportURL).to.be(1);
         expect(
           decodeURIComponent(reportURL).includes(
-            'query:(range:(order_date:(format:strict_date_optional_time'
+            'query:(range:(order_date:(format:strict_date_optional_time,gte:now-24h/h,lte:now))))'
           )
         ).to.be(true);
 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing this out @davismcphee! Turns out you found a potential issue and now is fixed in 510d054. The tests are restored to show the absolute time of now etc. as it should be for watcher. Thanks!!

@rshen91 rshen91 requested a review from davismcphee June 4, 2024 16:43
Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM, great work!

@rshen91 rshen91 enabled auto-merge (squash) June 4, 2024 18:52
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.5MB 1.5MB +56.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
reporting 52.8KB 52.8KB +2.0B
share 55.9KB 56.0KB +75.0B
total +77.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rshen91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)
Projects
None yet
8 participants