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

Commit 2c01ab5

Browse files
author
Marc-André Rivet
committed
move row tests to selenium
1 parent 6685adc commit 2c01ab5

File tree

3 files changed

+102
-89
lines changed

3 files changed

+102
-89
lines changed

tests/cypress/tests/standalone/delete_row_test.ts

-25
This file was deleted.

tests/cypress/tests/standalone/select_row_column_test.ts

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,6 @@
11
import DashTable, { DashTableHelper } from 'cypress/DashTable';
22

3-
import { BasicModes, AppMode, AppFlavor } from 'demo/AppMode';
4-
5-
Object.values(BasicModes).forEach(mode => {
6-
describe(`select row, mode=${mode}`, () => {
7-
beforeEach(() => {
8-
cy.visit(`http://localhost:8080?mode=${mode}`);
9-
DashTable.toggleScroll(false);
10-
});
11-
12-
describe('fe pagination & sort', () => {
13-
it('can select row', () => {
14-
DashTable.getSelect(0).within(() => cy.get('input').click());
15-
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
16-
});
17-
18-
it('can select row when sorted', () => {
19-
cy.get('tr th.column-0:not(.phantom-cell) .column-header--sort').last().click({ force: true });
20-
DashTable.getSelect(0).within(() => cy.get('input').click());
21-
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
22-
});
23-
24-
it('select, sort, new row is not selected', () => {
25-
DashTable.getSelect(0).within(() => cy.get('input').click());
26-
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
27-
cy.get('tr th.column-0:not(.phantom-cell) .column-header--sort').last().click({ force: true }).click({ force: true });
28-
DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked'));
29-
});
30-
});
31-
});
32-
});
3+
import { AppMode, AppFlavor } from 'demo/AppMode';
334

