Skip to content

Commit

Permalink
updating with const variable for the file path
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyarm committed Jun 22, 2021
1 parent 7ee3573 commit ed2abb5
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const find = getService('find');
const retry = getService('retry');
const PageObjects = getPageObjects(['reporting', 'common', 'dashboard', 'timePicker']);
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

const getCsvPath = (name: string) =>
path.resolve(REPO_ROOT, `target/functional-tests/downloads/${name}.csv`);
Expand Down Expand Up @@ -68,15 +69,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('E-Commerce Data', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
});

it('Download CSV export of a saved search panel', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const es = getService('es');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

// https://github.com/elastic/kibana/issues/102911
describe.skip('Dashboard Reporting Screenshots', () => {
before('initialize tests', async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
await browser.setWindowSize(1600, 850);

await security.role.create('test_reporting_user', {
Expand Down Expand Up @@ -62,9 +61,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});
after('clean up archives', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await es.deleteByQuery({
index: '.reporting-*',
refresh: true,
Expand Down
21 changes: 6 additions & 15 deletions x-pack/test/functional/apps/discover/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const PageObjects = getPageObjects(['reporting', 'common', 'discover', 'timePicker']);
const filterBar = getService('filterBar');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

const setFieldsFromSource = async (setValue: boolean) => {
await kibanaServer.uiSettings.update({ 'discover:searchFieldsFromSource': setValue });
Expand All @@ -25,16 +26,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before('initialize tests', async () => {
log.debug('ReportingPage:initTests');
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
await browser.setWindowSize(1600, 850);
});
after('clean up archives', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await es.deleteByQuery({
index: '.reporting-*',
refresh: true,
Expand Down Expand Up @@ -78,9 +75,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('Generate CSV: new search', () => {
beforeEach(async () => {
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
await PageObjects.common.navigateToApp('discover');
});

Expand Down Expand Up @@ -157,16 +152,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
});

after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
});

beforeEach(() => PageObjects.common.navigateToApp('discover'));
Expand Down
9 changes: 3 additions & 6 deletions x-pack/test/functional/apps/discover/saved_searches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dataGrid = getService('dataGrid');
const panelActions = getService('dashboardPanelActions');
const panelActionsTimeRange = getService('dashboardPanelTimeRange');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

describe('Discover Saved Searches', () => {
before('initialize tests', async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
await kibanaServer.uiSettings.update({ 'doc_table:legacy': false });
});
after('clean up archives', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await kibanaServer.uiSettings.unset('doc_table:legacy');
});

Expand Down
9 changes: 3 additions & 6 deletions x-pack/test/functional/apps/visualize/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const log = getService('log');
const kibanaServer = getService('kibanaServer');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

const PageObjects = getPageObjects([
'reporting',
Expand All @@ -27,16 +28,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before('initialize tests', async () => {
log.debug('ReportingPage:initTests');
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
await browser.setWindowSize(1600, 850);
});
after('clean up archives', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await es.deleteByQuery({
index: '.reporting-*',
refresh: true,
Expand Down
9 changes: 3 additions & 6 deletions x-pack/test/reporting_api_integration/services/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer
const kibanaServer = getService('kibanaServer');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const retry = getService('retry');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

const DATA_ANALYST_USERNAME = 'data_analyst';
const DATA_ANALYST_PASSWORD = 'data_analyst-password';
Expand All @@ -33,15 +34,11 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer

const initEcommerce = async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
};
const teardownEcommerce = async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await deleteAllReports();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const reportingApi = getService('reportingAPI');
const ecommerceSOPath = 'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json';

const postJobJSON = async (
apiPath: string,
Expand All @@ -31,16 +32,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
describe('Polling for jobs', () => {
beforeEach(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.load(ecommerceSOPath);
});

afterEach(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce.json'
);
await kibanaServer.importExport.unload(ecommerceSOPath);
await reportingApi.deleteAllReports();
});

Expand Down

0 comments on commit ed2abb5

Please sign in to comment.