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

[x-pack/ftr] refactor types to be more accurate/consistent with oss #42407

Merged

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jul 31, 2019

In order to make the OSS and X-Pack functional tests more consistent in style, these changes update the x-pack tests to use the new FtrProviderContext pattern.

FtrProviderContext is a unique type created for each unique services/pageObject combination used by different functional test configs/projects.

  • x-pack/test/api_integration/ftr_provider_context.d.ts
  • x-pack/test/functional/ftr_provider_context.d.ts
  • x-pack/test/kerberos_api_integration/ftr_provider_context.d.ts
  • etc.

It types the argument passed to test/services/pageObject providers by the functional test runner and is created with the type:

FtrProviderContext = GenericFtrProviderContext<ServiceProviderMap, PageObjectProviderMap>

ServiceProviderMap and PageObjectProviderMap are object types derived from the services and pageObjects configs, which map names to providers. These maps are used to determine the types for the getService() and the getPageObjects() functions.


The changes are pretty plentiful, but straightforward. Most locations were edited with pure find-replace, but a few places (like calls to testSubjects.existOrFail()) were invalid once the proper types were put in place.

@spalger spalger added Team:Operations Team label for Operations Team v8.0.0 v7.4.0 labels Jul 31, 2019
@spalger spalger requested review from kobelb and dmlemeshko July 31, 2019 22:55
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations

@spalger spalger added the release_note:skip Skip the PR/issue when compiling release notes label Jul 31, 2019

const omitTypename = (key: string, value: keyof TimelineResult) =>
key === '__typename' ? undefined : value;

const omitTypenameInTimeline = (timeline: TimelineResult) =>
JSON.parse(JSON.stringify(timeline), omitTypename);

const createBasicTimeline = async (client: ApolloClient<InMemoryCache>, titleToSaved: string) =>
const createBasicTimeline = async (client: ApolloClient<any>, titleToSaved: string) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not use ApolloCient<InMemoryCache> anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the function that makes it actually returns an ApolloClient<NormaliedCacheStore> or something like that, and I wasn't sure how to get that type, and this function doesn't actually cache what the store/cache type is.

@kobelb
Copy link
Contributor

kobelb commented Jul 31, 2019

This is so much cleaner!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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.

Awesome! Code LGTM

…ack-ftr-provider-context

# Conflicts:
#	x-pack/test/api_integration/apis/actions/delete.ts
#	x-pack/test/api_integration/apis/actions/find.ts
#	x-pack/test/api_integration/apis/actions/fire.ts
#	x-pack/test/api_integration/apis/actions/get.ts
#	x-pack/test/api_integration/apis/actions/update.ts
#	x-pack/test/api_integration/apis/alerting/alerts.ts
#	x-pack/test/api_integration/apis/alerting/update.ts
#	x-pack/test/api_integration/apis/infra/metadata.ts
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@spalger spalger merged commit d66b3c7 into elastic:master Aug 2, 2019
spalger pushed a commit to spalger/kibana that referenced this pull request Aug 2, 2019
jloleysens added a commit to jloleysens/kibana that referenced this pull request Aug 5, 2019
…-or-edit-existing-rollup-job

* 'master' of github.com:elastic/kibana: (67 commits)
  [TSVB] Shim new platform (elastic#39169)
  [Metric Vis] Shim new platform (elastic#42240)
  [Tag Cloud] Shim new platform (elastic#42348)
  Disable flaky request lib tests. Add es_ui_shared plugin to CODEOWNERS.
  Add disk space percentage to node listing (elastic#42145)
  [SIEM] Add chart interactions - update date picker after brush selection on charts (elastic#42440)
  Document HTTP service (elastic#42331)
  [Reporting] Sanitize 409 error log message (elastic#42495)
  [docs][skip ci] Maps read only access (elastic#35561)
  [x-pack/ftr] refactor types to be more accurate/consistent wit… (elastic#42407)
  [DOCS] Updates images and content in Dashboard docs (elastic#42500)
  Allow sorting on multiple columns in Discover (elastic#41918)
  [Infra UI][Logs UI] Fix autocomplete to use proper derived index pattern (elastic#42287)
  [ftr/cheerio] improve cheerio types to include test subject me… (elastic#42534)
  Upgraded EUI 13.0.0 -> 13.1.1 (elastic#42298)
  Increase max-old-space-size for builds (elastic#42218)
  [Infra UI] Add cloud metrics and cloud/host info to metadata endpoint (elastic#41836)
  [Logs UI][a11y] Announce name of column on remove column button (elastic#41695)
  Inspector 👉 New Platform (elastic#42164)
  Make alerting properly space aware (elastic#42081)
  ...
jloleysens added a commit to jloleysens/kibana that referenced this pull request Aug 5, 2019
…s_autocomplete

* 'master' of github.com:elastic/kibana: (189 commits)
  [TSVB] Shim new platform (elastic#39169)
  [Metric Vis] Shim new platform (elastic#42240)
  [Tag Cloud] Shim new platform (elastic#42348)
  Disable flaky request lib tests. Add es_ui_shared plugin to CODEOWNERS.
  Add disk space percentage to node listing (elastic#42145)
  [SIEM] Add chart interactions - update date picker after brush selection on charts (elastic#42440)
  Document HTTP service (elastic#42331)
  [Reporting] Sanitize 409 error log message (elastic#42495)
  [docs][skip ci] Maps read only access (elastic#35561)
  [x-pack/ftr] refactor types to be more accurate/consistent wit… (elastic#42407)
  [DOCS] Updates images and content in Dashboard docs (elastic#42500)
  Allow sorting on multiple columns in Discover (elastic#41918)
  [Infra UI][Logs UI] Fix autocomplete to use proper derived index pattern (elastic#42287)
  [ftr/cheerio] improve cheerio types to include test subject me… (elastic#42534)
  Upgraded EUI 13.0.0 -> 13.1.1 (elastic#42298)
  Increase max-old-space-size for builds (elastic#42218)
  [Infra UI] Add cloud metrics and cloud/host info to metadata endpoint (elastic#41836)
  [Logs UI][a11y] Announce name of column on remove column button (elastic#41695)
  Inspector 👉 New Platform (elastic#42164)
  Make alerting properly space aware (elastic#42081)
  ...
@spalger
Copy link
Contributor Author

spalger commented Aug 5, 2019

7.x/7.4: ffe8d77

@spalger spalger deleted the implement/x-pack-ftr-provider-context branch August 5, 2019 15:45
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:Operations Team label for Operations Team v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants