-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathtest_persistence.py
691 lines (551 loc) · 22.2 KB
/
test_persistence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
from multiprocessing import Value
import pytest
import time
from selenium.webdriver.common.keys import Keys
import dash
from dash.dependencies import Input, Output, State, MATCH
import dash_core_components as dcc
import dash_html_components as html
import dash_table as dt
from datetime import datetime
from datetime import timedelta as td
from selenium.webdriver.common.action_chains import ActionChains
@pytest.fixture(autouse=True)
def clear_storage(dash_duo):
yield
dash_duo.clear_storage()
def table_columns(names, **extra_props):
return [
dict(id="c{}".format(i), name=n, renamable=True, hideable=True, **extra_props)
for i, n in enumerate(names)
]
def simple_table(names=("a", "b"), **props_override):
props = dict(
id="table",
columns=table_columns(names),
data=[{"c0": 0, "c1": 1}, {"c0": 2, "c1": 3}],
persistence=True,
)
props.update(props_override)
return dt.DataTable(**props)
def reloadable_app(**props_override):
app = dash.Dash(__name__)
app.persistence = Value("i", 1)
def layout():
return html.Div(
[
html.Div(id="out"),
simple_table(persistence=app.persistence.value, **props_override),
]
)
app.layout = layout
@app.callback(
Output("out", "children"),
[Input("table", "columns"), Input("table", "hidden_columns")],
)
def report_props(columns, hidden_columns):
return "names: [{}]; hidden: [{}]".format(
", ".join([col["name"] for col in columns]), ", ".join(hidden_columns or [])
)
return app
NEW_NAME = "mango"
def rename_and_hide(dash_duo, rename=0, new_name=NEW_NAME, hide=1):
dash_duo.find_element(
".dash-header.column-{} .column-header--edit".format(rename)
).click()
prompt = dash_duo.driver.switch_to.alert
prompt.send_keys(new_name)
prompt.accept()
dash_duo.find_element(
".dash-header.column-{} .column-header--hide".format(hide)
).click()
def check_table_names(dash_duo, names, table_id="table"):
dash_duo.wait_for_text_to_equal(
"#{} .column-0 .column-header-name".format(table_id), names[0]
)
headers = dash_duo.find_elements("#{} .column-header-name".format(table_id))
assert len(headers) == len(names)
for i, n in enumerate(names):
name_el = dash_duo.find_element(
"#{} .column-{} .column-header-name".format(table_id, i)
)
assert name_el.text == n
def test_rdps001_local_reload(dash_duo):
app = reloadable_app()
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#out", "names: [a, b]; hidden: []")
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
# callback output
dash_duo.wait_for_text_to_equal(
"#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.wait_for_page()
# callback gets persisted values, not the values provided with the layout
dash_duo.wait_for_text_to_equal(
"#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
)
check_table_names(dash_duo, [NEW_NAME])
# new persistence reverts
app.persistence.value = 2
dash_duo.wait_for_page()
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo, 1, "two", 0)
dash_duo.wait_for_text_to_equal("#out", "names: [a, two]; hidden: [c0]")
check_table_names(dash_duo, ["two"])
# put back the old persistence, get the old values
app.persistence.value = 1
dash_duo.wait_for_page()
dash_duo.wait_for_text_to_equal(
"#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
)
check_table_names(dash_duo, [NEW_NAME])
# falsy persistence disables it
app.persistence.value = 0
dash_duo.wait_for_page()
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.wait_for_page()
check_table_names(dash_duo, ["a", "b"])
# falsy to previous truthy also brings the values
app.persistence.value = 2
dash_duo.wait_for_page()
dash_duo.wait_for_text_to_equal("#out", "names: [a, two]; hidden: [c0]")
check_table_names(dash_duo, ["two"])
def test_rdps002_session_reload(dash_duo):
app = reloadable_app(persistence_type="session")
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.wait_for_page()
# callback gets persisted values, not the values provided with the layout
dash_duo.wait_for_text_to_equal(
"#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
)
check_table_names(dash_duo, [NEW_NAME])
def test_rdps003_memory_reload(dash_duo):
app = reloadable_app(persistence_type="memory")
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.wait_for_page()
# no persistence after reload with persistence_type=memory
check_table_names(dash_duo, ["a", "b"])
def test_rdps004_show_hide(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("Show/Hide", id="toggle-table"), html.Div(id="container")]
)
@app.callback(Output("container", "children"), [Input("toggle-table", "n_clicks")])
def toggle_table(n):
if (n or 0) % 2:
return "nope"
return simple_table(
persistence_type="memory", persistence=1 if (n or 0) < 3 else 2
)
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.find_element("#toggle-table").click()
# table is gone
dash_duo.wait_for_text_to_equal("#container", "nope")
dash_duo.find_element("#toggle-table").click()
# table is back, with persisted props
check_table_names(dash_duo, [NEW_NAME])
dash_duo.find_element("#toggle-table").click()
# gone again
dash_duo.wait_for_text_to_equal("#container", "nope")
dash_duo.find_element("#toggle-table").click()
# table is back, new persistence val so props not persisted
check_table_names(dash_duo, ["a", "b"])
def test_rdps005_persisted_props(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.Button("toggle persisted_props", id="toggle-table"),
html.Div(id="container"),
]
)
@app.callback(Output("container", "children"), [Input("toggle-table", "n_clicks")])
def toggle_table(n):
if (n or 0) % 2:
return simple_table(persisted_props=["data", "columns.name"])
return simple_table()
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.find_element("#toggle-table").click()
# hidden_columns not persisted
check_table_names(dash_duo, [NEW_NAME, "b"])
dash_duo.find_element("#toggle-table").click()
# back to original persisted_props hidden_columns returns
check_table_names(dash_duo, [NEW_NAME])
def test_rdps006_move_on_page(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("move table", id="move-table"), html.Div(id="container")]
)
@app.callback(Output("container", "children"), [Input("move-table", "n_clicks")])
def move_table(n):
children = [html.Div("div 0", id="div0"), simple_table()]
for i in range(1, (n or 0) + 1):
children = [
html.Div("div {}".format(i), id="div{}".format(i)),
html.Div(children),
]
return children
def find_last_div(n):
dash_duo.wait_for_text_to_equal("#div{}".format(n), "div {}".format(n))
assert len(dash_duo.find_elements("#div{}".format(n + 1))) == 0
dash_duo.start_server(app)
find_last_div(0)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
for i in range(1, 5):
dash_duo.find_element("#move-table").click()
find_last_div(i)
check_table_names(dash_duo, [NEW_NAME])
def test_rdps007_one_prop_changed(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("hide/show cols", id="hide-cols"), html.Div(id="container")]
)
@app.callback(Output("container", "children"), [Input("hide-cols", "n_clicks")])
def hide_cols(n):
return simple_table(hidden_columns=["c0"] if (n or 0) % 2 else [])
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.find_element("#hide-cols").click()
# hidden_columns gets the new value
check_table_names(dash_duo, ["b"])
dash_duo.find_element("#hide-cols").click()
# back to original hidden_columns, but saved value won't come back
check_table_names(dash_duo, [NEW_NAME, "b"])
def test_rdps008_unsaved_part_changed(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("toggle deletable", id="deletable"), html.Div(id="container")]
)
@app.callback(Output("container", "children"), [Input("deletable", "n_clicks")])
def toggle_deletable(n):
if (n or 0) % 2:
return simple_table(columns=table_columns(("a", "b"), deletable=True))
return simple_table()
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
assert len(dash_duo.find_elements(".column-header--delete")) == 0
dash_duo.find_element("#deletable").click()
# column names still persisted when columns.deletable changed
# because extracted name list didn't change
check_table_names(dash_duo, [NEW_NAME])
assert len(dash_duo.find_elements(".column-header--delete")) == 1
dash_duo.find_element("#deletable").click()
check_table_names(dash_duo, [NEW_NAME])
assert len(dash_duo.find_elements(".column-header--delete")) == 0
def test_rdps009_clear_prop_callback(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("reset name edits", id="reset-names"), simple_table()]
)
@app.callback(Output("table", "columns"), [Input("reset-names", "n_clicks")])
def reset_names(n):
# callbacks that return the actual persisted prop, as opposed to
# the whole component containing them, always clear persistence, even
# if the value is identical to the original. no_update can prevent this.
# if we had multiple inputs, would need to check triggered
return table_columns(("a", "b")) if n else dash.no_update
dash_duo.start_server(app)
check_table_names(dash_duo, ["a", "b"])
rename_and_hide(dash_duo)
check_table_names(dash_duo, [NEW_NAME])
dash_duo.find_element("#reset-names").click()
# names are reset, but not hidden_columns
check_table_names(dash_duo, ["a"])
def test_rdps010_toggle_persistence(dash_duo):
def make_input(persistence):
return dcc.Input(id="persisted", value="a", persistence=persistence)
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="persistence-val", value=""),
html.Div(make_input(""), id="persisted-container"),
html.Div(id="out"),
]
)
@app.callback(
Output("persisted-container", "children"), [Input("persistence-val", "value")]
)
def set_persistence(val):
return make_input(val)
@app.callback(Output("out", "children"), [Input("persisted", "value")])
def set_out(val):
return val
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persisted").send_keys("lpaca")
dash_duo.wait_for_text_to_equal("#out", "alpaca")
dash_duo.find_element("#persistence-val").send_keys("s")
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persisted").send_keys("nchovies")
dash_duo.wait_for_text_to_equal("#out", "anchovies")
dash_duo.find_element("#persistence-val").send_keys("2")
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persisted").send_keys(
Keys.BACK_SPACE
) # persist falsy value
dash_duo.wait_for_text_to_equal("#out", "")
# alpaca not saved with falsy persistence
dash_duo.clear_input("#persistence-val")
dash_duo.wait_for_text_to_equal("#out", "a")
# anchovies and aardvark saved
dash_duo.find_element("#persistence-val").send_keys("s")
dash_duo.wait_for_text_to_equal("#out", "anchovies")
dash_duo.find_element("#persistence-val").send_keys("2")
dash_duo.wait_for_text_to_equal("#out", "")
def test_rdps011_toggle_persistence2(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="persistence-val", value=""),
dcc.Input(id="persisted2", value="a", persistence=""),
html.Div(id="out"),
]
)
# this is not a good way to set persistence, as it doesn't allow you to
# get the right initial value. Much better is to update the whole component
# as we do in the previous test case... but it shouldn't break this way.
@app.callback(
Output("persisted2", "persistence"), [Input("persistence-val", "value")]
)
def set_persistence(val):
return val
@app.callback(Output("out", "children"), [Input("persisted2", "value")])
def set_out(val):
return val
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persistence-val").send_keys("s")
time.sleep(0.2)
assert not dash_duo.get_logs()
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persisted2").send_keys("pricot")
dash_duo.wait_for_text_to_equal("#out", "apricot")
dash_duo.find_element("#persistence-val").send_keys("2")
dash_duo.wait_for_text_to_equal("#out", "a")
dash_duo.find_element("#persisted2").send_keys("rtichoke")
dash_duo.wait_for_text_to_equal("#out", "artichoke")
# no persistence, still goes back to original value
dash_duo.clear_input("#persistence-val")
dash_duo.wait_for_text_to_equal("#out", "a")
# apricot and artichoke saved
dash_duo.find_element("#persistence-val").send_keys("s")
dash_duo.wait_for_text_to_equal("#out", "apricot")
dash_duo.find_element("#persistence-val").send_keys("2")
assert not dash_duo.get_logs()
dash_duo.wait_for_text_to_equal("#out", "artichoke")
def test_rdps012_pattern_matching(dash_duo):
# copy of rdps010 but with dict IDs,
# plus a button to change the dict ID so the persistence should reset
def make_input(persistence, n):
return dcc.Input(
id={"i": n, "id": "persisted"},
className="persisted",
value="a",
persistence=persistence,
)
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("click", id="btn", n_clicks=0), html.Div(id="content")]
)
@app.callback(Output("content", "children"), [Input("btn", "n_clicks")])
def content(n):
return [
dcc.Input(
id={"i": n, "id": "persistence-val"},
value="",
className="persistence-val",
),
html.Div(make_input("", n), id={"i": n, "id": "persisted-container"}),
html.Div(id={"i": n, "id": "out"}, className="out"),
]
@app.callback(
Output({"i": MATCH, "id": "persisted-container"}, "children"),
[Input({"i": MATCH, "id": "persistence-val"}, "value")],
[State("btn", "n_clicks")],
)
def set_persistence(val, n):
return make_input(val, n)
@app.callback(
Output({"i": MATCH, "id": "out"}, "children"),
[Input({"i": MATCH, "id": "persisted"}, "value")],
)
def set_out(val):
return val
dash_duo.start_server(app)
for _ in range(3):
dash_duo.wait_for_text_to_equal(".out", "a")
dash_duo.find_element(".persisted").send_keys("lpaca")
dash_duo.wait_for_text_to_equal(".out", "alpaca")
dash_duo.find_element(".persistence-val").send_keys("s")
dash_duo.wait_for_text_to_equal(".out", "a")
dash_duo.find_element(".persisted").send_keys("nchovies")
dash_duo.wait_for_text_to_equal(".out", "anchovies")
dash_duo.find_element(".persistence-val").send_keys("2")
dash_duo.wait_for_text_to_equal(".out", "a")
dash_duo.find_element(".persisted").send_keys(
Keys.BACK_SPACE
) # persist falsy value
dash_duo.wait_for_text_to_equal(".out", "")
# alpaca not saved with falsy persistence
dash_duo.clear_input(".persistence-val")
dash_duo.wait_for_text_to_equal(".out", "a")
# anchovies and aardvark saved
dash_duo.find_element(".persistence-val").send_keys("s")
dash_duo.wait_for_text_to_equal(".out", "anchovies")
dash_duo.find_element(".persistence-val").send_keys("2")
dash_duo.wait_for_text_to_equal(".out", "")
dash_duo.find_element("#btn").click()
def test_rdps013_persisted_dps(dash_duo):
def send_date_dps(target, date):
(
ActionChains(dash_duo.driver)
.move_to_element(target)
.pause(0.2)
.click(target)
.send_keys(Keys.END)
.key_down(Keys.SHIFT)
.send_keys(Keys.HOME)
.key_up(Keys.SHIFT)
.send_keys(Keys.DELETE)
.send_keys(str(date))
.send_keys(Keys.ENTER)
).perform()
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.Button("fire callback", id="btn"),
html.Div(
children=[
dcc.DatePickerSingle(
id="dps1",
date=datetime.today(),
persistence=True,
persistence_type="session",
),
html.P("dps1", id="dps1-p"),
html.Div(id="container"),
html.P("dps2", id="dps2-p"),
]
),
]
)
@app.callback(Output("container", "children"), [Input("btn", "n_clicks")])
def update_output(value):
return dcc.DatePickerSingle(
id="dps2",
date=datetime.today(),
persistence=True,
persistence_type="session",
)
@app.callback(Output("dps1-p", "children"), [Input("dps1", "date")])
def display_dps1(value):
return value
@app.callback(Output("dps2-p", "children"), [Input("dps2", "date")])
def display_dps2(value):
return value
dash_duo.start_server(app)
dps1 = dash_duo.find_element("#dps1")
dps2 = dash_duo.find_element("#dps2")
send_date_dps(dps1, "01/01/2020")
dash_duo.wait_for_text_to_equal("#dps1-p", "2020-01-01")
send_date_dps(dps2, "01/01/2020")
dash_duo.wait_for_text_to_equal("#dps2-p", "2020-01-01")
dash_duo.find_element("#btn").click()
dash_duo.wait_for_text_to_equal("#dps1-p", "2020-01-01")
dash_duo.wait_for_text_to_equal("#dps2-p", "2020-01-01")
def test_rdps014_persisted_dpr(dash_duo):
def send_date_dpr(target, start_date, end_date):
(
ActionChains(dash_duo.driver)
.move_to_element(target)
.click(target)
.send_keys(Keys.END)
.key_down(Keys.SHIFT)
.send_keys(Keys.HOME)
.key_up(Keys.SHIFT)
.send_keys(str(start_date))
.pause(0.2)
.send_keys(Keys.END)
.key_down(Keys.SHIFT)
.send_keys(Keys.HOME)
.key_up(Keys.SHIFT)
.send_keys(str(end_date))
).perform()
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.Button("fire callback", id="btn"),
html.Div(
children=[
dcc.DatePickerRange(
id="dpr1",
start_date=datetime.today() - td(days=3),
end_date=datetime.today(),
persistence=True,
persistence_type="session",
),
html.P("dpr1", id="dpr1-p-start"),
html.P("dpr1", id="dpr1-p-end"),
html.Div(id="container"),
html.P("dpr2", id="dpr2-p-start"),
html.P("dpr2", id="dpr2-p-end"),
]
),
]
)
@app.callback(Output("container", "children"), [Input("btn", "n_clicks")])
def update_output(value):
return dcc.DatePickerRange(
id="dpr2",
start_date=datetime.today() - td(days=3),
end_date=datetime.today(),
persistence=True,
persistence_type="session",
)
@app.callback(Output("dpr1-p-start", "children"), [Input("dpr1", "start_date")])
def display_dps1(value):
return value
@app.callback(Output("dpr1-p-end", "children"), [Input("dpr1", "end_date")])
def display_dps1(value):
return value
@app.callback(Output("dpr2-p-start", "children"), [Input("dpr2", "start_date")])
def display_dps2(value):
return value
@app.callback(Output("dpr2-p-end", "children"), [Input("dpr2", "end_date")])
def display_dps2(value):
return value
dash_duo.start_server(app)
dpr1 = dash_duo.find_element("div#dpr1 div div div div .DateInput_input")
dpr2 = dash_duo.find_element("div#dpr2 div div div div .DateInput_input")
send_date_dpr(dpr1, "01/01/2020", "01/02/2020")
dash_duo.wait_for_text_to_equal("#dpr1-p-start", "2020-01-01")
dash_duo.wait_for_text_to_equal("#dpr1-p-end", "2020-01-02")
send_date_dpr(dpr2, "01/01/2020", "01/02/2020")
dash_duo.wait_for_text_to_equal("#dpr2-p-start", "2020-01-01")
dash_duo.wait_for_text_to_equal("#dpr2-p-end", "2020-01-02")
dash_duo.find_element("#btn").click()
dash_duo.wait_for_text_to_equal("#dpr1-p-start", "2020-01-01")
dash_duo.wait_for_text_to_equal("#dpr1-p-end", "2020-01-02")
dash_duo.wait_for_text_to_equal("#dpr2-p-start", "2020-01-01")
dash_duo.wait_for_text_to_equal("#dpr2-p-end", "2020-01-02")