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

[ML] Add initial docs screenshot generation #121495

Merged
merged 13 commits into from
Dec 20, 2021
Merged

Conversation

pheyos
Copy link
Member

@pheyos pheyos commented Dec 17, 2021

Summary

This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.

Details

Scope

Not all of the initially generated screenshots are showing the desired content yet. Also, there's still a list of required screenshots that's not yet taken. This is just the basis so we have something to iterate on.

How to use it

After pulling latest changes, make sure to run yarn kbn bootstrap.

From the x-pack directory run:

node scripts/functional_tests_server.js --config test/screenshot_creation/config.ts

and when that's up, run the following in a separate terminal (again from the x-pack directory, you can also set the environment variable TEST_BROWSER_HEADLESS=1 to run in headless mode):

node scripts/functional_test_runner.js --config test/screenshot_creation/config.ts

After that has finished, you'll find the screenshots in x-pack/test/functional/screenshots/session/ml_docs.
The screenshot files all have a _new suffix, which allows to easily compare them side by side with the already existing docs screenshots.

Implementation

  • A new directory screenshot_creation has been created in x-pack/test, which behaves like a regular functional test directory but is not connected to any ciGroup, so it won't be picked up automatically and needs manual execution.
  • The changes outside of that new directory are
    • Add screenshot generation details to the ML plugin readme
    • Add / adjust data-test-subj properties in the ML UI
    • Add / adjust test helper methods: mostly ML services, but also small changes to the screenshot service and the gis_page

@pheyos pheyos added :ml v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v8.1.0 v7.17.0 labels Dec 17, 2021
@pheyos pheyos requested review from a team as code owners December 17, 2021 09:10
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Code LGTM. Tested screenshot generation locally. Great update!

await transform.wizard.assertDefineStepActive();

await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.takeScreenshot('logs-transform-preview', screenshotDirectories);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - might be worth including clone in the file name here, in case we add in a screenshot of the preview from the usual create workflow e.g logs-clone-transform-preview?

Copy link
Member Author

Choose a reason for hiding this comment

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

The screenshot file names are currently defined by the docs team and we're using the exact same names here, so it's easy for them to compare contents. I wouldn't change that as part of this PR, but we can discuss this with docs folks for a follow-up.

await ml.testExecution.logTestStep('fold scatterplot section and take screenshot');
await ml.dataFrameAnalyticsResults.expandScatterplotMatrixSection(false);
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('outliers', screenshotDirectories);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - cold add data set and view type new into this file name for consistency with the others e.g. weblog-outliers-results?

Copy link
Member Author

Choose a reason for hiding this comment

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

See my comment above: we can discuss screenshot file names with docs folks in a follow-up.

await mlScreenshots.removeFocusFromElement();
await ml.dataFrameAnalyticsResults.assertScatterplotMatrixLoaded();
await ml.dataFrameAnalyticsResults.scrollScatterplotMatrixIntoView();
await mlScreenshots.takeScreenshot('outliers-scatterplot', screenshotDirectories);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - could ad the data set name in here for consistency with the others e.g. weblog-outliers-scatterplot (although that would clash for a screenshot used from the outlier wizard).

Copy link
Member Author

Choose a reason for hiding this comment

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

See my comment above: we can discuss screenshot file names with docs folks in a follow-up.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested locally, and latest changes LGTM

@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
ml 3.5MB 3.5MB +254.0B

History

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

@pheyos pheyos added the auto-backport Deprecated - use backport:version if exact versions are needed label Dec 20, 2021
Copy link
Member

@marius-dr marius-dr left a comment

Choose a reason for hiding this comment

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

LGTM

@pheyos pheyos merged commit 1d4dce3 into elastic:main Dec 20, 2021
@pheyos pheyos deleted the docs_screenshots branch December 20, 2021 14:45
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 20, 2021
This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
8.0
7.17 Commit could not be cherrypicked due to conflicts

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 121495

pheyos added a commit to pheyos/kibana that referenced this pull request Dec 20, 2021
This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.
# Conflicts:
#	x-pack/test/functional/services/ml/test_resources.ts
kibanamachine added a commit that referenced this pull request Dec 20, 2021
This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
pheyos added a commit that referenced this pull request Dec 20, 2021
This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.
# Conflicts:
#	x-pack/test/functional/services/ml/test_resources.ts
mibragimov pushed a commit to mibragimov/kibana that referenced this pull request Dec 22, 2021
This PR utilizes the functional test runner to walk through the UI and take a couple screenshots for use in the documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed :ml release_note:skip Skip the PR/issue when compiling release notes v7.17.0 v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants