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

[Canvas] Adds functional test for Canvas custom elements #52920

Merged
merged 3 commits into from
Jan 14, 2020

Conversation

poffdeluxe
Copy link
Contributor

Summary

New functional test walks through the custom element life cycle:

  1. A custom element is created from the markdown element on the test workpad
  2. The custom element is added to (and removed from) the workpad
  3. The custom element is edited
  4. The custom element is finally deleted

@poffdeluxe poffdeluxe added review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort v8.0.0 release_note:skip Skip the PR/issue when compiling release notes impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. v7.6.0 labels Dec 12, 2019
@poffdeluxe poffdeluxe requested a review from a team as a code owner December 12, 2019 17:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas (Team:Canvas)

Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

Thank you for adding more tests!
I added some comments about the test design and find/testSubjects usage.

x-pack/test/functional/apps/canvas/custom_elements.ts Outdated Show resolved Hide resolved
x-pack/test/functional/apps/canvas/custom_elements.ts Outdated Show resolved Hide resolved
x-pack/test/functional/apps/canvas/custom_elements.ts Outdated Show resolved Hide resolved
x-pack/test/functional/apps/canvas/custom_elements.ts Outdated Show resolved Hide resolved
x-pack/test/functional/apps/canvas/custom_elements.ts Outdated Show resolved Hide resolved

// Close the modal
await browser.pressKeys(browser.keys.ESCAPE);
});
Copy link
Member

Choose a reason for hiding this comment

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

It is not critical, but nice to wrap element search and interactions into "user-readable" functions. In this case, test scenario is easy to understand and support in the future.

it('deletes custom element when prompted', async () => {
  await PageObjects.canvas.openCustomElementsTab();
  await PageObjects.canvas.checkCustomElementsCount(1);
  await PageObjects.canvas.deleteElementByIndex(0);
  await PageObjects.canvas.checkCustomElementsCount(0);
}

@dmlemeshko
Copy link
Member

Hey @poffdeluxe
Your changes look good, I ran tests locally on both Chrome and Firefox.
Add actually KIbana crashes on FF:

Kibana 2019-12-16 13-32-22

test logged error:

       │ debg browser[info] "INFO: 2019-12-16T12:31:45Z\n  Adding connection to http://localhost:5620/elasticsearch\n\n"
       │ERROR browser[error] "Possibly unhandled rejection: {\"data\":null,\"status\":-1,\"config\":{\"method\":\"GET\",\"transformRequest\":[null],\"transformResponse\":[null],\"jsonpCallbackParam\":\"callback\",\"url\":\"/internal/security/me\",\"params\":{},\"headers\":{\"Accept\":\"application/json, text/plain, */*\",\"kbn-version\":\"8.0.0\"}},\"statusText\":\"\",\"xhrStatus\":\"abort\",\"resource\":{}}"
       │ debg Finished login process currentUrl = http://localhost:5620/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
       │ debg ... sleep(501) start
       │ERROR browser[error] (new TypeError("label is undefined", "http://localhost:5620/bundles/commons.bundle.js", 13630))
       │ debg browser[warn] "*** Uncaught error swallowed in dev mode ***\n\n  Check and fix the above error. This will blow up Kibana when run in production mode!"
       │ERROR browser[error] "The above error occurred in the <HeaderUI> component:\n    in HeaderUI (created by InjectIntl(HeaderUI))\n    in InjectIntl(HeaderUI) (created by HeaderWrapper)\n    in div (created by HeaderWrapper)\n    in HeaderWrapper\n    in div\n    in PseudoLocaleWrapper (created by I18nProvider)\n    in IntlProvider (created by I18nProvider)\n    in I18nProvider\n\nConsider adding an error boundary to your tree to customize error handling behavior.\nVisit https://fb.me/react-error-boundaries to learn more about error boundaries."

You can reproduce it by running:

  1. node scripts/functional_test_server --config test/functional/config.js
  2. node scripts/functional_test_runner --config test/functional/config.firefox.js (in other terminal window)

@poffdeluxe poffdeluxe force-pushed the custom-element-func-test branch 3 times, most recently from d4f5e15 to a30e28d Compare December 18, 2019 21:45
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

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

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@poffdeluxe
Copy link
Contributor Author

poffdeluxe commented Jan 14, 2020

Spoke with @dmlemeshko briefly over slack but I think for now we're gonna skip the tests on firefox if they're interactive. Something is going on with the firefox functional tests and clicking on the elements in the workpad.

@poffdeluxe poffdeluxe merged commit 60f6475 into elastic:master Jan 14, 2020
@poffdeluxe poffdeluxe deleted the custom-element-func-test branch January 14, 2020 21:29
poffdeluxe added a commit to poffdeluxe/kibana that referenced this pull request Jan 14, 2020
* Adds functional test for Canvas custom elements

feedback cleanup

* Opening up Canvas app first

* Add skip firefox tag to custom element test
poffdeluxe added a commit that referenced this pull request Jan 14, 2020
…4822)

* Adds functional test for Canvas custom elements

feedback cleanup

* Opening up Canvas app first

* Add skip firefox tag to custom element test
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
* Adds functional test for Canvas custom elements

feedback cleanup

* Opening up Canvas app first

* Add skip firefox tag to custom element test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants