Skip to content

Commit ccc0e24

Browse files
committed
test: [PROD-13334] check runTemplate name in dataset metadata
1 parent 51269da commit ccc0e24

File tree

4 files changed

+110
-6
lines changed

4 files changed

+110
-6
lines changed

cypress/e2e/brewery/DatasetManager.cy.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
DATASETS_TO_REFRESH,
1010
ORGANIZATION_WITH_DEFAULT_ROLE_USER,
1111
} from '../../fixtures/stubbing/DatasetManager';
12+
import { RUNNERS_FOR_ETL_DATASETS } from '../../fixtures/stubbing/DatasetManager/runners';
13+
import { SOLUTION_WITH_TRANSLATED_RUN_TEMPLATES } from '../../fixtures/stubbing/DatasetManager/solutions';
1214
import { USER_EXAMPLE } from '../../fixtures/stubbing/default';
1315

1416
const WORKSPACES = [WORKSPACE];
@@ -43,30 +45,48 @@ describe('Data edition in dataset manager', () => {
4345
before(() => {
4446
stub.start();
4547
stub.setWorkspaces(WORKSPACES);
48+
stub.setSolutions([SOLUTION_WITH_TRANSLATED_RUN_TEMPLATES]);
4649
// we use the copy of DATASETS array to be able to reuse the same fixture
4750
// in all tests in the suite. The cypress doc says that "fixture files are
4851
// assumed to be unchanged during the test, and thus Cypress loads them just once",
4952
// perhaps, we are modifying the list while creating and deleting datasets, so,
5053
// to keep the same list at the beginning of every describe block, we provide a copy
5154
// to stubbing function
5255
stub.setDatasets([...DATASETS]);
56+
stub.setRunners(RUNNERS_FOR_ETL_DATASETS);
5357
});
5458
beforeEach(() => Login.login({ url: '/W-stbbdbrwryWithDM', workspaceId: 'W-stbbdbrwryWithDM' }));
5559
after(stub.stop);
5660

57-
it('can edit datasets metadata', () => {
61+
it('can display and edit datasets metadata', () => {
5862
const DATASET_A = DATASETS[0];
5963
const DATASET_B = DATASETS[1];
64+
const DATASET_ETL = DATASETS[3];
65+
const SUBDATASET = DATASETS[4];
6066
const DATASET_Z = DATASETS[2]; // Non-main dataset
6167

6268
DatasetManager.ignoreDatasetTwingraphQueries();
6369
DatasetManager.switchToDatasetManagerView();
6470

65-
DatasetManager.getDatasetsListItemButtons().should('have.length', 2);
71+
DatasetManager.getDatasetsListItemButtons().should('have.length', 4);
6672
DatasetManager.getDatasetsListItemButton(DATASET_A.id).should('be.visible');
6773
DatasetManager.getDatasetsListItemButton(DATASET_B.id).should('be.visible');
74+
DatasetManager.getDatasetsListItemButton(DATASET_ETL.id).should('be.visible');
75+
DatasetManager.getDatasetsListItemButton(SUBDATASET.id).should('be.visible');
6876
DatasetManager.getDatasetsListItemButton(DATASET_Z.id).should('not.exist');
6977

78+
DatasetManager.selectDatasetById(DATASET_ETL.id);
79+
DatasetManager.getDatasetMetadataSourceType().should(
80+
'have.text',
81+
'Source:' + 'ETL run template with dynamic filter'
82+
);
83+
84+
DatasetManager.selectDatasetById(SUBDATASET.id);
85+
DatasetManager.getDatasetMetadataSourceType().should(
86+
'have.text',
87+
'Source:' + 'Subdataset run template with static filter'
88+
);
89+
7090
DatasetManager.selectDatasetById(DATASET_A.id);
7191
DatasetManager.getDatasetMetadataDescription().should('contain', DATASET_A.description);
7292
DatasetManager.getDatasetMetadataTags().should('have.length', 2);
@@ -136,7 +156,7 @@ describe('Dataset creation', () => {
136156

137157
DatasetManager.ignoreDatasetTwingraphQueries();
138158
DatasetManager.switchToDatasetManagerView();
139-
DatasetManager.getDatasetsListItemButtons().should('have.length', 2);
159+
DatasetManager.getDatasetsListItemButtons().should('have.length', 4);
140160
DatasetManager.startDatasetCreation();
141161
DatasetManager.setNewDatasetName(datasetName);
142162
datasetTags.forEach((tag) => DatasetManager.addNewDatasetTag(tag));
@@ -251,14 +271,16 @@ describe('Dataset delete', () => {
251271
it('can delete all scenarios from the list and display noDatasets placeholder', () => {
252272
DatasetManager.ignoreDatasetTwingraphQueries();
253273
DatasetManager.switchToDatasetManagerView();
254-
DatasetManager.getDatasetsListItemButtons().should('have.length', 2);
274+
DatasetManager.getDatasetsListItemButtons().should('have.length', 4);
255275
DatasetManager.getDatasetDeleteButton(DATASETS[0].id).click();
256276
DatasetManager.getDeleteDatasetDialog().should('be.visible');
257277
DatasetManager.getDeleteDatasetDialogBody().contains(DATASETS[0].name);
258278
DatasetManager.closeDeleteDatasetDialog();
259279
DatasetManager.deleteDataset(DATASETS[0].id, DATASETS[0].name);
260-
DatasetManager.getDatasetsListItemButtons().should('have.length', 1);
280+
DatasetManager.getDatasetsListItemButtons().should('have.length', 3);
261281
DatasetManager.deleteDataset(DATASETS[1].id, DATASETS[1].name);
282+
DatasetManager.deleteDataset(DATASETS[3].id, DATASETS[3].name);
283+
DatasetManager.deleteDataset(DATASETS[4].id, DATASETS[4].name);
262284
DatasetManager.getNoDatasetsPlaceholder().should('be.visible');
263285
DatasetManager.getNoDatasetsPlaceholderUserSubtitle().should('not.exist'); // Default role not set to "user"
264286
});

cypress/fixtures/stubbing/DatasetManager/datasets.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,39 @@ const FILE_DATASET_NON_MAIN = {
3535
description: 'hidden dataset',
3636
};
3737

38+
const ETL_DATASET = {
39+
...EDITABLE_DATASET,
40+
main: true,
41+
id: 'D-stbdataset13',
42+
parentId: 'D-stbdataset2',
43+
name: 'Dataset ETL',
44+
description: 'ETL dataset',
45+
sourceType: 'ETL',
46+
source: {
47+
location: 'W-stbbdbrwry',
48+
name: 'r-stbdrnr1',
49+
path: null,
50+
jobId: 'run-stbrun1',
51+
},
52+
tags: ['dataset', 'ETL'],
53+
};
54+
55+
const SUBDATASET = {
56+
...EDITABLE_DATASET,
57+
main: true,
58+
id: 'D-stbdataset14',
59+
name: 'Subdataset',
60+
description: 'ETL dataset',
61+
sourceType: 'ETL',
62+
source: {
63+
location: 'W-stbbdbrwry',
64+
name: 'r-stbdrnr2',
65+
path: null,
66+
jobId: 'run-stbrun2',
67+
},
68+
tags: ['dataset', 'ETL'],
69+
};
70+
3871
const DATASET_AMSTERDAM = {
3972
...EDITABLE_DATASET,
4073
id: 'D-stbdataset3',
@@ -125,7 +158,7 @@ const DATASET_TWINGRAPH_B = {
125158
twincacheStatus: 'FULL',
126159
};
127160

128-
export const DATASETS = [FILE_DATASET_MAIN_A, FILE_DATASET_MAIN_B, FILE_DATASET_NON_MAIN];
161+
export const DATASETS = [FILE_DATASET_MAIN_A, FILE_DATASET_MAIN_B, FILE_DATASET_NON_MAIN, ETL_DATASET, SUBDATASET];
129162

130163
export const DATASETS_TO_FILTER = [
131164
DATASET_AMSTERDAM,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Cosmo Tech.
2+
// Licensed under the MIT license.
3+
import { DEFAULT_RUNNER } from '../default';
4+
5+
const EDITABLE_RUNNER = {
6+
...DEFAULT_RUNNER,
7+
status: 'Running',
8+
security: { default: 'admin', accessControlList: [] },
9+
};
10+
11+
const RUNNER_ETL = {
12+
...EDITABLE_RUNNER,
13+
id: 'r-stbdrnr1',
14+
organizationId: 'O-stbdbrwry',
15+
name: 'ETL Runner',
16+
description: 'Runner for ETL',
17+
runTemplateId: 'etl_run_template',
18+
};
19+
20+
const RUNNER_SUBDATASET = {
21+
...EDITABLE_RUNNER,
22+
id: 'r-stbdrnr2',
23+
organizationId: 'O-stbdbrwry',
24+
name: 'Subdataset runner',
25+
description: 'Runner for subdataset ETL',
26+
runTemplateId: 'subdataset_run_template',
27+
};
28+
29+
export const RUNNERS_FOR_ETL_DATASETS = [RUNNER_ETL, RUNNER_SUBDATASET];

cypress/fixtures/stubbing/DatasetManager/solutions.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,23 @@ export const SOLUTION_WITH_DYNAMIC_VALUES = {
6868
{ id: 'dynamic_values_enum_filter', parameterGroups: ['dynamicValuesEnumGroup'], tags: ['subdatasource'] },
6969
],
7070
};
71+
72+
export const SOLUTION_WITH_TRANSLATED_RUN_TEMPLATES = {
73+
...DEFAULT_SOLUTION,
74+
runTemplates: [
75+
...DEFAULT_SOLUTION.runTemplates,
76+
{
77+
id: 'etl_run_template',
78+
labels: { en: 'ETL run template with dynamic filter', fr: 'Run template avec un filtre dynamique' },
79+
tags: ['datasource'],
80+
},
81+
{
82+
id: 'subdataset_run_template',
83+
labels: {
84+
en: 'Subdataset run template with static filter',
85+
fr: 'Run template de sous-dataset avec un filtre statique',
86+
},
87+
tags: ['subdatasource'],
88+
},
89+
],
90+
};

0 commit comments

Comments
 (0)