Skip to content

Commit

Permalink
Improve recently failed tests (#48389)
Browse files Browse the repository at this point in the history
* [apps/management] improve import objects tests

* [page_objects/dashboard_page] replace link navigation with direct url

* [dashboard/time_zones] reset date format via API

* update jest snapshot

* [management/_kibana_settings] reset date format via API

* revert changees to dashboard tests

* run ciGroup 7 & 8 15x times

* Revert "run ciGroup 7 & 8 15x times"

This reverts commit 8be64d5.
  • Loading branch information
dmlemeshko authored Oct 17, 2019
1 parent 8e629ee commit 2fb13ce
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 27 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ export class Flyout extends Component {
) {
return (
<EuiCallOut
data-test-subj="importSavedObjectsFailedWarning"
title={
<FormattedMessage
id="kbn.management.objects.objectsTable.flyout.importFailedTitle"
Expand Down Expand Up @@ -786,6 +787,7 @@ export class Flyout extends Component {
if (this.state.isLegacyFile) {
legacyFileWarning = (
<EuiCallOut
data-test-subj="importSavedObjectsLegacyWarning"
title={
<FormattedMessage
id="kbn.management.objects.objectsTable.flyout.legacyFileUsedTitle"
Expand All @@ -809,6 +811,7 @@ export class Flyout extends Component {
if (this.hasUnmatchedReferences) {
indexPatternConflictsWarning = (
<EuiCallOut
data-test-subj="importSavedObjectsConflictsWarning"
title={
<FormattedMessage
id="kbn.management.objects.objectsTable.flyout.indexPatternConflictsTitle"
Expand Down
9 changes: 5 additions & 4 deletions test/functional/apps/dashboard/time_zones.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const pieChart = getService('pieChart');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['dashboard', 'timePicker', 'settings', 'common']);

describe('dashboard time zones', function () {
Expand All @@ -30,15 +32,14 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', 'timezonetest_6_2_4.json'));
await PageObjects.settings.checkImportSucceeded();
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('time zone test');
});

after(async () => {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSettings();
await PageObjects.settings.setAdvancedSettingsSelect('dateFormat:tz', 'UTC');
await PageObjects.common.navigateToApp('dashboard');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
});

it('Exported dashboard adjusts EST time to UTC', async () => {
Expand Down
45 changes: 24 additions & 21 deletions test/functional/apps/management/_import_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ({ getService, getPageObjects }) {
it('should import saved objects', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
const objects = await PageObjects.settings.getSavedObjectsInTable();
Expand All @@ -53,7 +53,7 @@ export default function ({ getService, getPageObjects }) {
it('should provide dialog to allow the importing of saved objects with index pattern conflicts', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_conflicts.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('d1e4c910-a2e6-11e7-bb30-233be9be6a15', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();
await PageObjects.header.waitUntilLoadingHasFinished();
Expand All @@ -71,7 +71,7 @@ export default function ({ getService, getPageObjects }) {
// so that we can override the existing visualization.
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.ndjson'), false);

await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('logstash-*', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();

Expand All @@ -89,7 +89,7 @@ export default function ({ getService, getPageObjects }) {
// so that we can be prompted to override the existing visualization.
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.ndjson'), false);

await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('logstash-*', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();

Expand All @@ -103,13 +103,13 @@ export default function ({ getService, getPageObjects }) {
it('should import saved objects linked to saved searches', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_saved_search.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();

await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_connected_to_saved_search.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

Expand All @@ -122,7 +122,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_connected_to_saved_search.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkNoneImported();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

Expand All @@ -140,7 +140,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_with_saved_search.ndjson'));
// Wait for all the saves to happen
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.clickConfirmChanges();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand All @@ -154,7 +154,7 @@ export default function ({ getService, getPageObjects }) {
// First, import the objects
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_with_index_patterns.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
// Wait for all the saves to happen
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand All @@ -173,7 +173,7 @@ export default function ({ getService, getPageObjects }) {
// Then, import the objects
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_with_index_patterns.ndjson'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
// Wait for all the saves to happen
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand All @@ -199,7 +199,7 @@ export default function ({ getService, getPageObjects }) {
it('should import saved objects', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
const objects = await PageObjects.settings.getSavedObjectsInTable();
Expand All @@ -210,7 +210,8 @@ export default function ({ getService, getPageObjects }) {
it('should provide dialog to allow the importing of saved objects with index pattern conflicts', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects-conflicts.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportLegacyWarning();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('d1e4c910-a2e6-11e7-bb30-233be9be6a15', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();
await PageObjects.header.waitUntilLoadingHasFinished();
Expand All @@ -228,7 +229,8 @@ export default function ({ getService, getPageObjects }) {
// so that we can override the existing visualization.
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.json'), false);

await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportLegacyWarning();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('logstash-*', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();

Expand All @@ -246,7 +248,8 @@ export default function ({ getService, getPageObjects }) {
// so that we can be prompted to override the existing visualization.
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.json'), false);

await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportLegacyWarning();
await PageObjects.settings.checkImportConflictsWarning();
await PageObjects.settings.associateIndexPattern('logstash-*', 'logstash-*');
await PageObjects.settings.clickConfirmChanges();

Expand All @@ -260,13 +263,13 @@ export default function ({ getService, getPageObjects }) {
it('should import saved objects linked to saved searches', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_saved_search.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();

await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_connected_to_saved_search.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

Expand All @@ -279,7 +282,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_connected_to_saved_search.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportFailedWarning();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

Expand All @@ -293,7 +296,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_saved_search.json'));
// Wait for all the saves to happen
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();

// Second, we need to delete the index pattern
Expand All @@ -307,7 +310,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_connected_to_saved_search.json'));
// Wait for all the saves to happen
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkNoneImported();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

Expand All @@ -320,7 +323,7 @@ export default function ({ getService, getPageObjects }) {
// First, import the objects
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_with_index_patterns.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportFailedWarning();
await PageObjects.settings.clickImportDone();
// Wait for all the saves to happen
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand All @@ -339,7 +342,7 @@ export default function ({ getService, getPageObjects }) {
// Then, import the objects
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_with_index_patterns.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.checkImportSucceeded();
await PageObjects.settings.clickImportDone();
// Wait for all the saves to happen
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/management/_kibana_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export default function ({ getService, getPageObjects }) {
});

after(async function () {
await PageObjects.settings.clickKibanaSettings();
await PageObjects.settings.setAdvancedSettingsSelect('dateFormat:tz', 'UTC');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
});
});
}
20 changes: 20 additions & 0 deletions test/functional/page_objects/settings_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,26 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
await PageObjects.header.waitUntilLoadingHasFinished();
}

async checkImportSucceeded() {
await testSubjects.existOrFail('importSavedObjectsSuccess', { timeout: 20000 });
}

async checkNoneImported() {
await testSubjects.existOrFail('importSavedObjectsSuccessNoneImported', { timeout: 20000 });
}

async checkImportConflictsWarning() {
await testSubjects.existOrFail('importSavedObjectsConflictsWarning', { timeout: 20000 });
}

async checkImportLegacyWarning() {
await testSubjects.existOrFail('importSavedObjectsLegacyWarning', { timeout: 20000 });
}

async checkImportFailedWarning() {
await testSubjects.existOrFail('importSavedObjectsFailedWarning', { timeout: 20000 });
}

async clickImportDone() {
await testSubjects.click('importSavedObjectsDoneBtn');
}
Expand Down

0 comments on commit 2fb13ce

Please sign in to comment.