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

unskips application leave confirm & application deep links tests #168741

Merged

Conversation

TinaHeiligers
Copy link
Contributor

@TinaHeiligers TinaHeiligers commented Oct 12, 2023

fix #166838
fix #166893
fix #75963

I modified the deep links tests because the side nav was overlaying the in-app nav.
While, theoretically, the side nav should work for the tests, it tends to be flaky.

I added logs for the url so that if these tests do fail, we'll have a bit more data to go on for debugging.
These tests pass on local test runs.

latest flaky test runs (50): https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3604

@TinaHeiligers TinaHeiligers added backport Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc release_note:skip Skip the PR/issue when compiling release notes v8.11.0 labels Oct 12, 2023
@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Unskips tests and adds debug log for the current url.

// Failing: See https://github.com/elastic/kibana/issues/75963
// Failing: See https://github.com/elastic/kibana/issues/166838
describe.skip('application using leave confirmation', () => {
describe('application using leave confirmation', () => {
Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Oct 12, 2023

Choose a reason for hiding this comment

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

This test suite needed a complete overhaul to account for increased delays that various background tasks perform (ebt data collection, fleet setup etc).

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@@ -39,8 +39,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});
};

// Failing: See https://github.com/elastic/kibana/issues/166893
describe.skip('application deep links navigation', function describeDeepLinksTests() {
describe('application deep links navigation', function describeDeepLinksTests() {
Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Oct 15, 2023

Choose a reason for hiding this comment

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

@elastic/appex-sharedux I could use a hand in figuring out why tests using appMenu.clickLink fail in CI and pass locally. The most recent changes to relevant components seems to be with CollapsibleNav but that was 4 months ago.

The appLeave test failed because the modal wasn't visible.

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers marked this pull request as ready for review October 16, 2023 23:16
@TinaHeiligers TinaHeiligers requested a review from a team as a code owner October 16, 2023 23:16
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

…eiligers/kibana into skipped-tests-app-leave-deep-links
@TinaHeiligers
Copy link
Contributor Author

None of the test failures are related to this PR.

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

I ended up completely overhauling the app leave tests. With all the background events that now happen when kibana runs, it's no surprise these tests are flaky!

describe('when navigating to another app', () => {
it('prevents navigation if user click cancel on the confirmation dialog', async () => {
it('allows navigation if user click confirm on the confirmation dialog', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I swapped the order to test if it's an actual test failure or if it's the first test in the suite that fails. Turns out it's the first test that fails in CI because the modal doesn't show.

@@ -411,9 +411,18 @@ export class CommonPageObject extends FtrService {
* Clicks cancel button on modal
* @param overlayWillStay pass in true if your test will show multiple modals in succession
*/
async clickCancelOnModal(overlayWillStay = true) {
async clickCancelOnModal(overlayWillStay = true, ignorePageLeaveWarning = false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted to allow re-calling similar test flow for both navigation options (cancel | confirm)

await this.testSubjects.click('confirmModalCancelButton');
await this.testSubjects.exists('confirmModalTitleText');

await this.retry.try(async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have to wait for the modal to fade in, which takes time, likely even longer in CI

@@ -59,6 +59,7 @@ export class AppsMenuService extends FtrService {
if (!(await this.testSubjects.exists('collapsibleNav'))) {
await this.testSubjects.click('toggleNavButton');
}
await this.testSubjects.exists('collapsibleNav');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helper wasn't confirming a 'happy-path', we should assert that the nav flyout does appear before progressing to use any of the nav methods (clicking an app title for example)

@@ -15,6 +15,8 @@ export class CoreAppLeavePlugin
core.application.register({
id: 'appleave1',
title: 'AppLeave 1',
appRoute: '/app/appleave1',
category: DEFAULT_APP_CATEGORIES.kibana,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cheated here a little, adding the test plugins to the Analytics section to find them without having to scroll through all the other plugins in the nav flyout.

@@ -29,7 +29,7 @@ export class CorePluginDeepLinksPlugin
},
{
id: 'pageA',
title: 'DL Page A',
title: 'DL page A',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test plugins and test suites themselves weren't using consistent case, making it hard to debug if the tests fail. Inconsistent case can also easily be missed in future refactors so keep it simple: Use consistent case.

});
};

const ensureModalOpen = async (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test helper to make it easier to recall

await testSubjects.existOrFail('appLeaveConfirmModal');
await PageObjects.common.clickConfirmOnModal();
expect(await browser.getCurrentUrl()).to.eql(getKibanaUrl('/app/appleave2'));
await appsMenu.clickLink('AppLeave 2');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Navigating to another app kicks off ebt metrics collection along with a host of other automated background tasks. We need to give those time to execute.

});
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain('appleave2');
await PageObjects.common.navigateToApp('home');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Navigating away completely is the only way to ensure the browser doesn't get "stuck" in a rendering frenzy.

Copy link
Contributor

Choose a reason for hiding this comment

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

yikes 😄 , do you know what the source is of the rendering frenzy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the side nav, the react hooks and the multiple ways navigation can occur. Mostly, though, it's the browser + delays in fading in and out.

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Did not run locally, but overall LGTM!

});
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain('appleave2');
await PageObjects.common.navigateToApp('home');
Copy link
Contributor

Choose a reason for hiding this comment

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

yikes 😄 , do you know what the source is of the rendering frenzy?

Copy link
Contributor

@dokmic dokmic left a comment

Choose a reason for hiding this comment

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

Great job fixing this 👍
This PR also resolves #75963, as it has the same origin as #166838.

@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.11

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 19, 2023
…stic#168741)

fix elastic#166838
fix elastic#166893
fix elastic#75963

I modified the deep links tests because the side nav was overlaying the
in-app nav.
While, theoretically, the side nav should work for the tests, it tends
to be flaky.

I added logs for the url so that if these tests do fail, we'll have a
bit more data to go on for debugging.
These tests pass on local test runs.

latest flaky test runs (50):
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3604

- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit e811b62)
kibanamachine added a commit that referenced this pull request Oct 19, 2023
…ts (#168741) (#169395)

# Backport

This will backport the following commits from `main` to `8.11`:
- [unskips application leave confirm & application deep links tests
(#168741)](#168741)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christiane (Tina)
Heiligers","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-19T13:03:24Z","message":"unskips
application leave confirm & application deep links tests
(#168741)\n\nfix https://github.com/elastic/kibana/issues/166838\r\nfix
https://github.com/elastic/kibana/issues/166893\r\nfix
https://github.com/elastic/kibana/issues/75963\r\n\r\nI modified the
deep links tests because the side nav was overlaying the\r\nin-app
nav.\r\nWhile, theoretically, the side nav should work for the tests, it
tends\r\nto be flaky.\r\n\r\nI added logs for the url so that if these
tests do fail, we'll have a\r\nbit more data to go on for
debugging.\r\nThese tests pass on local test runs.\r\n\r\nlatest flaky
test runs
(50):\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3604\r\n\r\n\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"e811b624ff5e706a283949a406af31bf090e963c","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","Team:Core","release_note:skip","v8.11.0","v8.12.0"],"number":168741,"url":"https://github.com/elastic/kibana/pull/168741","mergeCommit":{"message":"unskips
application leave confirm & application deep links tests
(#168741)\n\nfix https://github.com/elastic/kibana/issues/166838\r\nfix
https://github.com/elastic/kibana/issues/166893\r\nfix
https://github.com/elastic/kibana/issues/75963\r\n\r\nI modified the
deep links tests because the side nav was overlaying the\r\nin-app
nav.\r\nWhile, theoretically, the side nav should work for the tests, it
tends\r\nto be flaky.\r\n\r\nI added logs for the url so that if these
tests do fail, we'll have a\r\nbit more data to go on for
debugging.\r\nThese tests pass on local test runs.\r\n\r\nlatest flaky
test runs
(50):\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3604\r\n\r\n\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"e811b624ff5e706a283949a406af31bf090e963c"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168741","number":168741,"mergeCommit":{"message":"unskips
application leave confirm & application deep links tests
(#168741)\n\nfix https://github.com/elastic/kibana/issues/166838\r\nfix
https://github.com/elastic/kibana/issues/166893\r\nfix
https://github.com/elastic/kibana/issues/75963\r\n\r\nI modified the
deep links tests because the side nav was overlaying the\r\nin-app
nav.\r\nWhile, theoretically, the side nav should work for the tests, it
tends\r\nto be flaky.\r\n\r\nI added logs for the url so that if these
tests do fail, we'll have a\r\nbit more data to go on for
debugging.\r\nThese tests pass on local test runs.\r\n\r\nlatest flaky
test runs
(50):\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3604\r\n\r\n\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"e811b624ff5e706a283949a406af31bf090e963c"}}]}]
BACKPORT-->

Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
gsoldevila added a commit that referenced this pull request Nov 2, 2023
…0228)

## Summary

Attempt at fixing #166893

PR [#168741](#168741) forgot to
update one of the tests to **exclusively** use `navigateToAppLinks`.
Thus, the impacted test had a duplicated navigation logic.

This PR:
* removes that unintended call (this should hopefully fix flakiness).
* simplifies and unifies test logic, improving readability.

Flaky test runner pipeline - 100x 🟢  
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3840
delanni pushed a commit to delanni/kibana that referenced this pull request Nov 6, 2023
…stic#170228)

## Summary

Attempt at fixing elastic#166893

PR [elastic#168741](elastic#168741) forgot to
update one of the tests to **exclusively** use `navigateToAppLinks`.
Thus, the impacted test had a duplicated navigation logic.

This PR:
* removes that unintended call (this should hopefully fix flakiness).
* simplifies and unifies test logic, improving readability.

Flaky test runner pipeline - 100x 🟢  
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment