-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
NP licensing add functional tests #53002
NP licensing add functional tests #53002
Conversation
Pinging @elastic/kibana-platform (Team:Platform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to find a way to test a plugin + a combination of plugins in the integration tests
A test plugin per scenario that have the plugin it needs to test/interact with as dependencies would not work?
// MUST BE LAST! CHANGES LICENSE TYPE! | ||
loadTestFile(require.resolve('./updates')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈 Wonder what we could actually do without changing the whole test runner mechanism...
// this call enforces signature check to detect license update | ||
// and causes license re-fetch | ||
await window.np.setup.core.http.get('/'); | ||
await window.np.testUtils.delay(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: What is the upside of exposing that kind of static utils from the globally exposed np
instead of static import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean this?
import { delay } from '...';
await browser.executeAsync(async (cb: Function) => {
await window.np.setup.core.http.get('/');
await delay(100);
...
});
Selenium serializes a function passed into browser.executeAsync(fn)
to run it in a browser. Any closures will be lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea right. That's indeed an excellent answer.
It would work unless we need to change the elasticsearch state. In theory, we can call elasticsearch API from a plugin as well if we make the security model available in the browser as well. https://github.com/elastic/kibana/pull/53002/files#diff-286f825e99754fbdf390bfeedaff15f6R21 |
@pgayvallet updated |
await browser.execute(() => { | ||
const { setup } = ((window as unknown) as CoreProvider).__coreProvider; | ||
return setup.plugins.core_plugin_b.sayHi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel bad about this now that I know that vscode doesn't behave as IDEA regarding declare
statement. This is indeed less elegant that the previous solution. We should decide with the team if we want to 'allow' these declare
statements for extensions that are not necessarily accessible from everywhere in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will revert this change
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider
* fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider
* fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider
…f github.com:mbondyra/kibana into IS-51910_share-lens-change-index-pattern-in-discover * 'IS-51910_share-lens-change-index-pattern-in-discover' of github.com:mbondyra/kibana: [Discover] Remove angular field filter template code (elastic#53513) [APM] Improve table and other panel loading states (elastic#53459) Security/Spaces - cleanup react warnings (elastic#53287) Revert "NP licensing add functional tests (elastic#53002)" (elastic#53577) NP licensing add functional tests (elastic#53002) fix onLicenseInfoChange callback to be called on update (elastic#53559) Document how to extend request handler context (elastic#53271)
* NP licensing add functional tests (#53002) * fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider * remove potentially dangerous operation Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* NP licensing add functional tests (elastic#53002) * fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider * remove potentially dangerous operation Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* NP licensing add functional tests (#53002) * fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider * remove potentially dangerous operation Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* NP licensing add functional tests (elastic#53002) * fix comment * introduce core provider plugin for integration tests * platform functional tests use core_provider_plugin for testing * add 3 scenario for licensing plugins: server, client, legacy * remove unused code * run all licensing_plugin tests on CI * remove duplicated config * address comments * declare global type for core provider * remove potentially dangerous operation Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
This PR:
core_provider_plugin
, providing access to the platform API in the browser.core_provider_plugin
instead of extending a globalwindow
object.I used the LP plugin to have access to all plugin contracts. It will stop working when we drop LP support. We will need to find a way to test a plugin + a combination of plugins in the integration tests. Requires a separate issue
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers