Skip to content

Commit

Permalink
More migrations to kbnArchiver
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <[email protected]>
  • Loading branch information
Tyler Smalley committed May 28, 2021
1 parent 0343655 commit ffe3928
Show file tree
Hide file tree
Showing 60 changed files with 3,165 additions and 1,880 deletions.
3 changes: 3 additions & 0 deletions test/examples/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default async function ({ readConfigFile }) {
esArchiver: {
directory: path.resolve(__dirname, '../es_archives'),
},
kbnArchiver: {
directory: path.resolve(__dirname, '../functional/fixtures/kbn_archiver'),
},
screenshots: functionalConfig.get('screenshots'),
junit: {
reportName: 'Example plugin functional tests',
Expand Down
5 changes: 4 additions & 1 deletion test/examples/embeddables/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const testDashboardInput = {
// eslint-disable-next-line import/no-default-export
export default function ({ getService, getPageObjects }: PluginFunctionalProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const pieChart = getService('pieChart');
const browser = getService('browser');
Expand All @@ -102,12 +103,14 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
describe('dashboard container', () => {
before(async () => {
await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/dashboard/current/data');
await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await PageObjects.common.navigateToApp('dashboardEmbeddableExamples');
await testSubjects.click('dashboardEmbeddableByValue');
await updateInput(JSON.stringify(testDashboardInput, null, 4));
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('pie charts', async () => {
await pieChart.expectPieSliceCount(5);
});
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/dashboard/copy_panel_to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dashboardPanelActions = getService('dashboardPanelActions');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const find = getService('find');

const PageObjects = getPageObjects([
Expand All @@ -40,7 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('dashboard panel copy to', function viewEditModeTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -61,6 +60,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async function () {
await PageObjects.dashboard.gotoDashboardLandingPage();
await kibanaServer.importExport.unload('dashboard/current/kibana');
});

it('does not show the new dashboard option when on a new dashboard', async () => {
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/create_and_add_embeddables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']);
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('create and add embeddables', () => {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -31,6 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.loadSavedDashboard('few panels');
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

describe('add new visualization link', () => {
it('adds new visualization via the top nav link', async () => {
const originalPanelCount = await PageObjects.dashboard.getPanelCount();
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_back_button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['dashboard', 'header', 'common', 'visualize', 'timePicker']);
const browser = getService('browser');

describe('dashboard back button', () => {
before(async () => {
await esArchiver.loadIfNeeded('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('after navigation from listing page to dashboard back button works', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.loadSavedDashboard('dashboard with everything');
Expand Down
10 changes: 8 additions & 2 deletions test/functional/apps/dashboard/dashboard_error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['dashboard', 'header', 'common']);
const browser = getService('browser');
const testSubjects = getService('testSubjects');
Expand All @@ -19,10 +19,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
*/
describe('dashboard error handling', () => {
before(async () => {
await esArchiver.loadIfNeeded('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await PageObjects.common.navigateToApp('dashboard');
await kibanaServer.savedObjects.delete({
type: 'index-pattern',
id: 'to-be-removed',
});
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

// wrapping into own describe to make sure new tab is cleaned up even if test failed
// see: https://github.com/elastic/kibana/pull/67280#discussion_r430528122
describe('recreate index pattern link works', () => {
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/dashboard/dashboard_filter_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const filterBar = getService('filterBar');
const pieChart = getService('pieChart');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
const PageObjects = getPageObjects([
Expand All @@ -31,13 +30,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('dashboard filter bar', () => {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await PageObjects.common.navigateToApp('dashboard');
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

describe('Add a filter bar', function () {
before(async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
Expand Down Expand Up @@ -200,6 +201,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('bad filters are loaded properly', function () {
before(async () => {
await kibanaServer.savedObjects.delete({
type: 'index-pattern',
id: 'to-be-removed',
});
await filterBar.ensureFieldEditorModalIsClosed();
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.loadSavedDashboard('dashboard with bad filters');
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/dashboard/dashboard_filtering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const renderable = getService('renderable');
const testSubjects = getService('testSubjects');
const filterBar = getService('filterBar');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const security = getService('security');
const dashboardPanelActions = getService('dashboardPanelActions');
Expand Down Expand Up @@ -54,7 +53,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader', 'animals']);
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
Expand All @@ -66,6 +65,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async () => {
await security.testUser.restoreDefaults();
await kibanaServer.importExport.unload('dashboard/current/kibana');
});

describe('adding a filter that excludes all data', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['common', 'dashboard']);

describe('dashboard grid', function () {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -29,6 +28,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.switchToEditMode();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

describe('move panel', () => {
// Specific test after https://github.com/elastic/kibana/issues/14764 fix
it('Can move panel from bottom to top row', async () => {
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'dashboard']);

describe('dashboard data-shared attributes', () => {
let originalTitles: string[] = [];

before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -31,6 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
originalTitles = await PageObjects.dashboard.getPanelTitles();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('should be able to hide all panel titles', async () => {
await PageObjects.dashboard.checkHideTitle();
await retry.try(async () => {
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/dashboard/dashboard_query_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('dashboard query bar', () => {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -29,6 +29,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.loadSavedDashboard('dashboard with filter');
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('causes panels to reload when refresh is clicked', async () => {
await esArchiver.unload('dashboard/current/data');

Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_saved_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']);
const browser = getService('browser');
Expand All @@ -21,13 +20,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('dashboard saved queries', function describeIndexTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await PageObjects.common.navigateToApp('dashboard');
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

describe('saved query management component functionality', function () {
before(async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/dashboard/dashboard_snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ export default function ({
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common', 'timePicker']);
const screenshot = getService('screenshots');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('dashboard snapshots', function describeIndexTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -38,6 +37,7 @@ export default function ({

after(async function () {
await browser.setWindowSize(1300, 900);
await kibanaServer.importExport.unload('dashboard/current/kibana');
});

it('compare TSVB snapshot', async () => {
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_unsaved_listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');
const dashboardPanelActions = getService('dashboardPanelActions');
Expand All @@ -36,14 +35,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('lists unsaved changes to existing dashboards', async () => {
await PageObjects.dashboard.loadSavedDashboard(dashboardTitle);
await PageObjects.dashboard.switchToEditMode();
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_unsaved_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']);
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');
Expand All @@ -23,7 +22,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// FLAKY: https://github.com/elastic/kibana/issues/91191
describe.skip('dashboard unsaved panels', () => {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -34,6 +33,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
originalPanelCount = await PageObjects.dashboard.getPanelCount();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('does not show unsaved changes badge when there are no unsaved changes', async () => {
await testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
});
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/data_shared_attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']);
Expand All @@ -21,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
let originalPanelTitles: string[];

before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.importExport.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand All @@ -31,6 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.waitForRenderComplete();
});

after(() => kibanaServer.importExport.unload('dashboard/current/kibana'));

it('should have time picker with data-shared-timefilter-duration', async () => {
await retry.try(async () => {
const sharedData = await PageObjects.timePicker.getTimeDurationForSharing();
Expand Down
Loading

0 comments on commit ffe3928

Please sign in to comment.