Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 8c6f735

Browse files
test cleanup
1 parent 2697a70 commit 8c6f735

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/integration/clipboard/test_clipboard.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@ def test_clp001_clipboard_text(dash_dcc_headed):
1414
app = dash.Dash(__name__, prevent_initial_callbacks=True)
1515
app.layout = html.Div(
1616
[
17-
html.Div(copy_text, id="copy1"),
18-
dcc.Clipboard(id="copy_icon1", target_id="copy1"),
19-
dcc.Textarea(id="paste1"),
17+
html.Div(copy_text, id="copy"),
18+
dcc.Clipboard(id="copy_icon", target_id="copy"),
19+
dcc.Textarea(id="paste"),
2020
]
2121
)
2222
dash_dcc_headed.start_server(app)
23-
dash_dcc_headed.driver.execute_script("navigator.clipboard.writeText('')")
2423

25-
dash_dcc_headed.find_element("#copy_icon1").click()
26-
time.sleep(2)
27-
dash_dcc_headed.find_element("#paste1").click()
24+
dash_dcc_headed.find_element("#copy_icon").click()
25+
# time.sleep(2)
26+
dash_dcc_headed.find_element("#paste").click()
2827
ActionChains(dash_dcc_headed.driver).key_down(Keys.CONTROL).send_keys("v").key_up(
2928
Keys.CONTROL
3029
).perform()
3130

3231
wait.until(
33-
lambda: dash_dcc_headed.find_element("#paste1").get_attribute("value")
32+
lambda: dash_dcc_headed.find_element("#paste").get_attribute("value")
3433
== copy_text,
3534
timeout=3,
3635
)
@@ -40,20 +39,19 @@ def test_clp002_clipboard_text(dash_dcc_headed):
4039
copy_text = "Copy this text to the clipboard"
4140
app = dash.Dash(__name__, prevent_initial_callbacks=True)
4241
app.layout = html.Div(
43-
[dcc.Clipboard(id="copy_icon2", text=copy_text), dcc.Textarea(id="paste2")]
42+
[dcc.Clipboard(id="copy_icon", text=copy_text), dcc.Textarea(id="paste")]
4443
)
4544
dash_dcc_headed.start_server(app)
46-
dash_dcc_headed.driver.execute_script("navigator.clipboard.writeText('')")
4745

48-
dash_dcc_headed.find_element("#copy_icon2").click()
49-
time.sleep(2)
50-
dash_dcc_headed.find_element("#paste2").click()
46+
dash_dcc_headed.find_element("#copy_icon").click()
47+
time.sleep(1)
48+
dash_dcc_headed.find_element("#paste").click()
5149
ActionChains(dash_dcc_headed.driver).key_down(Keys.CONTROL).send_keys("v").key_up(
5250
Keys.CONTROL
5351
).perform()
5452

5553
wait.until(
56-
lambda: dash_dcc_headed.find_element("#paste2").get_attribute("value")
54+
lambda: dash_dcc_headed.find_element("#paste").get_attribute("value")
5755
== copy_text,
5856
timeout=3,
5957
)

0 commit comments

Comments
 (0)