Skip to content

Commit a2ddb45

Browse files
authored
Merge pull request elastic#8286 from elastic/jasper/backport/8285/5.x
[backport] PR elastic#8285 to 5.x - Fix functional tests for Share UI.
2 parents 0e338df + fc7357b commit a2ddb45

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/ui/public/share/views/share.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<!-- Left panel -->
33
<div class="share-panel share-panel--left">
44
<!-- Title -->
5-
<div class="share-panel__title">
5+
<div
6+
data-test-subj="shareUiTitle"
7+
class="share-panel__title"
8+
>
69
Share saved {{share.objectType}}
710
</div>
811

@@ -146,6 +149,7 @@
146149
</div>
147150
<div class="share-panel-header__actions">
148151
<a
152+
data-test-subj="sharedSnapshotShortUrlButton"
149153
class="share-panel-header__action"
150154
ng-if="!share.urlFlags.shortSnapshot"
151155
ng-click="share.toggleShortSnapshotUrl()"
@@ -162,6 +166,7 @@
162166
</a>
163167

164168
<a
169+
data-test-subj="sharedSnapshotCopyButton"
165170
class="share-panel-header__action"
166171
ng-click="share.copyToClipboard('#snapshotUrl')"
167172
>
@@ -172,6 +177,7 @@
172177

173178
<!-- Input -->
174179
<input
180+
data-test-subj="sharedSnapshotUrl"
175181
id="snapshotUrl"
176182
class="share-panel-input"
177183
type="text"

test/functional/apps/discover/_shared_links.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ bdd.describe('shared links', function describeIndexTests() {
5252

5353
bdd.describe('shared link', function () {
5454
bdd.it('should show "Share a link" caption', function () {
55-
var expectedCaption = 'Share a link';
55+
var expectedCaption = 'Share saved';
5656
return PageObjects.discover.clickShare()
5757
.then(function () {
5858
PageObjects.common.saveScreenshot('Discover-share-link');
5959
return PageObjects.discover.getShareCaption();
6060
})
6161
.then(function (actualCaption) {
62-
expect(actualCaption).to.be(expectedCaption);
62+
expect(actualCaption).to.contain(expectedCaption);
6363
});
6464
});
6565

@@ -100,7 +100,7 @@ bdd.describe('shared links', function describeIndexTests() {
100100
.then(function () {
101101
return PageObjects.common.try(function tryingForTime() {
102102
PageObjects.common.saveScreenshot('Discover-shorten-url-button');
103-
return PageObjects.discover.getShortenedUrl()
103+
return PageObjects.discover.getSharedUrl()
104104
.then(function (actualUrl) {
105105
expect(actualUrl).to.match(re);
106106
});

test/support/page_objects/discover_page.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,25 @@ export default class DiscoverPage {
202202

203203
clickShortenUrl() {
204204
return this.findTimeout
205-
.findByCssSelector('button.shorten-button')
205+
.findByCssSelector('[data-test-subj="sharedSnapshotShortUrlButton"]')
206206
.click();
207207
}
208208

209209
clickCopyToClipboard() {
210210
return this.findTimeout
211-
.findDisplayedByCssSelector('button.clipboard-button')
211+
.findByCssSelector('[data-test-subj="sharedSnapshotCopyButton"]')
212212
.click();
213213
}
214214

215215
getShareCaption() {
216216
return this.findTimeout
217-
.findByCssSelector('.vis-share label')
217+
.findByCssSelector('[data-test-subj="shareUiTitle"]')
218218
.getVisibleText();
219219
}
220220

221221
getSharedUrl() {
222222
return this.findTimeout
223-
.findByCssSelector('.url')
224-
.getProperty('value');
225-
}
226-
227-
getShortenedUrl() {
228-
return this.findTimeout
229-
.findByCssSelector('.url')
223+
.findByCssSelector('[data-test-subj="sharedSnapshotUrl"]')
230224
.getProperty('value');
231225
}
232226

0 commit comments

Comments
 (0)