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

Commit

Permalink
Add tests for hamburgerMenu's appearance
Browse files Browse the repository at this point in the history
The added tests test that the hamburgerMenu's context menu appears,
disappears, reappears on different clicks
  • Loading branch information
Hapcy authored and bsclifton committed Jan 25, 2017
1 parent 3a9da72 commit 95f4a01
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
51 changes: 51 additions & 0 deletions test/components/tabsToolbarTest.js
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)
})
})
})
5 changes: 4 additions & 1 deletion test/lib/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,8 @@ module.exports = {
allowRunInsecureContentButton: '.allowRunInsecureContentButton',
dismissAllowRunInsecureContentButton: '.dismissAllowRunInsecureContentButton',
denyRunInsecureContentButton: '.denyRunInsecureContentButton',
dismissDenyRunInsecureContentButton: '.dismissDenyRunInsecureContentButton'
dismissDenyRunInsecureContentButton: '.dismissDenyRunInsecureContentButton',
tabsToolbar: '.tabsToolbar',
hamburgerMenu: '.menuButton',
contextMenu: '.contextMenu'
}

0 comments on commit 95f4a01

Please sign in to comment.