Removes Percy based visual regression tests (#139252)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
This commit is contained in:
Tyler Smalley 2022-09-12 13:08:52 -07:00 committed by GitHub
parent a0df48362b
commit 44ab700f3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 190 additions and 1436 deletions

View file

@ -45,8 +45,6 @@ disabled:
- x-pack/plugins/observability/e2e/synthetics_run.ts
# Configs that exist but weren't running in CI when this file was introduced
- test/visual_regression/config.ts
- x-pack/test/visual_regression/config.ts
- x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/config.ts
- x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/config.ts
- x-pack/test/alerting_api_integration/spaces_only_legacy/config.ts

View file

@ -593,7 +593,6 @@ module.exports = {
'test/*/config_open.ts',
'test/*/*.config.ts',
'test/*/{tests,test_suites,apis,apps}/**/*',
'test/visual_regression/tests/**/*',
'x-pack/test/*/{tests,test_suites,apis,apps}/**/*',
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',

1
.github/CODEOWNERS vendored
View file

@ -221,7 +221,6 @@ x-pack/examples/files_example @elastic/kibana-app-services
/x-pack/test/api_integration/apis/maps/ @elastic/kibana-gis
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_containment @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis

View file

@ -722,7 +722,6 @@
"@mapbox/vector-tile": "1.3.1",
"@octokit/rest": "^16.35.0",
"@openpgp/web-stream-tools": "^0.0.10",
"@percy/agent": "^0.28.6",
"@storybook/addon-a11y": "^6.4.22",
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-controls": "^6.4.22",

View file

@ -1,30 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js'));
return {
...functionalConfig.getAll(),
testFiles: [
require.resolve('./tests/console_app'),
require.resolve('./tests/discover'),
require.resolve('./tests/vega'),
],
services,
junit: {
reportName: 'Kibana Visual Regression Tests',
},
};
}

View file

@ -1,15 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test';
import { pageObjects } from '../functional/page_objects';
import { services } from './services';
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
export class FtrService extends GenericFtrService<FtrProviderContext> {}

View file

@ -1,15 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { services as functionalServices } from '../../functional/services';
import { VisualTestingService } from './visual_testing';
export const services = {
...functionalServices,
visualTesting: VisualTestingService,
};

View file

@ -1,9 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export * from './visual_testing';

View file

@ -1,102 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { readFileSync } from 'fs';
import { agentJsFilename } from '@percy/agent/dist/utils/sdk-utils';
export function takePercySnapshot(show, hide) {
if (!window.PercyAgent) {
return false;
}
// add percy styles to hide/show specific elements
const styleElement = document.createElement('style');
styleElement.appendChild(
document.createTextNode(`
.hideInPercy {
visibility: hidden;
.showInPercy {
visibility: visible;
}
}
.showInPercy {
visibility: visible;
.hideInPercy {
visibility: hidden;
}
}
`)
);
document.head.appendChild(styleElement);
const add = (selectors, className) => {
for (const selector of selectors) {
for (const element of document.querySelectorAll(selector)) {
element.classList.add(className);
}
}
};
const remove = (selectors, className) => {
for (const selector of selectors) {
for (const element of document.querySelectorAll(selector)) {
element.classList.remove(className);
}
}
};
// set Percy visibility on elements
add(hide, 'hideInPercy');
if (show.length > 0) {
// hide the body by default
add(['body'], 'hideInPercy');
add(show, 'showInPercy');
}
// convert canvas elements into static images
const replacements = [];
for (const canvas of document.querySelectorAll('canvas')) {
const image = document.createElement('img');
image.classList.value = canvas.classList.value;
image.src = canvas.toDataURL();
image.style.cssText = window.getComputedStyle(canvas).cssText;
canvas.parentElement.replaceChild(image, canvas);
replacements.push({ canvas, image });
}
try {
const agent = new window.PercyAgent({
handleAgentCommunication: false,
});
// cache the dom snapshot containing the images
return agent.snapshot(document, {
widths: [document.documentElement.clientWidth],
});
} finally {
// restore replaced canvases
for (const { image, canvas } of replacements) {
image.parentElement.replaceChild(canvas, image);
}
// restore element visibility
document.head.removeChild(styleElement);
remove(['body'], 'hideInPercy');
remove(show, 'showInPercy');
remove(hide, 'hideInPercy');
}
}
export const takePercySnapshotWithAgent = `
${readFileSync(agentJsFilename(), 'utf8')}
return (${takePercySnapshot.toString()}).apply(null, arguments);
`;

View file

@ -1,114 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { postSnapshot } from '@percy/agent/dist/utils/sdk-utils';
import testSubjSelector from '@kbn/test-subj-selector';
import { Test } from '@kbn/test';
import { kibanaPackageJson as pkg } from '@kbn/utils';
import { FtrService, FtrProviderContext } from '../../ftr_provider_context';
// @ts-ignore internal js that is passed to the browser as is
import { takePercySnapshot, takePercySnapshotWithAgent } from './take_percy_snapshot';
export const DEFAULT_OPTIONS = {
widths: [1200],
};
export interface SnapshotOptions {
/**
* name to append to visual test name
*/
name?: string;
/**
* test subject selectiors to __show__ in screenshot
*/
show?: string[];
/**
* test subject selectiors to __hide__ in screenshot
*/
hide?: string[];
}
const statsCache = new WeakMap<Test, { snapshotCount: number }>();
function getStats(test: Test) {
if (!statsCache.has(test)) {
statsCache.set(test, {
snapshotCount: 0,
});
}
return statsCache.get(test)!;
}
export class VisualTestingService extends FtrService {
private readonly browser = this.ctx.getService('browser');
private readonly log = this.ctx.getService('log');
private currentTest: Test | undefined;
constructor(ctx: FtrProviderContext) {
super(ctx);
this.ctx.getService('lifecycle').beforeEachTest.add((test) => {
this.currentTest = test;
});
}
public async snapshot(options: SnapshotOptions = {}) {
if (process.env.DISABLE_VISUAL_TESTING) {
this.log.warning(
'Capturing of percy snapshots disabled, would normally capture a snapshot here!'
);
return;
}
this.log.debug('Capturing percy snapshot');
if (!this.currentTest) {
throw new Error('unable to determine current test');
}
const [domSnapshot, url] = await Promise.all([
this.getSnapshot(options.show, options.hide),
this.browser.getCurrentUrl(),
]);
const stats = getStats(this.currentTest);
stats.snapshotCount += 1;
const { name } = options;
const success = await postSnapshot({
name: `${this.currentTest.fullTitle()} [${name ? name : stats.snapshotCount}]`,
url,
domSnapshot,
clientInfo: `kibana-ftr:${pkg.version}`,
...DEFAULT_OPTIONS,
});
if (!success) {
throw new Error('Percy snapshot failed');
}
}
private async getSnapshot(show: string[] = [], hide: string[] = []) {
const showSelectors = show.map(testSubjSelector);
const hideSelectors = hide.map(testSubjSelector);
const snapshot = await this.browser.execute<[string[], string[]], string | false>(
takePercySnapshot,
showSelectors,
hideSelectors
);
return snapshot !== false
? snapshot
: await this.browser.execute<[string[], string[]], string>(
takePercySnapshotWithAgent,
showSelectors,
hideSelectors
);
}
}

View file

@ -1,71 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';
const DEFAULT_REQUEST = `
GET _search
{
"query": {
"match_all": {}
}
}
`.trim();
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const log = getService('log');
const visualTesting = getService('visualTesting');
const PageObjects = getPageObjects(['common', 'console']);
describe.skip('console app', function describeIndexTests() {
before(async () => {
log.debug('navigateTo console');
await PageObjects.common.navigateToApp('console');
});
it('should show the default request', async () => {
// collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled
await PageObjects.console.collapseHelp();
await retry.try(async () => {
const actualRequest = await PageObjects.console.getRequest();
log.debug(actualRequest);
expect(actualRequest.trim()).to.eql(DEFAULT_REQUEST);
});
await visualTesting.snapshot();
});
it('default request response should include `"timed_out" : false`', async () => {
const expectedResponseContains = '"timed_out" : false,';
await PageObjects.console.clickPlay();
await retry.try(async () => {
const actualResponse = await PageObjects.console.getResponse();
log.debug(actualResponse);
expect(actualResponse).to.contain(expectedResponseContains);
});
});
it('settings should allow changing the text size', async () => {
await PageObjects.console.setFontSizeSetting(20);
await retry.try(async () => {
// the settings are not applied synchronously, so we retry for a time
expect(await PageObjects.console.getRequestFontSize()).to.be('20px');
});
await PageObjects.console.setFontSizeSetting(24);
await retry.try(async () => {
// the settings are not applied synchronously, so we retry for a time
expect(await PageObjects.console.getRequestFontSize()).to.be('24px');
});
});
});
}

View file

@ -1,117 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
const visualTesting = getService('visualTesting');
const defaultSettings = {
defaultIndex: 'logstash-*',
'discover:sampleSize': 1,
};
describe('discover', function describeIndexTests() {
before(async function () {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/discover/visual_regression'
);
// and load a set of makelogs data
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
});
after(async function unloadMakelogs() {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.savedObjects.cleanStandardList();
});
async function refreshDiscover() {
await browser.refresh();
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.waitForChartLoadingComplete(1);
}
async function takeSnapshot() {
await refreshDiscover();
await visualTesting.snapshot({
show: ['discoverChart'],
});
}
describe('query', function () {
this.tags(['skipFirefox']);
it('should show bars in the correct time zone', async function () {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await takeSnapshot();
});
it('should show correct data for chart interval Hour', async function () {
await PageObjects.discover.setChartInterval('Hour');
await takeSnapshot();
});
it('should show correct data for chart interval Day', async function () {
await PageObjects.discover.setChartInterval('Day');
await takeSnapshot();
});
it('should show correct data for chart interval Week', async function () {
await PageObjects.discover.setChartInterval('Week');
await takeSnapshot();
});
it('browser back button should show previous interval Day', async function () {
await browser.goBack();
await retry.try(async function tryingForTime() {
const actualInterval = await PageObjects.discover.getChartInterval();
expect(actualInterval).to.be('Day');
});
await takeSnapshot();
});
it('should show correct data for chart interval Month', async function () {
await PageObjects.discover.setChartInterval('Month');
await takeSnapshot();
});
it('should show correct data for chart interval Year', async function () {
await PageObjects.discover.setChartInterval('Year');
await takeSnapshot();
});
it('should show correct data for chart interval Auto', async function () {
await PageObjects.discover.setChartInterval('Auto');
await takeSnapshot();
});
});
describe('time zone switch', () => {
it('should show bars in the correct time zone after switching', async function () {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'America/Phoenix' });
await refreshDiscover();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await takeSnapshot();
});
});
});
}

View file

@ -1,25 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { DEFAULT_OPTIONS } from '../../services/visual_testing/visual_testing';
import { FtrProviderContext } from '../../ftr_provider_context';
// Width must be the same as visual_testing or canvas image widths will get skewed
const [SCREEN_WIDTH] = DEFAULT_OPTIONS.widths || [];
export default function ({ getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
describe('discover app', function () {
before(function () {
return browser.setWindowSize(SCREEN_WIDTH, 1000);
});
loadTestFile(require.resolve('./chart_visualization'));
});
}

View file

@ -1,25 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { DEFAULT_OPTIONS } from '../../services/visual_testing/visual_testing';
import { FtrProviderContext } from '../../ftr_provider_context';
// Width must be the same as visual_testing or canvas image widths will get skewed
const [SCREEN_WIDTH] = DEFAULT_OPTIONS.widths || [];
export default function ({ getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
describe('vega app', function () {
before(function () {
return browser.setWindowSize(SCREEN_WIDTH, 1000);
});
loadTestFile(require.resolve('./vega_map_visualization'));
});
}

View file

@ -1,39 +0,0 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'visualize', 'visChart', 'visEditor', 'vegaChart']);
const visualTesting = getService('visualTesting');
describe('vega chart in visualize app', () => {
before(async () => {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/kibana_sample_data_flights'
);
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/visualize.json');
});
after(async () => {
await esArchiver.unload('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
await kibanaServer.importExport.unload(
'test/functional/fixtures/kbn_archiver/visualize.json'
);
});
it('should show map with vega layer', async function () {
await PageObjects.visualize.gotoVisualizationLandingPage();
await PageObjects.visualize.openSavedVisualization('VegaMap');
await PageObjects.visChart.waitForVisualizationRenderingStabilized();
await visualTesting.snapshot();
});
});
}

View file

@ -1,31 +0,0 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js'));
return {
...functionalConfig.getAll(),
testFiles: [
require.resolve('./tests/canvas'),
require.resolve('./tests/login_page'),
require.resolve('./tests/maps'),
require.resolve('./tests/infra'),
],
services,
junit: {
reportName: 'X-Pack Visual Regression Tests',
},
};
}

View file

