Skip to content

Commit

Permalink
[ML] Change to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Nov 2, 2021
1 parent 528287c commit b9a99bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
function runTests(testData: TestData) {
const savedSearchTitle = `Field stats for ${testData.suiteTitle} ${Date.now()}`;
const dashboardTitle = `Dashboard for ${testData.suiteTitle} ${Date.now()}`;
const startTime = 'Jan 1, 2016 @ 00:00:00.000';
const endTime = 'Nov 1, 2020 @ 00:00:00.000';

describe(`with ${testData.suiteTitle}`, function () {
after(async function () {
Expand All @@ -40,10 +42,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
testData.sourceIndexOrSavedSearch
);
}
await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2016 @ 00:00:00.000',
'Nov 1, 2020 @ 00:00:00.000'
);
await PageObjects.timePicker.setAbsoluteRange(startTime, endTime);

await PageObjects.discover.assertViewModeToggleExists();
await PageObjects.discover.clickViewModeFieldStatsButton();
Expand All @@ -58,10 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.addSavedSearch(savedSearchTitle);
await PageObjects.dashboard.waitForRenderComplete();

await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2016 @ 00:00:00.000',
'Nov 1, 2020 @ 00:00:00.000'
);
await PageObjects.timePicker.setAbsoluteRange(startTime, endTime);
await PageObjects.dashboard.waitForRenderComplete();

for (const fieldRow of testData.expected.metricFields as Array<
Expand Down Expand Up @@ -100,10 +96,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.addSavedSearch(savedSearchTitle);
await PageObjects.dashboard.waitForRenderComplete();

await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2016 @ 00:00:00.000',
'Nov 1, 2020 @ 00:00:00.000'
);
await PageObjects.timePicker.setAbsoluteRange(startTime, endTime);
await PageObjects.dashboard.waitForRenderComplete();

await PageObjects.discover.assertFieldStatsTableNotExists();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const ml = getService('ml');
const retry = getService('retry');

const startTime = 'Jan 1, 2016 @ 00:00:00.000';
const endTime = 'Nov 1, 2020 @ 00:00:00.000';

function runTestsWhenDisabled(testData: TestData) {
it('should not show view mode toggle or Field stats table', async function () {
await PageObjects.common.navigateToApp('discover');
Expand All @@ -34,10 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await ml.dashboardEmbeddables.selectDiscoverIndexPattern(testData.sourceIndexOrSavedSearch);
}

await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2016 @ 00:00:00.000',
'Nov 1, 2020 @ 00:00:00.000'
);
await PageObjects.timePicker.setAbsoluteRange(startTime, endTime);

await PageObjects.discover.assertViewModeToggleNotExists();
await PageObjects.discover.assertFieldStatsTableNotExists();
Expand All @@ -57,10 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
testData.sourceIndexOrSavedSearch
);
}
await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2016 @ 00:00:00.000',
'Nov 1, 2020 @ 00:00:00.000'
);
await PageObjects.timePicker.setAbsoluteRange(startTime, endTime);

await PageObjects.discover.assertHitCount(testData.expected.totalDocCountFormatted);
await PageObjects.discover.assertViewModeToggleExists();
Expand Down

0 comments on commit b9a99bd

Please sign in to comment.