Skip to content

Commit 687ccb9

Browse files
committed
test: [PROD-14393] check state of form in dataset creation dialog
1 parent 642ca3f commit 687ccb9

File tree

2 files changed

+60
-10
lines changed

2 files changed

+60
-10
lines changed

cypress/e2e/brewery/DatasetManager.cy.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('Dataset manager can be empty on start', () => {
4444
describe('Data edition in dataset manager', () => {
4545
before(() => {
4646
stub.start();
47+
stub.setOrganizations([ORGANIZATION_WITH_DEFAULT_ROLE_USER]);
4748
stub.setWorkspaces(WORKSPACES);
4849
stub.setSolutions([SOLUTION_WITH_TRANSLATED_RUN_TEMPLATES]);
4950
// we use the copy of DATASETS array to be able to reuse the same fixture
@@ -116,6 +117,48 @@ describe('Data edition in dataset manager', () => {
116117
DatasetManager.getDatasetMetadataDescription().should('contain', newDescription);
117118
DatasetManager.getDatasetMetadataTag(1).should('contain', newTag);
118119
});
120+
121+
it('correctly handles the form state even after closing and reopening the dataset creation dialog', () => {
122+
DatasetManager.ignoreDatasetTwingraphQueries();
123+
DatasetManager.switchToDatasetManagerView();
124+
125+
const stepsToCheckTwice = () => {
126+
DatasetManager.startDatasetCreation();
127+
DatasetManager.setNewDatasetName('canceledDataset');
128+
DatasetManager.getDatasetCreationNextStep().click();
129+
DatasetManager.selectNewDatasetSourceType('partially_prefilled_datasource');
130+
DatasetManager.getConfirmDatasetCreation().should('be.disabled');
131+
cy.get('[data-cy=text-input-etl_string_parameter]').type('{selectAll}{backspace}' + 'foo');
132+
DatasetManager.getConfirmDatasetCreation().should('not.be.disabled');
133+
134+
DatasetManager.getNewDatasetSourceTypeSelect().click();
135+
DatasetManager.getNewDatasetSourceTypeOptionFile().click();
136+
DatasetManager.getConfirmDatasetCreation().should('be.disabled');
137+
138+
DatasetManager.selectNewDatasetSourceType('partially_prefilled_datasource');
139+
DatasetManager.getConfirmDatasetCreation().should('not.be.disabled');
140+
141+
DatasetManager.getCancelDatasetCreation().click();
142+
DatasetManager.getDatasetCreationDialog().should('not.exist');
143+
};
144+
145+
stepsToCheckTwice();
146+
stepsToCheckTwice();
147+
});
148+
149+
it('correctly handles the form state even after closing and reopening the sub-dataset creation dialog', () => {
150+
DatasetManager.ignoreDatasetTwingraphQueries();
151+
DatasetManager.switchToDatasetManagerView();
152+
153+
const stepsToCheckTwice = () => {
154+
DatasetManager.startSubdatasetCreation();
155+
DatasetManager.getDatasetCreationNextStep().should('not.be.disabled');
156+
DatasetManager.getCancelDatasetCreation().click();
157+
};
158+
159+
stepsToCheckTwice();
160+
stepsToCheckTwice();
161+
});
119162
});
120163

121164
describe('Dataset creation', () => {
@@ -296,7 +339,7 @@ describe('Refresh dataset', () => {
296339
after(stub.stop);
297340

298341
it(
299-
'can refresh ADT and AzureStorage datasets and display en empty dataset placeholder ' +
342+
'can refresh ADT and AzureStorage datasets and display an empty dataset placeholder ' +
300343
'for the one created from scratch',
301344
() => {
302345
const refreshSuccessOptions = {

cypress/fixtures/stubbing/DatasetManager/solutions.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@ export const SOLUTION = {
1717
{
1818
id: 'etl_enum_parameter',
1919
varType: 'enum',
20-
enumValues: [
21-
{ key: 'option1', value: 'Option 1' },
22-
{ key: 'option2', value: 'Option 2' },
23-
],
20+
options: {
21+
enumValues: [
22+
{ key: 'option1', value: 'Option 1' },
23+
{ key: 'option2', value: 'Option 2' },
24+
],
25+
},
2426
},
2527
{
2628
id: 'etl_list_parameter',
2729
varType: 'list',
28-
enumValues: [
29-
{ key: 'option1', value: 'Option 1' },
30-
{ key: 'option2', value: 'Option 2' },
31-
],
30+
options: {
31+
enumValues: [
32+
{ key: 'option1', value: 'Option 1' },
33+
{ key: 'option2', value: 'Option 2' },
34+
],
35+
},
3236
},
3337
{ id: 'etl_string_parameter', varType: 'string' },
38+
{ id: 'etl_string_parameter_with_default_value', varType: 'string', defaultValue: 'is prefilled' },
3439
{ id: 'etl_date_parameter', varType: 'date' },
3540
],
3641
parameterGroups: [
@@ -39,6 +44,7 @@ export const SOLUTION = {
3944
{ id: 'listGroup', parameters: ['etl_list_parameter'] },
4045
{ id: 'stringGroup', parameters: ['etl_string_parameter'] },
4146
{ id: 'dateGroup', parameters: ['etl_date_parameter'] },
47+
{ id: 'partiallyPrefilledGroup', parameters: ['etl_string_parameter', 'etl_string_parameter_with_default_value'] },
4248
],
4349
runTemplates: [...DEFAULT_SOLUTION.runTemplates, ...CUSTOM_SUBDATASOURCES],
4450
};
@@ -70,14 +76,15 @@ export const SOLUTION_WITH_DYNAMIC_VALUES = {
7076
};
7177

7278
export const SOLUTION_WITH_TRANSLATED_RUN_TEMPLATES = {
73-
...DEFAULT_SOLUTION,
79+
...SOLUTION,
7480
runTemplates: [
7581
...DEFAULT_SOLUTION.runTemplates,
7682
{
7783
id: 'etl_run_template',
7884
labels: { en: 'ETL run template with dynamic filter', fr: 'Run template avec un filtre dynamique' },
7985
tags: ['datasource'],
8086
},
87+
{ id: 'partially_prefilled_datasource', parameterGroups: ['partiallyPrefilledGroup'], tags: ['datasource'] },
8188
{
8289
id: 'subdataset_run_template',
8390
labels: {

0 commit comments

Comments
 (0)