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

[Log Explorer] Missing test suite for DatasetSelector in log-explorer profile #160627

Closed
tonyghiani opened this issue Jun 27, 2023 · 2 comments · Fixed by #163079
Closed

[Log Explorer] Missing test suite for DatasetSelector in log-explorer profile #160627

tonyghiani opened this issue Jun 27, 2023 · 2 comments · Fixed by #163079
Assignees
Labels
Feature:LogsExplorer Logs Explorer feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services

Comments

@tonyghiani
Copy link
Contributor

📓 Summary

During the implementation of the new customization in the Discover plugin, testing was not prioritized as the feature is still a work in progress and the final user experience (UX) is yet to be determined. However, it is crucial to implement a comprehensive test suite to ensure the correct behaviour of the DatasetSelector component. The DatasetSelector has several specific behaviours that need to be tested thoroughly to ensure a reliable and functional user interface.

We want to implement a functional tests suite to guarantee the possible user journeys are executed with no errors.

✔️ Acceptance criteria

  • When the user loads the discover log-explorer profile, he can see the DatasetSelector trigger button with the currently selected dataset name.
  • The user clicks on the DatasetSelector trigger button and opens a dropdown menu. On the first navigation level...
    • If the integrations are correctly fetched with results, it displays a list of installed integrations that have data streams of the logs type.
    • If the integrations are correctly fetched without available results, it displays a no results message.
    • If the integrations are not fetched due to an error, it displays a message and a retry prompt.
    • It should always display an "uncategorized datasets" entry for datasets that are not defined by an integration.
    • The user can search by integration name or sort alphabetically by the integrations’ name.
    • If the search does not match any result, it displays a no results message.
  • When the user selects an integration, it navigates to a nested panel. On the second navigation level…
    • The use can select a dataset.
    • The user can search by dataset name or sort alphabetically by the dataset’s name.
  • When the user selects the "uncategorized datasets" entry, the list should be queried lazily…
    • While it is fetching, it should render a loading skeleton.
    • If the datasets are correctly fetched without available results, it displays a no results message.
    • If the datasets are not fetched due to an error, it displays a message and a retry prompt.
  • The DatasetSelector search and sort UI elements should be associated with the currently viewed panel. Navigating across panels should restore the pending search on the selected integration.
  • Selecting a dataset from the DatasetSelector should set Discover's current data view to an ad-hoc data view synthesised using the data stream name.

This list covers the principal user journey available on the first iteration of this component, but we should also implement tests for all the upcoming features (multi-selection, restore selection… etc).

💡Implementation hints

With #159907 we created a x-pack/test/functional/apps/discover_log_explorer with some basic tests to verify whether the customizations are correctly applied. We can keep working from there, maybe creating a dataset_selector_customization.ts file that implements the above tests.

@tonyghiani tonyghiani added Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services labels Jun 27, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@tonyghiani tonyghiani changed the title [Logs+] Missing test suite for DatasetSelector in log-explorer profile [Log Explorer] Missing test suite for DatasetSelector in log-explorer profile Jun 27, 2023
@tonyghiani tonyghiani self-assigned this Jul 3, 2023
@weltenwort
Copy link
Member

Would it be possible to also include a serverless functional test? There is some documentation about that in https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/README.md.

tonyghiani added a commit that referenced this issue Aug 11, 2023
## 📓 Summary

Closes #160627 

This implementation adds the majority of the tests listed down here for
the Log Explorer current implementation.