345
describe('select rows & columns in multiple tables without id', () => {
356
let table1: DashTableHelper;

tests/selenium/test_basic_operations.py

+101-34
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
df = rawDf.to_dict("records")
1414

1515

16-
def get_app():
16+
def get_app(props=dict()):
1717
app = dash.Dash(__name__)
1818

19-
app.layout = DataTable(
19+
baseProps = dict(
2020
id="table",
2121
columns=[{"name": i, "id": i} for i in rawDf.columns],
2222
data=df,
@@ -30,11 +30,18 @@ def get_app():
3030
sort_action="native",
3131
)
3232

33+
baseProps.update(props)
34+
35+
app.layout = DataTable(**baseProps)
36+
3337
return app
3438

3539

36-
def test_tbst001_get_cell(test):
37-
test.start_server(get_app())
40+
@pytest.mark.parametrize(
41+
"props", [dict(virtualization=False), dict(virtualization=True)]
42+
)
43+
def test_tbst001_get_cell(test, props):
44+
test.start_server(get_app(props))
3845

3946
target = test.table("table")
4047

@@ -44,8 +51,11 @@ def test_tbst001_get_cell(test):
4451
assert test.get_log_errors() == []
4552

4653

47-
def test_tbst002_select_all_text(test):
48-
test.start_server(get_app())
54+
@pytest.mark.parametrize(
55+
"props", [dict(virtualization=False), dict(virtualization=True)]
56+
)
57+
def test_tbst002_select_all_text(test, props):
58+
test.start_server(get_app(props))
4959

5060
target = test.table("table")
5161

@@ -150,8 +160,11 @@ def test_tbst009_active_focused_arrow_down(test):
150160
assert test.get_log_errors() == []
151161

152162

153-
def test_tbst010_active_with_dblclick(test):
154-
test.start_server(get_app())
163+
@pytest.mark.parametrize(
164+
"props", [dict(virtualization=False), dict(virtualization=True)]
165+
)
166+
def test_tbst010_active_with_dblclick(test, props):
167+
test.start_server(get_app(props))
155168

156169
target = test.table("table")
157170

@@ -161,8 +174,11 @@ def test_tbst010_active_with_dblclick(test):
161174
assert test.get_log_errors() == []
162175

163176

164-
def test_tbst011_delete_row(test):
165-
test.start_server(get_app())
177+
@pytest.mark.parametrize(
178+
"props", [dict(virtualization=False), dict(virtualization=True)]
179+
)
180+
def test_tbst011_delete_row(test, props):
181+
test.start_server(get_app(props))
166182

167183
target = test.table("table")
168184

@@ -173,8 +189,11 @@ def test_tbst011_delete_row(test):
173189
assert test.get_log_errors() == []
174190

175191

176-
def test_tbst012_delete_sorted_row(test):
177-
test.start_server(get_app())
192+
@pytest.mark.parametrize(
193+
"props", [dict(virtualization=False), dict(virtualization=True)]
194+
)
195+
def test_tbst012_delete_sorted_row(test, props):
196+
test.start_server(get_app(props))
178197

179198
target = test.table("table")
180199

@@ -188,8 +207,16 @@ def test_tbst012_delete_sorted_row(test):
188207
assert test.get_log_errors() == []
189208

190209

191-
def test_tbst013_select_row(test):
192-
test.start_server(get_app())
210+
@pytest.mark.parametrize(
211+
"props",
212+
[
213+
dict(virtualization=False),
214+
dict(virtualization=True),
215+
dict(editable=False, row_deletable=False),
216+
],
217+
)
218+
def test_tbst013_select_row(test, props):
219+
test.start_server(get_app(props))
193220

194221
target = test.table("table")
195222

@@ -199,8 +226,16 @@ def test_tbst013_select_row(test):
199226
assert test.get_log_errors() == []
200227

201228

202-
def test_tbst014_selected_sorted_row(test):
203-
test.start_server(get_app())
229+
@pytest.mark.parametrize(
230+
"props",
231+
[
232+
dict(virtualization=False),
233+
dict(virtualization=True),
234+
dict(editable=False, row_deletable=False),
235+
],
236+
)
237+
def test_tbst014_selected_sorted_row(test, props):
238+
test.start_server(get_app(props))
204239

205240
target = test.table("table")
206241

@@ -212,8 +247,16 @@ def test_tbst014_selected_sorted_row(test):
212247
assert test.get_log_errors() == []
213248

214249

215-
def test_tbst015_selected_row_respects_sort(test):
216-
test.start_server(get_app())
250+
@pytest.mark.parametrize(
251+
"props",
252+
[
253+
dict(virtualization=False),
254+
dict(virtualization=True),
255+
dict(editable=False, row_deletable=False),
256+
],
257+
)
258+
def test_tbst015_selected_row_respects_sort(test, props):
259+
test.start_server(get_app(props))
217260

218261
target = test.table("table")
219262

@@ -232,8 +275,11 @@ def test_tbst015_selected_row_respects_sort(test):
232275
assert test.get_log_errors() == []
233276

234277

235-
def test_tbst016_delete_cell(test):
236-
test.start_server(get_app())
278+
@pytest.mark.parametrize(
279+
"props", [dict(virtualization=False), dict(virtualization=True)]
280+
)
281+
def test_tbst016_delete_cell(test, props):
282+
test.start_server(get_app(props))
237283

238284
target = test.table("table")
239285

@@ -246,8 +292,11 @@ def test_tbst016_delete_cell(test):
246292

247293

248294
@pytest.mark.skip(reason="https://github.com/plotly/dash-table/issues/700")
249-
def test_tbst017_delete_cell_updates_while_selected(test):
250-
test.start_server(get_app())
295+
@pytest.mark.parametrize(
296+
"props", [dict(virtualization=False), dict(virtualization=True)]
297+
)
298+
def test_tbst017_delete_cell_updates_while_selected(test, props):
299+
test.start_server(get_app(props))
251300

252301
target = test.table("table")
253302

@@ -258,8 +307,11 @@ def test_tbst017_delete_cell_updates_while_selected(test):
258307
assert test.get_log_errors() == []
259308

260309

261-
def test_tbst018_delete_multiple_cells(test):
262-
test.start_server(get_app())
310+
@pytest.mark.parametrize(
311+
"props", [dict(virtualization=False), dict(virtualization=True)]
312+
)
313+
def test_tbst018_delete_multiple_cells(test, props):
314+
test.start_server(get_app(props))
263315

264316
target = test.table("table")
265317

@@ -277,8 +329,11 @@ def test_tbst018_delete_multiple_cells(test):
277329

278330

279331
@pytest.mark.skip(reason="https://github.com/plotly/dash-table/issues/700")
280-
def test_tbst019_delete_multiple_cells_while_selected(test):
281-
test.start_server(get_app())
332+
@pytest.mark.parametrize(
333+
"props", [dict(virtualization=False), dict(virtualization=True)]
334+
)
335+
def test_tbst019_delete_multiple_cells_while_selected(test, props):
336+
test.start_server(get_app(props))
282337

283338
target = test.table("table")
284339

@@ -295,8 +350,11 @@ def test_tbst019_delete_multiple_cells_while_selected(test):
295350
assert test.get_log_errors() == []
296351

297352

298-
def test_tbst020_sorted_table_delete_cell(test):
299-
test.start_server(get_app())
353+
@pytest.mark.parametrize(
354+
"props", [dict(virtualization=False), dict(virtualization=True)]
355+
)
356+
def test_tbst020_sorted_table_delete_cell(test, props):
357+
test.start_server(get_app(props))
300358

301359
target = test.table("table")
302360

@@ -312,8 +370,11 @@ def test_tbst020_sorted_table_delete_cell(test):
312370

313371

314372
@pytest.mark.skip(reason="https://github.com/plotly/dash-table/issues/700")
315-
def test_tbst021_sorted_table_delete_cell_updates_while_selected(test):
316-
test.start_server(get_app())
373+
@pytest.mark.parametrize(
374+
"props", [dict(virtualization=False), dict(virtualization=True)]
375+
)
376+
def test_tbst021_sorted_table_delete_cell_updates_while_selected(test, props):
377+
test.start_server(get_app(props))
317378

318379
target = test.table("table")
319380

@@ -327,8 +388,11 @@ def test_tbst021_sorted_table_delete_cell_updates_while_selected(test):
327388
assert test.get_log_errors() == []
328389

329390

330-
def test_tbst022_sorted_table_delete_multiple_cells(test):
331-
test.start_server(get_app())
391+
@pytest.mark.parametrize(
392+
"props", [dict(virtualization=False), dict(virtualization=True)]
393+
)
394+
def test_tbst022_sorted_table_delete_multiple_cells(test, props):
395+
test.start_server(get_app(props))
332396

333397
target = test.table("table")
334398

@@ -349,8 +413,11 @@ def test_tbst022_sorted_table_delete_multiple_cells(test):
349413

350414

351415
@pytest.mark.skip(reason="https://github.com/plotly/dash-table/issues/700")
352-
def test_tbst023_sorted_table_delete_multiple_cells_while_selected(test):
353-
test.start_server(get_app())
416+
@pytest.mark.parametrize(
417+
"props", [dict(virtualization=False), dict(virtualization=True)]
418+
)
419+
def test_tbst023_sorted_table_delete_multiple_cells_while_selected(test, props):
420+
test.start_server(get_app(props))
354421

355422
target = test.table("table")
356423

0 commit comments

Comments
 (0)