@ -1,13 +0,0 @@
/*
* 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 { GenericFtrProviderContext } from '@kbn/test';
import { pageObjects } from './page_objects';
import { services } from './services';
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;

View file

@ -1,10 +0,0 @@
/*
* 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 { pageObjects } from '../functional/page_objects';
export { pageObjects };

View file

@ -1,14 +0,0 @@
/*
* 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 { services as ossVisualRegressionServices } from '../../../test/visual_regression/services';
import { services as functionalServices } from '../functional/services';
export const services = {
...functionalServices,
visualTesting: ossVisualRegressionServices.visualTesting,
};

View file

@ -1,25 +0,0 @@
/*
* 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.
*/
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['common', 'canvas']);
const visualTesting = getService('visualTesting');
describe('fullscreen', () => {
it('workpad should display properly in fullscreen mode', async () => {
await PageObjects.common.navigateToApp('canvas', {
hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1',
});
await PageObjects.canvas.enterFullscreen();
await PageObjects.canvas.waitForWorkpadElements();
await visualTesting.snapshot();
});
});
}

View file

@ -1,30 +0,0 @@
/*
* 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 { DEFAULT_OPTIONS } from '../../../../../test/visual_regression/services/visual_testing/visual_testing';
const [SCREEN_WIDTH] = DEFAULT_OPTIONS.widths || [];
export default function ({ loadTestFile, getService }) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');
describe('canvas app visual regression', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.load('x-pack/test/functional/es_archives/canvas/default');
await browser.setWindowSize(SCREEN_WIDTH, 1000);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/canvas/default');
});
loadTestFile(require.resolve('./fullscreen'));
});
}

View file

@ -1,19 +0,0 @@
/*
* 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.
*/
export default function ({ loadTestFile, getService }) {
const browser = getService('browser');
describe.skip('InfraUI Visual Regression', function () {
before(async () => {
await browser.setWindowSize(1600, 1000);
});
loadTestFile(require.resolve('./waffle_map'));
loadTestFile(require.resolve('./saved_views'));
});
}

View file

