Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable import objects tests #21250

Merged
merged 2 commits into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,23 @@ export class Flyout extends Component {
}

if (wasImportSuccessful) {
if (importCount === 0) {
return (
<EuiCallOut
data-test-subj="importSavedObjectsSuccessNoneImported"
title="No objects imported"
color="primary"
/>
);
}

return (
<EuiCallOut title="Import successful" color="success" iconType="check">
<EuiCallOut
data-test-subj="importSavedObjectsSuccess"
title="Import successful"
color="success"
iconType="check"
>
<p>Successfully imported {importCount} objects.</p>
</EuiCallOut>
);
Expand Down
55 changes: 20 additions & 35 deletions test/functional/apps/management/_import_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'settings', 'header']);
const testSubjects = getService('testSubjects');

describe('import objects', function describeIndexTests() {
beforeEach(async function () {
Expand Down Expand Up @@ -53,7 +54,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects-conflicts.json'));
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.setImportIndexFieldOption(2);
await PageObjects.settings.clickConfirmConflicts();
await PageObjects.settings.clickConfirmChanges();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.clickImportDone();
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();
Expand All @@ -62,56 +63,40 @@ export default function ({ getService, getPageObjects }) {
expect(isSavedObjectImported).to.be(true);
});

// Test should be testing that user is warned when saved object will override another because of an id collision
// This is not the case. Instead the test just loads a saved object with an index pattern conflict
// Disabling until the issue is resolved since the test does not test the intended behavior
it.skip('should allow for overrides', async function () {
it('should allow the user to override duplicate saved objects', async function () {
await PageObjects.settings.clickKibanaSavedObjects();

// Put in data which already exists
// This data has already been loaded by the "visualize" esArchive. We'll load it again
// so that we can overriding the existing visualization.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"override" instead of "overriding" here

await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.json'), false);
// Wait for all the saves to happen

await PageObjects.header.waitUntilLoadingHasFinished();
// Interact with the conflict modal
await PageObjects.settings.setImportIndexFieldOption(2);
await PageObjects.settings.clickConfirmConflicts();
// Now confirm we want to override
await PageObjects.settings.clickConfirmChanges();

// Override the visualization.
await PageObjects.common.clickConfirmOnModal();
// Wait for all the saves to happen
await PageObjects.header.waitUntilLoadingHasFinished();
// Finish the flyout
await PageObjects.settings.clickImportDone();
// Wait...
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

const objects = await PageObjects.settings.getSavedObjectsInTable();
expect(objects.length).to.be(2);
const isSuccessful = await testSubjects.exists('importSavedObjectsSuccess');
expect(isSuccessful).to.be(true);
});

// Test should be testing that user is warned when saved object will overrides another because of an id collision
// This is not the case. Instead the test just loads a saved object with an index pattern conflict
// Disabling until the issue is resolved since the test does not test the intended behavior
it.skip('should allow for cancelling overrides', async function () {
it('should allow the user to cancel overriding duplicate saved objects', async function () {
await PageObjects.settings.clickKibanaSavedObjects();

// Put in data which already exists
// This data has already been loaded by the "visualize" esArchive. We'll load it again
// so that we can be prompted to override the existing visualization.
await PageObjects.settings.importFile(path.join(__dirname, 'exports', '_import_objects_exists.json'), false);
// Wait for all the saves to happen

await PageObjects.header.waitUntilLoadingHasFinished();
// Interact with the conflict modal
await PageObjects.settings.setImportIndexFieldOption(2);
await PageObjects.settings.clickConfirmConflicts();
// Now cancel the override
await PageObjects.settings.clickConfirmChanges();

// *Don't* override the visualization.
await PageObjects.common.clickCancelOnModal();
// Wait for all saves to happen
await PageObjects.header.waitUntilLoadingHasFinished();
// Finish the flyout
await PageObjects.settings.clickImportDone();
// Wait for table to refresh
await PageObjects.settings.waitUntilSavedObjectsTableIsNotLoading();

const objects = await PageObjects.settings.getSavedObjectsInTable();
expect(objects.length).to.be(2);
const isSuccessful = await testSubjects.exists('importSavedObjectsSuccessNoneImported');
expect(isSuccessful).to.be(true);
});

it('should import saved objects linked to saved searches', async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/settings_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
await testSubjects.click('importSavedObjectsDoneBtn');
}

async clickConfirmConflicts() {
async clickConfirmChanges() {
await testSubjects.click('importSavedObjectsConfirmBtn');
}

Expand Down