Skip to content

Commit

Permalink
Fix intermittent fails in bookmarks toolbar
Browse files Browse the repository at this point in the history
The fix comes from the waitForEnable on the done button, but I changed
some other things to be more explicit too in the process of finding
that.

Auditors: @bsclifton
  • Loading branch information
bbondy committed Jan 6, 2017
1 parent cfa8388 commit 361e09b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/components/bookmarksToolbarTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it, beforeEach */

const Brave = require('../lib/brave')
const { urlInput, bookmarksToolbar, navigator, navigatorNotBookmarked, doneButton } = require('../lib/selectors')
const {urlInput, bookmarksToolbar, navigator, navigatorNotBookmarked, doneButton} = require('../lib/selectors')
const settings = require('../../js/constants/settings')
const siteTags = require('../../js/constants/siteTags')
const assert = require('assert')
Expand Down Expand Up @@ -33,13 +33,13 @@ describe('bookmarksToolbar', function () {
it('shows the bookmarks toolbar if the setting is enabled', function * () {
yield this.app.client
.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true)
.waitForVisible(bookmarksToolbar, 1000)
.waitForVisible(bookmarksToolbar)
})

it('hides the bookmarks toolbar if the setting is disabled', function * () {
yield this.app.client
.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, false)
.waitForVisible(bookmarksToolbar, 1000, true)
.waitForElementCount(bookmarksToolbar, 0)
})
})

Expand All @@ -52,7 +52,7 @@ describe('bookmarksToolbar', function () {
it('shows a context menu', function * () {
yield this.app.client
.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true)
.waitForVisible(bookmarksToolbar, 1000)
.waitForVisible(bookmarksToolbar)
.addSite({
customTitle: 'demo1',
folderId: Math.random(),
Expand All @@ -65,7 +65,7 @@ describe('bookmarksToolbar', function () {
})
})
.click('.bookmarkToolbarButton[title=demo1]')
.waitForVisible('.contextMenuItemText[data-l10n-id=emptyFolderItem]', 1000)
.waitForVisible('.contextMenuItemText[data-l10n-id=emptyFolderItem]')
})

it('automatically opens context menu if you move mouse over a different folder', function * () {
Expand All @@ -76,7 +76,7 @@ describe('bookmarksToolbar', function () {

yield this.app.client
.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true)
.waitForVisible(bookmarksToolbar, 1000)
.waitForVisible(bookmarksToolbar)
.addSite({
customTitle: 'demo1',
folderId: folderId1,
Expand All @@ -102,11 +102,13 @@ describe('bookmarksToolbar', function () {
.waitForUrl(Brave.newTabUrl)
.loadUrl(this.page1Url)
.windowParentByUrl(this.page1Url)
.waitForSiteEntry(this.page1Url)
.waitForVisible(navigator)
.moveToObject(navigator)
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForEnabled(doneButton)
.selectByValue('#bookmarkParentFolder select', folderId2)
.click(doneButton)
.click('.bookmarkToolbarButton[title=demo1]')
Expand All @@ -118,10 +120,9 @@ describe('bookmarksToolbar', function () {

it('hides context menu when mousing over regular bookmark', function * () {
this.page1Url = Brave.server.url('page1.html')

yield this.app.client
.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true)
.waitForVisible(bookmarksToolbar, 1000)
.waitForVisible(bookmarksToolbar)
.addSite({
customTitle: 'demo1',
folderId: Math.random(),
Expand All @@ -136,18 +137,20 @@ describe('bookmarksToolbar', function () {
.waitForUrl(Brave.newTabUrl)
.loadUrl(this.page1Url)
.windowParentByUrl(this.page1Url)
.waitForSiteEntry(this.page1Url)
.waitForVisible(navigator)
.moveToObject(navigator)
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForEnabled(doneButton)
.setValue('#bookmarkName input', 'test1')
.click(doneButton)
.waitForVisible('.bookmarkToolbarButton[title^=test1]')
.click('.bookmarkToolbarButton[title=demo1]')
.waitForVisible('.contextMenuItemText[data-l10n-id=emptyFolderItem]', 1000)
.waitForVisible('.contextMenuItemText[data-l10n-id=emptyFolderItem]')
.moveToObject('.bookmarkToolbarButton[title^=test1]')
.waitForVisible('.contextMenuItemText', 1000, true)
.waitForElementCount('.contextMenuItemText', 0)
})
})

Expand All @@ -167,11 +170,13 @@ describe('bookmarksToolbar', function () {
.waitForUrl(Brave.newTabUrl)
.loadUrl(pageWithFavicon)
.windowParentByUrl(pageWithFavicon)
.waitForSiteEntry(pageWithFavicon)
.waitForVisible(navigator)
.moveToObject(navigator)
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForEnabled(doneButton)
.click(doneButton)

yield this.app.client.waitUntil(() =>
Expand All @@ -190,11 +195,13 @@ describe('bookmarksToolbar', function () {
.waitForUrl(Brave.newTabUrl)
.loadUrl(pageWithoutFavicon)
.windowParentByUrl(pageWithoutFavicon)
.waitForSiteEntry(pageWithoutFavicon)
.waitForVisible(navigator)
.moveToObject(navigator)
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForEnabled(doneButton)
.click(doneButton)

yield this.app.client.waitUntil(() =>
Expand Down

0 comments on commit 361e09b

Please sign in to comment.