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

[home] Include ability to publish kibana saved objects from add data tutorial #19559

Merged
merged 29 commits into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b0f6537
add savedObjects to tutorial schema, add savedObjects to APM, add bul…
nreese May 30, 2018
a63831a
SavedObjectInstaller component
nreese May 30, 2018
6decd9d
bulkCreate fixes
nreese May 30, 2018
6eaeb6a
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jun 19, 2018
c3cd774
fix tutorial jest test
nreese Jun 19, 2018
23928e0
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jun 20, 2018
bc739f5
update from sqren review
nreese Jun 20, 2018
822627c
updated copy
nreese Jun 20, 2018
7f9c845
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jun 25, 2018
c73f6e9
move saved object json into seperate json files
nreese Jun 25, 2018
63db6f9
minor commit clean up
nreese Jun 25, 2018
fc2064d
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jun 28, 2018
560b4a9
ensure isMounted before setting state after async call, allow manifes…
nreese Jun 28, 2018
9ff43d3
remove duplicated logic for getting config xpack.apm.indexPattern
nreese Jun 28, 2018
e5000e3
refactor get index pattern title
nreese Jun 28, 2018
7bc56e1
add functional test that loads APM saved objects
nreese Jun 28, 2018
232a760
remove extra await
nreese Jun 28, 2018
12e29b3
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jul 5, 2018
ef0be0e
merge with master - master now has bulkCreate
nreese Jul 10, 2018
6175825
display overwrite message
nreese Jul 10, 2018
cb3f8de
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jul 10, 2018
8ea193d
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jul 13, 2018
e037c91
use angular free savedObjectClient
nreese Jul 13, 2018
e0cb81b
Merge branch 'master' of https://github.com/elastic/kibana into load_…
nreese Jul 17, 2018
66faeb3
functional test cleanup
nreese Jul 17, 2018
a4ad403
handle bulkRequest exception and add jest tests for SavedObjectsInsta…
nreese Jul 17, 2018
c0e25ad
use Promise.reject instead of throw
nreese Jul 17, 2018
7cd8938
update copy
nreese Jul 17, 2018
7e108c0
merge with master
nreese Jul 18, 2018
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 @@ -79,6 +79,7 @@ export class SavedObjectsInstaller extends React.Component {
<EuiCallOut
title={this.state.installStatusMsg}
color={this.state.isInstalled ? 'success' : 'warning'}
data-test-subj={this.state.isInstalled ? 'loadSavedObjects_success' : 'loadSavedObjects_failed'}
/>
);
}
Expand All @@ -102,6 +103,7 @@ export class SavedObjectsInstaller extends React.Component {
<EuiButton
onClick={this.installSavedObjects}
isLoading={this.state.isInstalling}
data-test-subj="loadSavedObjects"
>
Load/Import Kibana objects
</EuiButton>
Expand Down
24 changes: 23 additions & 1 deletion test/functional/apps/home/_add_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import expect from 'expect.js';

export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'header', 'home']);
const PageObjects = getPageObjects(['common', 'header', 'home', 'dashboard']);

describe('add data tutorials', function describeIndexTests() {

Expand All @@ -34,5 +34,27 @@ export default function ({ getService, getPageObjects }) {
});
});

describe('apm', function describeIndexTests() {

it('should install saved objects', async ()=> {
await PageObjects.common.navigateToUrl('home', 'tutorial_directory');
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
await PageObjects.home.clickSynopsis('apm');
});

await PageObjects.home.loadSavedObjects();

await PageObjects.common.navigateToApp('dashboard');

await PageObjects.dashboard.searchForDashboardWithName('APM');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
expect(countOfDashboards).to.equal(5);
});

});

});


}
14 changes: 14 additions & 0 deletions test/functional/page_objects/home_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
* under the License.
*/

import expect from 'expect.js';

export function HomePageProvider({ getService }) {
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const retry = getService('retry');

class HomePage {

Expand Down Expand Up @@ -63,6 +66,17 @@ export function HomePageProvider({ getService }) {
await testSubjects.click(`launchSampleDataSet${id}`);
}

async loadSavedObjects() {
// Button at bottom of page, move into view before clicking
const loadBtn = await testSubjects.find('loadSavedObjects');
await remote.moveMouseTo(loadBtn);
await testSubjects.click('loadSavedObjects');
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried just doing testSubjects.click? The move logic is internal:

    async click(selector, timeout = defaultFindTimeout) {
      log.debug(`TestSubjects.click(${selector})`);
      return await retry.try(async () => {
        const element = await this.find(selector, timeout);
        await remote.moveMouseTo(element);
        await element.click();
      });
    }

await retry.try(async () => {
const successMsgExists = await await testSubjects.exists('loadSavedObjects_success');
Copy link
Contributor

@stacey-gammon stacey-gammon Jul 17, 2018

Choose a reason for hiding this comment

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

Two awaits here. Also, have you tried just extending the timeout? You can do something like:

await testSubjects.exists('loadSavedObjects_success', 10000) if the default timeout of 1 second is not long enough.

Another option is to just do await testSubjects.find('loadSavedObjects_success');

That should have an internal retry since it assumes it's supposed to exist:

    async _ensureElementWithTimeout(timeout, getElementFunction) {
      try {
        const remoteWithTimeout = remote.setFindTimeout(timeout);
        return await retry.try(async () => {
          const element = await getElementFunction(remoteWithTimeout);
          // Calling any method forces a staleness check
          element.isEnabled();
          return element;
        });
      } finally {
        remote.setFindTimeout(defaultFindTimeout);
      }
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

nm, I see you already got rid of the second await in a follow up commit.

cc @spalger - I think this is a deficiency to having non-squashed commits. How do you keep up with all the changes from commit to commit to commit?

For instance I reviewed before this commit. I wanted to see the functional tests added so I went to that commit and added the comment. But the next commit fixed it. So what would your flow be? Start at commit x and review each one, x -> x + 1 -> x + 2 ... ? What if an x + n commit fixed something you commented on prior? Just go back and delete it?

Or do you review all commits from one commit onward but not the pull merges? Doesn't seem possible to do this in the git UI. It's either review all changes, or review commit by commit.

expect(successMsgExists).to.be(true);
});
}

}

return new HomePage();
Expand Down