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 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for hamburgerMenu's appearance
The added tests test that the hamburgerMenu's context menu appears, disappears, reappears on different clicks
- Loading branch information
Showing
2 changed files
with
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* global describe, it, before, beforeEach */ | ||
|
||
const Brave = require('../lib/brave') | ||
const { hamburgerMenu, tabsToolbar, contextMenu } = require('../lib/selectors') | ||
|
||
describe('tabs toolbar tests', function () { | ||
function * setup (client) { | ||
yield client | ||
.waitForUrl(Brave.newTabUrl) | ||
.waitForBrowserWindow() | ||
.waitForVisible(tabsToolbar) | ||
} | ||
|
||
describe('hamburgerMenu\'s contextMenu appearance test', function () { | ||
Brave.beforeAll(this) | ||
before(function* () { | ||
yield setup(this.app.client) | ||
}) | ||
|
||
beforeEach(function* () { | ||
yield this.app.client | ||
.click(tabsToolbar) | ||
}) | ||
|
||
it('shows when clicked', function * () { | ||
yield this.app.client | ||
.click(hamburgerMenu) | ||
.waitForExist(contextMenu) | ||
}) | ||
|
||
it('disappears when clicked twice', function * () { | ||
yield this.app.client | ||
.click(hamburgerMenu) | ||
.waitForExist(contextMenu) | ||
.click(hamburgerMenu) | ||
// The third parameter reverses the functionality of waitForExist, meaning it will wait for it to not exist | ||
.waitForExist(contextMenu, null, true) | ||
.then(() => true) | ||
}) | ||
|
||
it('reappears when clicked again', function * () { | ||
yield this.app.client | ||
.click(hamburgerMenu) | ||
.waitForExist(contextMenu) | ||
.click(tabsToolbar) | ||
.waitForExist(contextMenu, null, true) | ||
.click(hamburgerMenu) | ||
.waitForExist(contextMenu) | ||
}) | ||
}) | ||
}) |
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