Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Fix bookmarksToolbar intermittent failures
Browse files Browse the repository at this point in the history
I think this will help, I think what was happening is that the save gets run but the bookmark details aren't updated yet when done super fast

Auditors: @bsclifton
  • Loading branch information
bbondy committed Jan 16, 2017
1 parent af7f623 commit 7670206
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion test/components/bookmarksToolbarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ describe('bookmarksToolbar', function () {
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForBookmarkDetail(this.page1Url, 'Page 1')
.waitForEnabled(doneButton)
.selectByValue('#bookmarkParentFolder select', folderId2)
.click(doneButton)
Expand Down Expand Up @@ -143,8 +144,10 @@ describe('bookmarksToolbar', function () {
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForBookmarkDetail(this.page1Url, 'Page 1')
.setInputText('#bookmarkName input', 'test1')
.waitForBookmarkDetail(this.page1Url, 'test1')
.waitForEnabled(doneButton)
.setValue('#bookmarkName input', 'test1')
.click(doneButton)
.waitForVisible('.bookmarkToolbarButton[title^=test1]')
.click('.bookmarkToolbarButton[title=demo1]')
Expand Down Expand Up @@ -176,6 +179,7 @@ describe('bookmarksToolbar', function () {
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForBookmarkDetail(pageWithFavicon, '')
.waitForEnabled(doneButton)
.click(doneButton)

Expand All @@ -201,6 +205,7 @@ describe('bookmarksToolbar', function () {
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForBookmarkDetail(pageWithoutFavicon, 'Favicon is not found page')
.waitForEnabled(doneButton)
.click(doneButton)

Expand Down
18 changes: 17 additions & 1 deletion test/lib/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ var exports = {
})

this.app.client.addCommand('waitForSiteEntry', function (location, waitForTitle = true) {
logVerbose('waitForSiteEntry(' + location + ', ' + waitForTitle + ')')
logVerbose('waitForSiteEntry("' + location + '", "' + waitForTitle + '")')
return this.waitUntil(function () {
return this.getAppState().then((val) => {
const ret = val.value && val.value.sites && val.value.sites.find(
Expand All @@ -333,6 +333,22 @@ var exports = {
})
})

this.app.client.addCommand('waitForBookmarkDetail', function (location, title) {

This comment has been minimized.

Copy link
@bsclifton

bsclifton Jan 16, 2017

Member

😻

logVerbose('waitForBookmarkDetail("' + location + '", "' + title + '")')
return this.waitUntil(function () {
return this.getWindowState().then((val) => {
const bookmarkDetailLocation = val.value && val.value.bookmarkDetail &&
val.value.bookmarkDetail.currentDetail && val.value.bookmarkDetail.currentDetail.location
const bookmarkDetailTitle = val.value && val.value.bookmarkDetail && val.value.bookmarkDetail.currentDetail &&
val.value.bookmarkDetail.currentDetail.customTitle || val.value.bookmarkDetail.currentDetail.title
const ret = bookmarkDetailLocation === location && bookmarkDetailTitle === title
logVerbose('waitForBookmarkDetail("' + location + '", "' + title + '") => ' + ret +
' (bookmarkDetailLocation = ' + bookmarkDetailLocation + ', bookmarkDetailTitle = ' + bookmarkDetailTitle + ')')
return ret
})
})
})

this.app.client.addCommand('loadUrl', function (url) {
if (isSourceAboutUrl(url)) {
url = getTargetAboutUrl(url)
Expand Down

1 comment on commit 7670206

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

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

++

Please sign in to comment.