This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 974
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
default bookmark title to the url if no title is present
fixes #3344
- Loading branch information
Showing
2 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* global describe, it, before */ | ||
|
||
const Brave = require('../lib/brave') | ||
const {urlInput, navigator, navigatorNotBookmarked, saveButton} = require('../lib/selectors') | ||
|
||
describe('bookmarks', function () { | ||
function * setup (client) { | ||
yield client | ||
.waitUntilWindowLoaded() | ||
.waitForUrl(Brave.newTabUrl) | ||
.waitForBrowserWindow() | ||
.waitForVisible('#window') | ||
.waitForEnabled(urlInput) | ||
} | ||
|
||
describe('with title', function () { | ||
Brave.beforeAll(this) | ||
|
||
before(function * () { | ||
this.page1Url = Brave.server.url('page1.html') | ||
|
||
yield setup(this.app.client) | ||
|
||
yield this.app.client | ||
.waitForUrl(Brave.newTabUrl) | ||
.loadUrl(this.page1Url) | ||
.windowParentByUrl(this.page1Url) | ||
.moveToObject(navigator) | ||
.waitForExist(navigatorNotBookmarked) | ||
.moveToObject(navigator) | ||
.click(navigatorNotBookmarked) | ||
.waitForVisible(saveButton) | ||
}) | ||
|
||
it('fills in the title field', function * () { | ||
yield this.app.client | ||
.waitForExist('#bookmarkName input') | ||
.getValue('#bookmarkName input').should.eventually.be.equal('Page 1') | ||
}) | ||
|
||
it('fills in the url field', function * () { | ||
yield this.app.client | ||
.waitForExist('#bookmarkLocation input') | ||
.getValue('#bookmarkLocation input').should.eventually.be.equal(this.page1Url) | ||
}) | ||
}) | ||
|
||
describe('without title', function () { | ||
Brave.beforeAll(this) | ||
|
||
before(function * () { | ||
this.page1Url = Brave.server.url('page_no_title.html') | ||
|
||
yield setup(this.app.client) | ||
|
||
yield this.app.client | ||
.waitForUrl(Brave.newTabUrl) | ||
.loadUrl(this.page1Url) | ||
.windowParentByUrl(this.page1Url) | ||
.moveToObject(navigator) | ||
.waitForExist(navigatorNotBookmarked) | ||
.moveToObject(navigator) | ||
.click(navigatorNotBookmarked) | ||
.waitForVisible(saveButton) | ||
}) | ||
|
||
it('fills in the url for the title field', function * () { | ||
yield this.app.client | ||
.waitForExist('#bookmarkName input') | ||
.getValue('#bookmarkName input').should.eventually.be.equal(this.page1Url) | ||
}) | ||
|
||
it('fills in the url field', function * () { | ||
yield this.app.client | ||
.waitForExist('#bookmarkLocation input') | ||
.getValue('#bookmarkLocation input').should.eventually.be.equal(this.page1Url) | ||
}) | ||
}) | ||
}) |