Skip to content

Commit

Permalink
Test fixes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Apr 4, 2017
1 parent 2487e98 commit 4e6b55a
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 15 deletions.
97 changes: 84 additions & 13 deletions test/about/bookmarksManagerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {urlInput} = require('../lib/selectors')
const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil')
const siteTags = require('../../js/constants/siteTags')
const aboutBookmarksUrl = getTargetAboutUrl('about:bookmarks')
const Immutable = require('immutable')

describe('about:bookmarks', function () {
const folderId = Math.random()
Expand All @@ -24,29 +25,99 @@ describe('about:bookmarks', function () {
const siteWithFavicon = Brave.server.url('favicon.html')
const favicon = Brave.server.url('img/test.ico')
const siteWithoutFavicon = Brave.server.url('page_favicon_not_found.html')
const sites = Immutable.fromJS([
{
location: siteWithFavicon,
title: 'Page with Favicon',
favicon: favicon,
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: siteWithoutFavicon,
title: 'Page without Favicon',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
}
])
yield client
.addSite({ location: siteWithFavicon, title: 'Page with Favicon', favicon: favicon, tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: siteWithoutFavicon, title: 'Page without Favicon', tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSiteList(sites)
.tabByIndex(0)
.loadUrl(aboutBookmarksUrl)
}

function * addDemoSites (client) {
yield client
.waitForBrowserWindow()
.addSite({
const sites = Immutable.fromJS([
{
customTitle: 'demo1',
folderId: folderId,
parentFolderId: 0,
tags: [siteTags.BOOKMARK_FOLDER]
}, siteTags.BOOKMARK_FOLDER)
.addSite({ location: 'https://brave.com', title: 'Brave', tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://brave.com/test', title: 'Test', customTitle: 'customTest', tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://www.youtube.com', tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://www.facebook.com', title: 'facebook', tags: bookmarkTag, parentFolderId: 0, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://duckduckgo.com', title: 'duckduckgo', tags: bookmarkTag, parentFolderId: folderId, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://google.com', title: 'Google', tags: bookmarkTag, parentFolderId: folderId, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
.addSite({ location: 'https://bing.com', title: 'Bing', tags: bookmarkTag, parentFolderId: folderId, lastAccessedTime: lastVisit }, siteTags.BOOKMARK)
},
{
location: 'https://brave.com',
title: 'Brave',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: 'https://brave.com/test',
title: 'Test',
customTitle: 'customTest',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: 'https://brave.com/test',
title: 'Test',
customTitle: 'customTest',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: 'https://www.youtube.com',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: 'https://www.facebook.com',
title: 'facebook',
tags: bookmarkTag,
parentFolderId: 0,
lastAccessedTime: lastVisit
},
{
location: 'https://duckduckgo.com',
title: 'duckduckgo',
tags: bookmarkTag,
parentFolderId: folderId,
lastAccessedTime: lastVisit
},
{
location: 'https://google.com',
title: 'Google',
tags: bookmarkTag,
parentFolderId: folderId,
lastAccessedTime: lastVisit
},
{
location: 'https://bing.com',
title: 'Bing',
tags: bookmarkTag,
parentFolderId: folderId,
lastAccessedTime: lastVisit
}
])

yield client
.waitForBrowserWindow()
.addSiteList(sites)
.tabByIndex(0)
.loadUrl(aboutBookmarksUrl)
}
Expand Down
5 changes: 3 additions & 2 deletions test/bookmark-components/bookmarksTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('bookmark tests', function () {
})
it('removes the bookmark from the toolbar', function * () {
yield this.app.client
.waitForElementCount('[data-test-id="bookmarkText"]', 0)
.waitForExist('[data-test-id="bookmarkText"]', Brave.defaultTimeout, true)
})
})
})
Expand Down Expand Up @@ -247,11 +247,12 @@ describe('bookmark tests', function () {
const page1Url = Brave.server.url('img/test.pdf')
yield this.app.client
.windowParentByUrl(page1Url)
.windowByUrl(page1Url)
.activateURLMode()
.waitForVisible(navigatorNotBookmarked)
.click(navigatorNotBookmarked)
.waitForVisible(doneButton)
.waitForBookmarkDetail(page1Url, 'test.pdf')
.waitForBookmarkDetail(page1Url, 'test.ico - test.pdf')
.waitForEnabled(doneButton)
.click(doneButton)
.activateURLMode()
Expand Down

0 comments on commit 4e6b55a

Please sign in to comment.