From 67f3611ae2c05c7a69fda2de33c2a10229ef81d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=20Sepp=C3=A4nen?= Date: Sat, 10 Nov 2018 18:33:20 +0200 Subject: [PATCH] Fix the test on CircleCI by using keystrokes For whatever reason, input1.clear() didn't clear the input field on CircleCI although it was fine when running tests locally. --- tests/test_integration.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index 7a4944a328..d8af73a978 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -9,6 +9,8 @@ import dash_core_components as dcc import dash_flow_example +from selenium.webdriver.common.action_chains import ActionChains +from selenium.webdriver.common.keys import Keys import dash from dash.dependencies import Input, Output, State @@ -576,15 +578,20 @@ def update_output(value): self.startServer(app) output1 = self.wait_for_text_to_equal('#output', 'initial value') - input1 = self.wait_for_element_by_id('input') - input1.clear() + + chain = (ActionChains(self.driver) + .click(input1) + .send_keys(Keys.HOME) + .key_down(Keys.SHIFT) + .send_keys(Keys.END) + .key_up(Keys.SHIFT) + .send_keys(Keys.DELETE)) + chain.perform() input1.send_keys('Hello World') output1 = self.wait_for_text_to_equal('#output', 'Hello World') - - cookie = [cookie for cookie in self.driver.get_cookies() - if cookie['name'] == 'dash cookie'][0] + cookie = self.driver.get_cookie('dash cookie') self.assertEqual(cookie['value'], '"Hello World"') # gets json encoded assert_clean_console(self)