-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Add e2e for the apm integration policy form #129860
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c3be0d4
Grant fleet privileges and capabilities to power user
kpatticha 5447af0
Add e2e for integration policy
kpatticha 1b77ca8
Fix selector for Tail-based
kpatticha 1e3f911
Merge branch 'main' of github.com:elastic/kibana into add-apm-integra…
kpatticha 52f4d25
Remove e2e releated to Fleet code
kpatticha 1a3fd6e
Decouple tests
kpatticha 1394538
Clean up assertion
kpatticha 1641228
Fix flaky test
kpatticha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
...pm/ftr_e2e/cypress/integration/power_user/integration_settings/integration_policy.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| const integrationsPoliciesPath = '/app/integrations/detail/apm/policies'; | ||
| const policyName = 'apm-integration'; | ||
| const description = 'integration description'; | ||
| const host = 'myhost:8200'; | ||
| const url = 'http://myhost:8200'; | ||
|
|
||
| const policyFormFields = [ | ||
| { | ||
| selector: 'packagePolicyNameInput', | ||
| value: 'apm-integration', | ||
| required: true, | ||
| }, | ||
| { | ||
| selector: 'packagePolicyDescriptionInput', | ||
| value: 'apm policy descrtiption', | ||
| required: false, | ||
| }, | ||
| { | ||
| selector: 'packagePolicyHostInput', | ||
| value: 'myhost:8200', | ||
| required: true, | ||
| }, | ||
| { | ||
| selector: 'packagePolicyUrlInput', | ||
| value: 'http://myhost:8200', | ||
| required: true, | ||
| }, | ||
| ]; | ||
|
|
||
| const apisToIntercept = [ | ||
| { | ||
| endpoint: 'api/fleet/agent_policies*', | ||
| name: 'fleetAgentPolicies', | ||
| method: 'POST', | ||
| }, | ||
| { | ||
| endpoint: 'api/fleet/agent_status*', | ||
| name: 'fleetAgentStatus', | ||
| method: 'GET', | ||
| }, | ||
| { | ||
| endpoint: 'api/fleet/package_policies', | ||
| name: 'fleetPackagePolicies', | ||
| method: 'POST', | ||
| }, | ||
| ]; | ||
|
|
||
| describe('when navigating to integration page', () => { | ||
| beforeEach(() => { | ||
| const integrationsPath = '/app/integrations/browse'; | ||
|
|
||
| cy.loginAsPowerUser(); | ||
| cy.visit(integrationsPath); | ||
|
|
||
| // open integration policy form | ||
| cy.get('[data-test-subj="integration-card:epr:apm:featured').click(); | ||
| cy.contains('Elastic APM in Fleet').click(); | ||
| cy.contains('a', 'APM integration').click(); | ||
| cy.get('[data-test-subj="addIntegrationPolicyButton"]').click(); | ||
| }); | ||
|
|
||
| it('checks validators for required fields', () => { | ||
| const requiredFields = policyFormFields.filter((field) => field.required); | ||
|
|
||
| requiredFields.map((field) => { | ||
| cy.get(`[data-test-subj="${field.selector}"`).clear(); | ||
| cy.get('[data-test-subj="createPackagePolicySaveButton"').should( | ||
| 'be.disabled' | ||
| ); | ||
| cy.get(`[data-test-subj="${field.selector}"`).type(field.value); | ||
| }); | ||
| }); | ||
|
|
||
| it('adds a new policy without agent', () => { | ||
| apisToIntercept.map(({ endpoint, method, name }) => { | ||
| cy.intercept(method, endpoint).as(name); | ||
| }); | ||
|
|
||
| cy.url().should('include', 'app/fleet/integrations/apm/add-integration'); | ||
| policyFormFields.map((field) => { | ||
| cy.get(`[data-test-subj="${field.selector}"`).clear().type(field.value); | ||
| }); | ||
| cy.contains('Save and continue').click(); | ||
| cy.wait('@fleetAgentPolicies'); | ||
| cy.wait('@fleetAgentStatus'); | ||
| cy.wait('@fleetPackagePolicies'); | ||
|
|
||
| cy.get('[data-test-subj="confirmModalCancelButton').click(); | ||
|
|
||
| cy.url().should('include', '/app/integrations/detail/apm/policies'); | ||
| cy.contains(policyName); | ||
| }); | ||
|
|
||
| it('updates an existing policy', () => { | ||
| apisToIntercept.map(({ endpoint, method, name }) => { | ||
| cy.intercept(method, endpoint).as(name); | ||
| }); | ||
|
|
||
| policyFormFields.map((field) => { | ||
| cy.get(`[data-test-subj="${field.selector}"`) | ||
| .clear() | ||
| .type(`${field.value}-new`); | ||
| }); | ||
|
|
||
| cy.contains('Save and continue').click(); | ||
| cy.wait('@fleetAgentPolicies'); | ||
| cy.wait('@fleetAgentStatus'); | ||
| cy.wait('@fleetPackagePolicies'); | ||
|
|
||
| cy.get('[data-test-subj="confirmModalCancelButton').click(); | ||
| cy.contains(`${policyName}-new`).click(); | ||
|
|
||
| policyFormFields.map((field) => { | ||
| cy.get(`[data-test-subj="${field.selector}"`) | ||
| .clear() | ||
| .type(`${field.value}-updated`); | ||
| }); | ||
| cy.contains('Save integration').click(); | ||
| cy.contains(`${policyName}-updated`); | ||
| }); | ||
|
|
||
| it('should display Tail-based section on latest version', () => { | ||
| cy.visit('/app/fleet/integrations/apm/add-integration'); | ||
| cy.contains('Tail-based sampling').should('exist'); | ||
| }); | ||
|
|
||
| it('should hide Tail-based section for 8.0.0 apm package', () => { | ||
| cy.visit('/app/fleet/integrations/apm-8.0.0/add-integration'); | ||
| cy.contains('Tail-based sampling').should('not.exist'); | ||
| }); | ||
| }); |
44 changes: 0 additions & 44 deletions
44
...r_e2e/cypress/integration/read_only_user/integration_settings/apm_server_not_installed.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.