Skip to content

Commit 348d75d

Browse files
authored
Merge pull request #1994 from silx-kit/mock-file
Restructure mock file
2 parents 8a053fd + 03abcd5 commit 348d75d

52 files changed

Lines changed: 387 additions & 396 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/storybook/src/MatrixVis.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import FillHeight from './decorators/FillHeight';
1010

1111
const twoD = mockValues.twoD();
1212
const typedTwoD = toTypedNdArray(twoD, Float32Array);
13-
const cplxTwoD = mockValues.twoD_cplx();
13+
const cplxTwoD = mockValues.twoD_complex();
1414

1515
const formatNum = format('.3e');
1616
const formatCplx = createComplexFormatter(format('.2e'));

cypress/e2e/app.cy.ts

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ describe('/mock', () => {
1111
});
1212

1313
it('visualize 1D dataset as Line', () => {
14-
cy.selectExplorerNode('nD_datasets');
14+
cy.selectExplorerNode('arrays');
1515
cy.selectExplorerNode('oneD');
1616

1717
cy.findByRole('tab', { name: 'Line' }).should(...BE_SELECTED);
1818
cy.findByRole('figure', { name: 'oneD' }).should('be.visible');
19-
cy.findByRole('heading', { name: 'nD_datasets / oneD' }).should(
20-
'be.visible',
21-
);
19+
cy.findByRole('heading', { name: 'arrays / oneD' }).should('be.visible');
2220

2321
if (takeSnapshots) {
2422
cy.matchImageSnapshot('line_1D');
@@ -35,12 +33,12 @@ describe('/mock', () => {
3533
});
3634

3735
it('visualize 1D complex dataset as Line', () => {
38-
cy.selectExplorerNode('nD_datasets');
39-
cy.selectExplorerNode('oneD_cplx');
36+
cy.selectExplorerNode('arrays');
37+
cy.selectExplorerNode('oneD_complex');
4038

4139
cy.findByRole('tab', { name: 'Line' }).should(...BE_SELECTED);
42-
cy.findByRole('figure', { name: 'oneD_cplx' }).should('be.visible');
43-
cy.findByRole('heading', { name: 'nD_datasets / oneD_cplx' }).should(
40+
cy.findByRole('figure', { name: 'oneD_complex' }).should('be.visible');
41+
cy.findByRole('heading', { name: 'arrays / oneD_complex' }).should(
4442
'be.visible',
4543
);
4644

@@ -50,7 +48,7 @@ describe('/mock', () => {
5048
});
5149

5250
it('visualize 1D dataset as Matrix', () => {
53-
cy.selectExplorerNode('nD_datasets');
51+
cy.selectExplorerNode('arrays');
5452
cy.selectExplorerNode('oneD');
5553
cy.selectVisTab('Matrix');
5654

@@ -70,7 +68,7 @@ describe('/mock', () => {
7068
});
7169

7270
it('visualize 1D compound dataset', () => {
73-
cy.selectExplorerNode('nD_datasets');
71+
cy.selectExplorerNode('arrays');
7472
cy.selectExplorerNode('oneD_compound');
7573
cy.selectVisTab('Compound');
7674

@@ -95,14 +93,12 @@ describe('/mock', () => {
9593
});
9694

9795
it('visualize 2D dataset as Heatmap', () => {
98-
cy.selectExplorerNode('nD_datasets');
96+
cy.selectExplorerNode('arrays');
9997
cy.selectExplorerNode('twoD');
10098

10199
cy.findByRole('tab', { name: 'Heatmap' }).should(...BE_SELECTED);
102100
cy.findByRole('figure', { name: 'twoD' }).should('be.visible');
103-
cy.findByRole('heading', { name: 'nD_datasets / twoD' }).should(
104-
'be.visible',
105-
);
101+
cy.findByRole('heading', { name: 'arrays / twoD' }).should('be.visible');
106102

107103
if (takeSnapshots) {
108104
cy.matchImageSnapshot('heatmap_2D');
@@ -118,14 +114,14 @@ describe('/mock', () => {
118114
});
119115

120116
it('visualize 2D complex dataset as Heatmap', () => {
121-
cy.selectExplorerNode('nD_datasets');
122-
cy.selectExplorerNode('twoD_cplx');
117+
cy.selectExplorerNode('arrays');
118+
cy.selectExplorerNode('twoD_complex');
123119

124120
cy.findByRole('tab', { name: 'Heatmap' }).should(...BE_SELECTED);
125-
cy.findByRole('figure', { name: 'twoD_cplx (amplitude)' }).should(
121+
cy.findByRole('figure', { name: 'twoD_complex (amplitude)' }).should(
126122
'be.visible',
127123
);
128-
cy.findByRole('heading', { name: 'nD_datasets / twoD_cplx' }).should(
124+
cy.findByRole('heading', { name: 'arrays / twoD_complex' }).should(
129125
'be.visible',
130126
);
131127

@@ -153,7 +149,7 @@ describe('/mock', () => {
153149
});
154150

155151
it('map dimensions of 4D dataset when visualized as Heatmap', () => {
156-
cy.selectExplorerNode('nD_datasets');
152+
cy.selectExplorerNode('arrays');
157153
cy.selectExplorerNode('fourD');
158154

159155
cy.findByTitle('Number of elements in each dimension')
@@ -198,7 +194,7 @@ describe('/mock', () => {
198194
});
199195

200196
it('slice through 4D dataset when visualized as Heatmap', () => {
201-
cy.selectExplorerNode('nD_datasets');
197+
cy.selectExplorerNode('arrays');
202198
cy.selectExplorerNode('fourD');
203199

204200
cy.findByRole('figure', { name: 'fourD' }).as('vis').should('be.visible');
@@ -239,7 +235,7 @@ describe('/mock', () => {
239235
});
240236

241237
it('visualize line with constant interpolation', () => {
242-
cy.selectExplorerNode('nD_datasets');
238+
cy.selectExplorerNode('arrays');
243239
cy.selectExplorerNode('oneD');
244240

245241
cy.findByRole('button', { name: 'More controls' }).click();
@@ -251,7 +247,7 @@ describe('/mock', () => {
251247
cy.matchImageSnapshot('line_constant');
252248
}
253249

254-
cy.selectExplorerNode('oneD_cplx');
250+
cy.selectExplorerNode('oneD_complex');
255251
cy.waitForStableDOM();
256252

257253
if (takeSnapshots) {
@@ -260,7 +256,7 @@ describe('/mock', () => {
260256
});
261257

262258
it('edit heatmap color map limits', () => {
263-
cy.selectExplorerNode('nD_datasets');
259+
cy.selectExplorerNode('arrays');
264260
cy.selectExplorerNode('twoD');
265261

266262
cy.findByRole('button', { name: 'Edit domain' })
@@ -283,7 +279,8 @@ describe('/mock', () => {
283279
});
284280

285281
it('flip heatmap', () => {
286-
cy.selectExplorerNode('typed_arrays');
282+
cy.selectExplorerNode('arrays');
283+
cy.selectExplorerNode('typed');
287284
cy.selectExplorerNode('uint8');
288285

289286
cy.findByRole('button', { name: 'More controls' }).click();
@@ -304,12 +301,12 @@ describe('/mock', () => {
304301
});
305302

306303
it('visualize image dataset as RGB/BGR or RGBA/BGRA', () => {
307-
cy.selectExplorerNode('nD_datasets');
304+
cy.selectExplorerNode('arrays');
308305
cy.selectExplorerNode('threeD_rgb');
309306

310307
cy.findByRole('tab', { name: 'RGB' }).should(...BE_SELECTED);
311308
cy.findByRole('figure', { name: 'threeD_rgb' }).should('be.visible');
312-
cy.findByRole('heading', { name: 'nD_datasets / threeD_rgb' }).should(
309+
cy.findByRole('heading', { name: 'arrays / threeD_rgb' }).should(
313310
'be.visible',
314311
);
315312

@@ -327,7 +324,7 @@ describe('/mock', () => {
327324
cy.selectExplorerNode('threeD_rgba');
328325
cy.findByRole('tab', { name: 'RGB' }).should(...BE_SELECTED);
329326
cy.findByRole('figure', { name: 'threeD_rgba' }).should('be.visible');
330-
cy.findByRole('heading', { name: 'nD_datasets / threeD_rgba' }).should(
327+
cy.findByRole('heading', { name: 'arrays / threeD_rgba' }).should(
331328
'be.visible',
332329
);
333330

@@ -352,7 +349,7 @@ describe('/mock', () => {
352349
.should('have.length', 3)
353350
.each((e) => expect(e).to.contain('scatter'));
354351

355-
cy.findByRole('treeitem', { name: '/nexus_entry/scatter' }).click();
352+
cy.findByRole('treeitem', { name: '/nexus/scatter' }).click();
356353
cy.waitForStableDOM();
357354

358355
cy.findByRole('figure', { name: 'scatter_data' }).should('be.visible');
@@ -381,11 +378,11 @@ describe('/mock', () => {
381378
});
382379

383380
it('visualize dataset with "spectrum" interpretation as NxLine', () => {
384-
cy.selectExplorerNode('nexus_entry');
381+
cy.selectExplorerNode('nexus');
385382
cy.selectExplorerNode('spectrum');
386383

387384
cy.findByRole('tab', { name: 'NX Line' }).should(...BE_SELECTED);
388-
cy.findByRole('heading', { name: 'nexus_entry / spectrum' }).should(
385+
cy.findByRole('heading', { name: 'nexus / spectrum' }).should(
389386
'be.visible',
390387
);
391388
cy.findByRole('figure', { name: 'twoD (arb. units)' }).should(
@@ -400,13 +397,11 @@ describe('/mock', () => {
400397
});
401398

402399
it('visualize dataset with "image" interpretation as NxHeatmap', () => {
403-
cy.selectExplorerNode('nexus_entry');
400+
cy.selectExplorerNode('nexus');
404401
cy.selectExplorerNode('image');
405402

406403
cy.findByRole('tab', { name: 'NX Heatmap' }).should(...BE_SELECTED);
407-
cy.findByRole('heading', { name: 'nexus_entry / image' }).should(
408-
'be.visible',
409-
);
404+
cy.findByRole('heading', { name: 'nexus / image' }).should('be.visible');
410405
cy.findByRole('figure', { name: 'Interference fringes' }).should(
411406
'be.visible',
412407
);
@@ -422,7 +417,7 @@ describe('/mock', () => {
422417
});
423418

424419
it('use axis values to compute axis ticks', () => {
425-
cy.selectExplorerNode('nexus_entry');
420+
cy.selectExplorerNode('nexus');
426421
cy.selectExplorerNode('image');
427422

428423
cy.get('svg[data-type="abscissa"] .visx-axis-tick').should(
@@ -432,11 +427,11 @@ describe('/mock', () => {
432427
});
433428

434429
it('visualize dataset with default slice', () => {
435-
cy.selectExplorerNode('nexus_entry');
430+
cy.selectExplorerNode('nexus');
436431
cy.selectExplorerNode('default_slice');
437432

438433
cy.findByRole('tab', { name: 'NX Heatmap' }).should(...BE_SELECTED);
439-
cy.findByRole('heading', { name: 'nexus_entry / default_slice' }).should(
434+
cy.findByRole('heading', { name: 'nexus / default_slice' }).should(
440435
'be.visible',
441436
);
442437

@@ -458,28 +453,28 @@ describe('/mock', () => {
458453
});
459454

460455
it('visualize dataset with log scales on both axes on NxLine with SILX_style', () => {
461-
cy.selectExplorerNode('nexus_entry');
462-
cy.selectExplorerNode('log_spectrum');
456+
cy.selectExplorerNode('nexus');
457+
cy.selectExplorerNode('spectrum_log');
463458

464459
cy.findByRole('tab', { name: 'NX Line' }).should(...BE_SELECTED);
465-
cy.findByRole('heading', { name: 'nexus_entry / log_spectrum' }).should(
460+
cy.findByRole('heading', { name: 'nexus / spectrum_log' }).should(
466461
'be.visible',
467462
);
468463

469464
cy.findAllByRole('combobox', { name: /Log/u }).should('have.length', 2);
470465

471466
if (takeSnapshots) {
472467
cy.waitForStableDOM();
473-
cy.matchImageSnapshot('logspectrum');
468+
cy.matchImageSnapshot('nxline_log');
474469
}
475470
});
476471

477472
it('visualize signal and auxiliary signals datasets as NxLine', () => {
478-
cy.selectExplorerNode('nexus_entry');
473+
cy.selectExplorerNode('nexus');
479474
cy.selectExplorerNode('spectrum_with_aux');
480475

481476
cy.findByRole('heading', {
482-
name: 'nexus_entry / spectrum_with_aux',
477+
name: 'nexus / spectrum_with_aux',
483478
}).should('be.visible');
484479

485480
if (takeSnapshots) {
@@ -488,11 +483,11 @@ describe('/mock', () => {
488483
});
489484

490485
it('visualize auxiliary signal datasets as NxHeatmap', () => {
491-
cy.selectExplorerNode('nexus_entry');
486+
cy.selectExplorerNode('nexus');
492487
cy.selectExplorerNode('image_with_aux');
493488

494489
cy.findByRole('heading', {
495-
name: 'nexus_entry / image_with_aux',
490+
name: 'nexus / image_with_aux',
496491
}).should('be.visible');
497492
cy.findByRole('figure', { name: 'twoD' }).should('be.visible');
498493

@@ -509,11 +504,11 @@ describe('/mock', () => {
509504
});
510505

511506
it('visualize 2D complex signal with "spectrum" interpretation and auxiliaries as NxLine', () => {
512-
cy.selectExplorerNode('nexus_entry');
513-
cy.selectExplorerNode('complex_spectrum');
507+
cy.selectExplorerNode('nexus');
508+
cy.selectExplorerNode('spectrum_complex');
514509

515510
cy.findByRole('heading', {
516-
name: 'nexus_entry / complex_spectrum',
511+
name: 'nexus / spectrum_complex',
517512
}).should('be.visible');
518513

519514
if (takeSnapshots) {
@@ -522,11 +517,11 @@ describe('/mock', () => {
522517
});
523518

524519
it('visualize 2D complex signal as NxHeatmap', () => {
525-
cy.selectExplorerNode('nexus_entry');
526-
cy.selectExplorerNode('complex_image');
520+
cy.selectExplorerNode('nexus');
521+
cy.selectExplorerNode('image_complex');
527522

528523
cy.findByRole('heading', {
529-
name: 'nexus_entry / complex_image',
524+
name: 'nexus / image_complex',
530525
}).should('be.visible');
531526

532527
if (takeSnapshots) {
@@ -546,12 +541,12 @@ describe('/mock', () => {
546541
});
547542

548543
it('visualize signals with "rgb-image" and "rgba-image" interpretations as NxRGB', () => {
549-
cy.selectExplorerNode('nexus_entry');
544+
cy.selectExplorerNode('nexus');
550545
cy.selectExplorerNode('rgb-image');
551546

552547
cy.findByRole('tab', { name: 'NX RGB' }).should(...BE_SELECTED);
553548
cy.findByRole('figure', { name: 'RGB' }).should('be.visible');
554-
cy.findByRole('heading', { name: 'nexus_entry / rgb-image' }).should(
549+
cy.findByRole('heading', { name: 'nexus / rgb-image' }).should(
555550
'be.visible',
556551
);
557552
cy.waitForStableDOM();
@@ -563,7 +558,7 @@ describe('/mock', () => {
563558
cy.selectExplorerNode('rgba-image');
564559
cy.findByRole('tab', { name: 'NX RGB' }).should(...BE_SELECTED);
565560
cy.findByRole('figure', { name: 'RGBA' }).should('be.visible');
566-
cy.findByRole('heading', { name: 'nexus_entry / rgba-image' }).should(
561+
cy.findByRole('heading', { name: 'nexus / rgba-image' }).should(
567562
'be.visible',
568563
);
569564
cy.waitForStableDOM();
@@ -574,12 +569,12 @@ describe('/mock', () => {
574569
});
575570

576571
it('visualize dataset with 1D signal and two 1D axes of same length as NxScatter', () => {
577-
cy.selectExplorerNode('nexus_entry');
572+
cy.selectExplorerNode('nexus');
578573
cy.selectExplorerNode('scatter');
579574

580575
cy.findByRole('tab', { name: 'NX Scatter' }).should(...BE_SELECTED);
581576
cy.findByRole('figure', { name: 'scatter_data' }).should('be.visible');
582-
cy.findByRole('heading', { name: 'nexus_entry / scatter' }).should(
577+
cy.findByRole('heading', { name: 'nexus / scatter' }).should(
583578
'be.visible',
584579
);
585580

-874 Bytes
Loading
-849 Bytes
Loading
1.82 KB
Loading
1.85 KB
Loading
1.85 KB
Loading
-2.65 KB
Loading
-13 KB
Loading
-12.9 KB
Loading

0 commit comments

Comments
 (0)