Skip to content

Commit

Permalink
Merge pull request elastic#8286 from elastic/jasper/backport/8285/5.x
Browse files Browse the repository at this point in the history
[backport] PR elastic#8285 to 5.x - Fix functional tests for Share UI.

Former-commit-id: a2ddb45
  • Loading branch information
cjcenizal authored Sep 14, 2016
2 parents b830a43 + a5aea20 commit 9754e56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/ui/public/share/views/share.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<!-- Left panel -->
<div class="share-panel share-panel--left">
<!-- Title -->
<div class="share-panel__title">
<div
data-test-subj="shareUiTitle"
class="share-panel__title"
>
Share saved {{share.objectType}}
</div>

Expand Down Expand Up @@ -146,6 +149,7 @@
</div>
<div class="share-panel-header__actions">
<a
data-test-subj="sharedSnapshotShortUrlButton"
class="share-panel-header__action"
ng-if="!share.urlFlags.shortSnapshot"
ng-click="share.toggleShortSnapshotUrl()"
Expand All @@ -162,6 +166,7 @@
</a>

<a
data-test-subj="sharedSnapshotCopyButton"
class="share-panel-header__action"
ng-click="share.copyToClipboard('#snapshotUrl')"
>
Expand All @@ -172,6 +177,7 @@

<!-- Input -->
<input
data-test-subj="sharedSnapshotUrl"
id="snapshotUrl"
class="share-panel-input"
type="text"
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ bdd.describe('shared links', function describeIndexTests() {

bdd.describe('shared link', function () {
bdd.it('should show "Share a link" caption', function () {
var expectedCaption = 'Share a link';
var expectedCaption = 'Share saved';
return PageObjects.discover.clickShare()
.then(function () {
PageObjects.common.saveScreenshot('Discover-share-link');
return PageObjects.discover.getShareCaption();
})
.then(function (actualCaption) {
expect(actualCaption).to.be(expectedCaption);
expect(actualCaption).to.contain(expectedCaption);
});
});

Expand Down Expand Up @@ -100,7 +100,7 @@ bdd.describe('shared links', function describeIndexTests() {
.then(function () {
return PageObjects.common.try(function tryingForTime() {
PageObjects.common.saveScreenshot('Discover-shorten-url-button');
return PageObjects.discover.getShortenedUrl()
return PageObjects.discover.getSharedUrl()
.then(function (actualUrl) {
expect(actualUrl).to.match(re);
});
Expand Down
14 changes: 4 additions & 10 deletions test/support/page_objects/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,31 +202,25 @@ export default class DiscoverPage {

clickShortenUrl() {
return this.findTimeout
.findByCssSelector('button.shorten-button')
.findByCssSelector('[data-test-subj="sharedSnapshotShortUrlButton"]')
.click();
}

clickCopyToClipboard() {
return this.findTimeout
.findDisplayedByCssSelector('button.clipboard-button')
.findByCssSelector('[data-test-subj="sharedSnapshotCopyButton"]')
.click();
}

getShareCaption() {
return this.findTimeout
.findByCssSelector('.vis-share label')
.findByCssSelector('[data-test-subj="shareUiTitle"]')
.getVisibleText();
}

getSharedUrl() {
return this.findTimeout
.findByCssSelector('.url')
.getProperty('value');
}

getShortenedUrl() {
return this.findTimeout
.findByCssSelector('.url')
.findByCssSelector('[data-test-subj="sharedSnapshotUrl"]')
.getProperty('value');
}

Expand Down

0 comments on commit 9754e56

Please sign in to comment.