-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Add e2e tests for feature flags (#125201)
* [APM] Add e2e tests for feature flags * Do not abstracth apm base url
- Loading branch information
Showing
2 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.ts
This file contains 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,95 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { synthtrace } from '../../../../synthtrace'; | ||
import { opbeans } from '../../../fixtures/synthtrace/opbeans'; | ||
|
||
const settingsPath = '/app/management/kibana/settings'; | ||
|
||
const start = '2021-10-10T00:00:00.000Z'; | ||
const end = '2021-10-10T00:15:00.000Z'; | ||
describe('Comparison feature flag', () => { | ||
const comparisonToggle = | ||
'[data-test-subj="advancedSetting-editField-observability:enableComparisonByDefault"]'; | ||
|
||
before(async () => { | ||
await synthtrace.index( | ||
opbeans({ | ||
from: new Date(start).getTime(), | ||
to: new Date(end).getTime(), | ||
}) | ||
); | ||
}); | ||
|
||
after(async () => { | ||
await synthtrace.clean(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAsPowerUser(); | ||
}); | ||
|
||
describe('when comparison feature is enabled', () => { | ||
it('shows the flag as enabled in kibana advanced settings', () => { | ||
cy.visit(settingsPath); | ||
|
||
cy.get(comparisonToggle) | ||
.should('have.attr', 'aria-checked') | ||
.and('equal', 'true'); | ||
}); | ||
|
||
it('shows the comparison feature enabled in services overview', () => { | ||
cy.visit('/app/apm/services'); | ||
cy.get('input[type="checkbox"]#comparison').should('be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('not.be.disabled'); | ||
}); | ||
|
||
it('shows the comparison feature enabled in services overview', () => { | ||
cy.visit('/app/apm/backends'); | ||
cy.get('input[type="checkbox"]#comparison').should('be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('not.be.disabled'); | ||
}); | ||
|
||
it('shows the comparison feature disabled in service map overview page', () => { | ||
cy.visit('/app/apm/service-map'); | ||
cy.get('input[type="checkbox"]#comparison').should('be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('when comparison feature is disabled', () => { | ||
it('shows the flag as disabled in kibana advanced settings', () => { | ||
cy.visit(settingsPath); | ||
cy.get(comparisonToggle).click(); | ||
cy.contains('Save changes').should('not.be.disabled'); | ||
cy.contains('Save changes').click(); | ||
cy.get(comparisonToggle).should('not.be.checked'); | ||
|
||
cy.get(comparisonToggle) | ||
.should('have.attr', 'aria-checked') | ||
.and('equal', 'false'); | ||
}); | ||
|
||
it('shows the comparison feature disabled in services overview', () => { | ||
cy.visit('/app/apm/services'); | ||
cy.get('input[type="checkbox"]#comparison').should('not.be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled'); | ||
}); | ||
|
||
it('shows the comparison feature disabled in dependencies overview page', () => { | ||
cy.visit('/app/apm/backends'); | ||
cy.get('input[type="checkbox"]#comparison').should('not.be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled'); | ||
}); | ||
|
||
it('shows the comparison feature disabled in service map overview page', () => { | ||
cy.visit('/app/apm/service-map'); | ||
cy.get('input[type="checkbox"]#comparison').should('not.be.checked'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled'); | ||
}); | ||
}); | ||
}); |
70 changes: 70 additions & 0 deletions
70
x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/infrastructure.ts
This file contains 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,70 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { synthtrace } from '../../../../synthtrace'; | ||
import { opbeans } from '../../../fixtures/synthtrace/opbeans'; | ||
|
||
const settingsPath = '/app/management/kibana/settings'; | ||
const serviceOverviewPath = '/app/apm/services/opbeans-python/overview'; | ||
|
||
const start = '2021-10-10T00:00:00.000Z'; | ||
const end = '2021-10-10T00:15:00.000Z'; | ||
|
||
describe('Infrastracture feature flag', () => { | ||
const infraToggle = | ||
'[data-test-subj="advancedSetting-editField-observability:enableInfrastructureView"]'; | ||
|
||
before(async () => { | ||
await synthtrace.index( | ||
opbeans({ | ||
from: new Date(start).getTime(), | ||
to: new Date(end).getTime(), | ||
}) | ||
); | ||
}); | ||
|
||
after(async () => { | ||
await synthtrace.clean(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAsPowerUser(); | ||
}); | ||
|
||
describe('when infrastracture feature is enabled', () => { | ||
it('shows the flag as enabled in kibana advanced settings', () => { | ||
cy.visit(settingsPath); | ||
|
||
cy.get(infraToggle) | ||
.should('have.attr', 'aria-checked') | ||
.and('equal', 'true'); | ||
}); | ||
|
||
it('shows infrastructure tab in service overview page', () => { | ||
cy.visit(serviceOverviewPath); | ||
cy.contains('a[role="tab"]', 'Infrastructure').click(); | ||
}); | ||
}); | ||
|
||
describe('when infrastracture feature is disabled', () => { | ||
it('shows the flag as disabled in kibana advanced settings', () => { | ||
cy.visit(settingsPath); | ||
cy.get(infraToggle).click(); | ||
cy.contains('Save changes').should('not.be.disabled'); | ||
cy.contains('Save changes').click(); | ||
|
||
cy.get(infraToggle) | ||
.should('have.attr', 'aria-checked') | ||
.and('equal', 'false'); | ||
}); | ||
|
||
it('hides infrastructure tab in service overview page', () => { | ||
cy.visit(serviceOverviewPath); | ||
cy.contains('a[role="tab"]', 'Infrastructure').should('not.exist'); | ||
}); | ||
}); | ||
}); |