diff --git a/functional-tests/test.js b/functional-tests/test.js index d6687ad4d7..d9cf522300 100644 --- a/functional-tests/test.js +++ b/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', () => { @@ -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. }); @@ -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. }); diff --git a/functional-tests/utils.js b/functional-tests/utils.js index 75e3e99ad5..d2e454de23 100644 --- a/functional-tests/utils.js +++ b/functional-tests/utils.js @@ -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); +}