✅ [**Flaky Test Runner - x50
executions**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2844#_)

```
↳ Discover Log-Explorer profile
   ↳ Columns selection initialization and update
     ↳ when the log explorer profile loads
       ↳ should initialize the table columns to logs' default selection
       ↳ should restore the table columns from the URL state if exists
   ↳ Customizations
     ↳ when Discover is loaded with the log-explorer profile
       ↳ DatasetSelector should replace the DataViewPicker
       ↳ the TopNav bar should hide the New, Open and Save options
       ↳ should add a searchable deep link to the profile page
       ↳ should render a filter controls section as part of the unified search bar
   ↳ DatasetSelection initialization and update
     ↳ when the "index" query param does not exist
       ↳ should initialize the "All log datasets" selection
     ↳ when the "index" query param exists
       ↳ should decode and restore the selection from a valid encoded index
       ↳ should fallback to the "All log datasets" selection and notify the user of an invalid encoded index
     ↳ when navigating back and forth on the page history
       ↳ should decode and restore the selection for the current index
   ↳ Dataset Selector
     ↳ without installed integrations or uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display an error prompt if could not retrieve the integrations
         ↳ should display an empty prompt for no integrations
       ↳ when navigating into Uncategorized data streams
         ↳ should display a loading skeleton while loading
         ↳ should display an error prompt if could not retrieve the data streams
         ↳ should display an empty prompt for no data streams
     ↳ with installed integrations and uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display a list of installed integrations
         ↳ should sort the integrations list by the clicked sorting option
         ↳ should filter the integrations list by the typed integration name
         ↳ should display an empty prompt when the search does not match any result
         ↳ should load more integrations by scrolling to the end of the list
       ↳ when clicking on integration and moving into the second navigation level
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when navigating into Uncategorized data streams
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when open/close the selector
         ↳ should restore the latest navigation panel
         ↳ should restore the latest search results
       ↳ when switching between integration panels
         ↳ should remember the latest search and restore its results for each integration
```

## Note on serverless tests suite

For testing the feature in a serverless environment, we are copying all
the tests into the `x-pack/test_serverless` folder until
#161574 is merged, which will
provide a new space to write tests independently from the deployment
type, avoiding then tests duplication.

## New `browser` service utils for Network conditions simulation

To properly test that this feature works correctly under poor network
conditions or offline scenarios, the `browser` service now exposes some
new methods for altering network conditions on demand.

Also, network profiles to match the [network profiles provided by Chrome
debugger](https://github.com/ChromeDevTools/devtools-frontend/blob/da276a3faec9769cb55e442f0db77ebdce5cd178/front_end/core/sdk/NetworkManager.ts#L363-L393)
have been created.

In case the browser is not of `chromium` type and the driver does not
support the network simulation, these methods throw an error that can be
caught for skipping the affected test.

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
benakansara pushed a commit to benakansara/kibana that referenced this issue Aug 14, 2023
## 📓 Summary

Closes elastic#160627 

This implementation adds the majority of the tests listed down here for
the Log Explorer current implementation.

✅ [**Flaky Test Runner - x50
executions**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2844#_)

```
↳ Discover Log-Explorer profile
   ↳ Columns selection initialization and update
     ↳ when the log explorer profile loads
       ↳ should initialize the table columns to logs' default selection
       ↳ should restore the table columns from the URL state if exists
   ↳ Customizations
     ↳ when Discover is loaded with the log-explorer profile
       ↳ DatasetSelector should replace the DataViewPicker
       ↳ the TopNav bar should hide the New, Open and Save options
       ↳ should add a searchable deep link to the profile page
       ↳ should render a filter controls section as part of the unified search bar
   ↳ DatasetSelection initialization and update
     ↳ when the "index" query param does not exist
       ↳ should initialize the "All log datasets" selection
     ↳ when the "index" query param exists
       ↳ should decode and restore the selection from a valid encoded index
       ↳ should fallback to the "All log datasets" selection and notify the user of an invalid encoded index
     ↳ when navigating back and forth on the page history
       ↳ should decode and restore the selection for the current index
   ↳ Dataset Selector
     ↳ without installed integrations or uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display an error prompt if could not retrieve the integrations
         ↳ should display an empty prompt for no integrations
       ↳ when navigating into Uncategorized data streams
         ↳ should display a loading skeleton while loading
         ↳ should display an error prompt if could not retrieve the data streams
         ↳ should display an empty prompt for no data streams
     ↳ with installed integrations and uncategorized data streams
       ↳ when open on the first navigation level
         ↳ should always display the "All log datasets" entry as the first item
         ↳ should always display the unmanaged datasets entry as the second item
         ↳ should display a list of installed integrations
         ↳ should sort the integrations list by the clicked sorting option
         ↳ should filter the integrations list by the typed integration name
         ↳ should display an empty prompt when the search does not match any result
         ↳ should load more integrations by scrolling to the end of the list
       ↳ when clicking on integration and moving into the second navigation level
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when navigating into Uncategorized data streams
         ↳ should display a list of available datasets
         ↳ should sort the datasets list by the clicked sorting option
         ↳ should filter the datasets list by the typed dataset name
         ↳ should update the current selection with the clicked dataset
       ↳ when open/close the selector
         ↳ should restore the latest navigation panel
         ↳ should restore the latest search results
       ↳ when switching between integration panels
         ↳ should remember the latest search and restore its results for each integration
```

## Note on serverless tests suite

For testing the feature in a serverless environment, we are copying all
the tests into the `x-pack/test_serverless` folder until
elastic#161574 is merged, which will
provide a new space to write tests independently from the deployment
type, avoiding then tests duplication.

## New `browser` service utils for Network conditions simulation

To properly test that this feature works correctly under poor network
conditions or offline scenarios, the `browser` service now exposes some
new methods for altering network conditions on demand.

Also, network profiles to match the [network profiles provided by Chrome
debugger](https://github.com/ChromeDevTools/devtools-frontend/blob/da276a3faec9769cb55e442f0db77ebdce5cd178/front_end/core/sdk/NetworkManager.ts#L363-L393)
have been created.

In case the browser is not of `chromium` type and the driver does not
support the network simulation, these methods throw an error that can be
caught for skipping the affected test.

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@gbamparop gbamparop added Feature:LogsExplorer Logs Explorer feature and removed Feature:Logs UI Logs UI feature labels Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:LogsExplorer Logs Explorer feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants