Merge pull request #8285 from cjcenizal/bug/fix-shared-links-functional-test

Fix functional tests for Share UI.
This commit is contained in:
CJ Cenizal 2016-09-14 13:56:21 -07:00 committed by GitHub
commit 1cb4b6b512
3 changed files with 14 additions and 14 deletions

View file

@ -2,7 +2,10 @@
<!-- Left panel --> <!-- Left panel -->
<div class="share-panel share-panel--left"> <div class="share-panel share-panel--left">
<!-- Title --> <!-- Title -->
<div class="share-panel__title"> <div
data-test-subj="shareUiTitle"
class="share-panel__title"
>
Share saved {{share.objectType}} Share saved {{share.objectType}}
</div> </div>
@ -146,6 +149,7 @@
</div> </div>
<div class="share-panel-header__actions"> <div class="share-panel-header__actions">
<a <a
data-test-subj="sharedSnapshotShortUrlButton"
class="share-panel-header__action" class="share-panel-header__action"
ng-if="!share.urlFlags.shortSnapshot" ng-if="!share.urlFlags.shortSnapshot"
ng-click="share.toggleShortSnapshotUrl()" ng-click="share.toggleShortSnapshotUrl()"
@ -162,6 +166,7 @@
</a> </a>
<a <a
data-test-subj="sharedSnapshotCopyButton"
class="share-panel-header__action" class="share-panel-header__action"
ng-click="share.copyToClipboard('#snapshotUrl')" ng-click="share.copyToClipboard('#snapshotUrl')"
> >
@ -172,6 +177,7 @@
<!-- Input --> <!-- Input -->
<input <input
data-test-subj="sharedSnapshotUrl"
id="snapshotUrl" id="snapshotUrl"
class="share-panel-input" class="share-panel-input"
type="text" type="text"

View file

@ -52,14 +52,14 @@ bdd.describe('shared links', function describeIndexTests() {
bdd.describe('shared link', function () { bdd.describe('shared link', function () {
bdd.it('should show "Share a link" caption', function () { bdd.it('should show "Share a link" caption', function () {
var expectedCaption = 'Share a link'; var expectedCaption = 'Share saved';
return PageObjects.discover.clickShare() return PageObjects.discover.clickShare()
.then(function () { .then(function () {
PageObjects.common.saveScreenshot('Discover-share-link'); PageObjects.common.saveScreenshot('Discover-share-link');
return PageObjects.discover.getShareCaption(); return PageObjects.discover.getShareCaption();
}) })
.then(function (actualCaption) { .then(function (actualCaption) {
expect(actualCaption).to.be(expectedCaption); expect(actualCaption).to.contain(expectedCaption);
}); });
}); });
@ -100,7 +100,7 @@ bdd.describe('shared links', function describeIndexTests() {
.then(function () { .then(function () {
return PageObjects.common.try(function tryingForTime() { return PageObjects.common.try(function tryingForTime() {
PageObjects.common.saveScreenshot('Discover-shorten-url-button'); PageObjects.common.saveScreenshot('Discover-shorten-url-button');
return PageObjects.discover.getShortenedUrl() return PageObjects.discover.getSharedUrl()
.then(function (actualUrl) { .then(function (actualUrl) {
expect(actualUrl).to.match(re); expect(actualUrl).to.match(re);
}); });

View file

@ -202,31 +202,25 @@ export default class DiscoverPage {
clickShortenUrl() { clickShortenUrl() {
return this.findTimeout return this.findTimeout
.findByCssSelector('button.shorten-button') .findByCssSelector('[data-test-subj="sharedSnapshotShortUrlButton"]')
.click(); .click();
} }
clickCopyToClipboard() { clickCopyToClipboard() {
return this.findTimeout return this.findTimeout
.findDisplayedByCssSelector('button.clipboard-button') .findByCssSelector('[data-test-subj="sharedSnapshotCopyButton"]')
.click(); .click();
} }
getShareCaption() { getShareCaption() {
return this.findTimeout return this.findTimeout
.findByCssSelector('.vis-share label') .findByCssSelector('[data-test-subj="shareUiTitle"]')
.getVisibleText(); .getVisibleText();
} }
getSharedUrl() { getSharedUrl() {
return this.findTimeout return this.findTimeout
.findByCssSelector('.url') .findByCssSelector('[data-test-subj="sharedSnapshotUrl"]')
.getProperty('value');
}
getShortenedUrl() {
return this.findTimeout
.findByCssSelector('.url')
.getProperty('value'); .getProperty('value');
} }