@ -1,87 +0,0 @@
/*
* 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 { DATES } from '../../../functional/apps/infra/constants';
const DATE_WITH_DATA = DATES.metricsAndLogs.hosts.withData;
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['common', 'infraHome', 'infraMetricsExplorer']);
const visualTesting = getService('visualTesting');
const esArchiver = getService('esArchiver');
describe('saved views', () => {
before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
describe('Inverntory Test save functionality', () => {
it('should have save and load controls', async () => {
await PageObjects.common.navigateToApp('infraOps');
await PageObjects.infraHome.goToTime(DATE_WITH_DATA);
await PageObjects.infraHome.getSaveViewButton();
await PageObjects.infraHome.getLoadViewsButton();
await visualTesting.snapshot();
});
it('should open flyout list', async () => {
await PageObjects.infraHome.openSaveViewsFlyout();
await visualTesting.snapshot();
await PageObjects.infraHome.closeSavedViewFlyout();
});
it('should open saved view modal', async () => {
await PageObjects.infraHome.openCreateSaveViewModal();
await visualTesting.snapshot();
});
it('should be able to enter a view name', async () => {
await PageObjects.infraHome.openEnterViewNameAndSave();
await visualTesting.snapshot();
});
it('should see a saved view in list', async () => {
await PageObjects.infraHome.openSaveViewsFlyout();
await visualTesting.snapshot();
});
});
describe('Metric Explorer Test Saved Views', () => {
before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
describe('save functionality', () => {
it('should have saved views component', async () => {
await PageObjects.common.navigateToApp('infraOps');
await PageObjects.infraHome.goToMetricExplorer();
await PageObjects.infraSavedViews.getSavedViewsButton();
await PageObjects.infraSavedViews.ensureViewIsLoaded('Default view');
await visualTesting.snapshot();
});
it('should open popover', async () => {
await PageObjects.infraSavedViews.clickSavedViewsButton();
await visualTesting.snapshot();
await PageObjects.infraSavedViews.closeSavedViewsPopover();
});
it('should create new saved view and load it', async () => {
await PageObjects.infraSavedViews.clickSavedViewsButton();
await PageObjects.infraSavedViews.clickSaveNewViewButton();
await PageObjects.infraSavedViews.getCreateSavedViewModal();
await PageObjects.infraSavedViews.createNewSavedView('view1');
await PageObjects.infraSavedViews.ensureViewIsLoaded('view1');
await visualTesting.snapshot();
});
it('should new views should be listed in the load views list', async () => {
await PageObjects.infraSavedViews.clickSavedViewsButton();
await PageObjects.infraSavedViews.clickLoadViewButton();
await PageObjects.infraSavedViews.ensureViewIsLoadable('view1');
await visualTesting.snapshot();
await PageObjects.infraSavedViews.closeSavedViewsLoadModal();
});
});
});
});
}

View file

@ -1,27 +0,0 @@
/*
* 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 { DATES } from '../../../functional/apps/infra/constants';
const DATE_WITH_DATA = DATES.metricsAndLogs.hosts.withData;
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['common', 'infraHome']);
const visualTesting = getService('visualTesting');
const esArchiver = getService('esArchiver');
describe('waffle map', () => {
before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
it('should just work', async () => {
await PageObjects.common.navigateToApp('infraOps');
await PageObjects.infraHome.goToTime(DATE_WITH_DATA);
await PageObjects.infraHome.getWaffleMap();
await visualTesting.snapshot();
});
});
}

View file

@ -1,58 +0,0 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const visualTesting = getService('visualTesting');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'security']);
describe.skip('Security', () => {
describe('Login Page', () => {
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await PageObjects.security.forceLogout();
});
after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});
afterEach(async () => {
// NOTE: Logout needs to happen before anything else to avoid flaky behavior
await PageObjects.security.forceLogout();
});
it('renders login page', async () => {
await PageObjects.common.navigateToApp('login');
await retry.waitFor(
'login page visible',
async () => await testSubjects.exists('loginSubmit')
);
await visualTesting.snapshot();
});
it('renders failed login', async () => {
await PageObjects.security.loginPage.login('wrong-user', 'wrong-password', {
expectSuccess: false,
});
await retry.waitFor(
'login error visible',
async () => await testSubjects.exists('loginErrorMessage')
);
await visualTesting.snapshot();
});
});
});
}

View file

@ -1,61 +0,0 @@
/*
* 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.
*/
export default function ({ loadTestFile, getService }) {
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const log = getService('log');
const supertest = getService('supertest');
describe('maps app visual regression', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/maps.json'
);
// Functional tests verify behavior when referenced index pattern saved objects can not be found.
// However, saved object import fails when reference saved objects can not be found.
// To prevent import errors, index pattern saved object references exist during import
// but are then deleted afterwards to enable testing of missing reference index pattern saved objects.
log.info('Delete index pattern');
log.debug('id: ' + 'idThatDoesNotExitForESGeoGridSource');
log.debug('id: ' + 'idThatDoesNotExitForESSearchSource');
log.debug('id: ' + 'idThatDoesNotExitForESJoinSource');
await supertest
.delete('/api/index_patterns/index_pattern/' + 'idThatDoesNotExitForESGeoGridSource')
.set('kbn-xsrf', 'true')
.expect(200);
await supertest
.delete('/api/index_patterns/index_pattern/' + 'idThatDoesNotExitForESSearchSource')
.set('kbn-xsrf', 'true')
.expect(200);
await supertest
.delete('/api/index_patterns/index_pattern/' + 'idThatDoesNotExitForESJoinSource')
.set('kbn-xsrf', 'true')
.expect(200);
await esArchiver.load('x-pack/test/functional/es_archives/maps/data');
await kibanaServer.uiSettings.replace({
defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a',
});
await browser.setWindowSize(1600, 1000);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/maps/data');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/maps.json'
);
});
loadTestFile(require.resolve('./vector_styling'));
});
}

View file

@ -1,49 +0,0 @@
/*
* 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.
*/
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
const visualTesting = getService('visualTesting');
describe('vector styling', () => {
describe('symbolize as icon', () => {
before(async () => {
await PageObjects.maps.loadSavedMap('vector styling icon demo');
await PageObjects.maps.enterFullScreen();
await PageObjects.maps.closeLegend();
});
it('should symbolize points as icons with expected color, size, and orientation', async () => {
await visualTesting.snapshot();
});
});
describe('dynamic coloring', () => {
before(async () => {
await PageObjects.maps.loadSavedMap('join and dynamic coloring demo');
await PageObjects.maps.enterFullScreen();
await PageObjects.maps.closeLegend();
});
it('should symbolize fill color with custom steps from join value and border color with dynamic color ramp from prop value', async () => {
await visualTesting.snapshot();
});
});
describe('dynamic line coloring', () => {
before(async () => {
await PageObjects.maps.loadSavedMap('pew pew demo');
await PageObjects.maps.enterFullScreen();
await PageObjects.maps.closeLegend();
});
it('should symbolize pew pew lines', async () => {
await visualTesting.snapshot();
});
});
});
}

635
yarn.lock

File diff suppressed because it is too large Load diff