From 4380a8d0083a89bc1e05f6c268036b97e44e31be Mon Sep 17 00:00:00 2001 From: Oliver Byford Date: Thu, 2 Jan 2020 14:07:34 +0000 Subject: [PATCH] Dismiss open autocompletes between tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clearing the value doesn’t seem to work reliably when the autocomplete is currently open, especially if it has been interacted with (e.g. in a test that sends the arrow down key to focus on a result) By sending ‘escape’ we dismiss any open autocompletes, which then seems to make the input-clearing work reliably. --- test/integration/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/index.js b/test/integration/index.js index bff7c4e3..30e27918 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -19,7 +19,11 @@ const basicExample = () => { const secondOption = `${menu} > li:nth-child(2)` beforeEach(() => { - browser.setValue(input, '') // Prevent autofilling, IE likes to do this. + // Dismiss any open autocompletes + browser.addValue(input, ['Escape']) + + // Prevent autofilling, IE likes to do this. + browser.setValue(input, '') }) it('should show the input', () => {