Skip to content

Commit

Permalink
fix(argos-ci): blur the active element
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jun 20, 2017
1 parent 9d1ced2 commit 66d0551
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functional-tests/test.js
@@ -1,5 +1,5 @@
import expect from 'expect';
import {searchBox} from './utils.js';
import {searchBox, prepareScreenshot} from './utils.js';

describe('searchBox', () => {
describe('when there is no query', () => {
Expand All @@ -9,6 +9,7 @@ describe('searchBox', () => {

it('triggers an empty search', () => {
expect(browser.getText('#hits')).toNotContain('MP3');
prepareScreenshot();
browser.checkDocument({
hide: ['.ais-stats--body'], // Flaky X ms information.
});
Expand All @@ -22,6 +23,7 @@ describe('searchBox', () => {

it('triggers a new search', () => {
expect(browser.getText('#hits')).toContain('MP3');
prepareScreenshot();
browser.checkDocument({
hide: ['.ais-stats--body'], // Flaky X ms information.
});
Expand Down
11 changes: 11 additions & 0 deletions functional-tests/utils.js
Expand Up @@ -16,3 +16,14 @@ export const searchBox = {
return browser.getValue('#search-box');
},
};

function blurAll() {
if ('activeElement' in document) {
document.activeElement.blur();
}
}

export function prepareScreenshot() {
// The focus bar visibility is flaky.
return browser.execute(blurAll);
}

0 comments on commit 66d0551

Please sign in to comment.