Skip to content

Commit ba11a55

Browse files
authored
Develop (#936)
* E2E/bug fixes -- tests for some bug fixes (#927) * modify verification on advanced setting * add tests on primary key and duplicate properties * modify verification on trace headers * added step on run input flow to set output uri suffix * added mlcpInput page object * DHFPROD-496 make consistent with current tutorial (#933) Remove title declarations since we don't define a title property in the tutuorial. * DHFPROD-675 add index confirm for save new entity
1 parent 60a5096 commit ba11a55

File tree

7 files changed

+44
-16
lines changed

7 files changed

+44
-16
lines changed

examples/online-store/plugins/entities/Product/harmonize/Harmonize Products/content/content.sjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function extractInstanceProduct(source) {
4141
let attachments = source;
4242

4343
let sku = xs.string(source.sku || source.SKU);
44-
let title = xs.string(source.title);
4544
let price = xs.decimal(source.price);
4645

4746
// return the instance object
@@ -50,7 +49,6 @@ function extractInstanceProduct(source) {
5049
'$type': 'Product',
5150
'$version': '0.0.1',
5251
'sku': sku,
53-
'title': title,
5452
'price': price
5553
}
5654
};

quick-start/e2e/page-objects/flows/flows.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ export class FlowPage extends AppPage {
182182
return element(by.css(`mdl-switch[id="${name}"]`));
183183
}
184184

185+
mlcpInput(name: string) {
186+
return element(by.css(`input[name="${name}"]`));
187+
}
188+
185189
get toast() {
186190
return element(by.css('mdl-snackbar-component'));
187191
}
@@ -252,6 +256,11 @@ export class FlowPage extends AppPage {
252256
browser.actions().mouseMove(this.menuItem(dataFormat)).perform();
253257
this.menuItem(dataFormat).click();
254258

259+
// set output uri suffix
260+
this.mlcpInput('output_uri_suffix').clear();
261+
// verify that uri can contain character &
262+
this.mlcpInput('output_uri_suffix').sendKeys('?doc=yes&type=foo');
263+
255264
browser.wait(EC.elementToBeClickable(this.mlcpSection(' Delimited Text Options')));
256265
this.mlcpSection(' Delimited Text Options').click();
257266
browser.wait(EC.visibilityOf(this.mlcpSection(' Delimited Text Options')));

quick-start/e2e/specs/auth/authenticated.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export default function(tmpDir) {
6262
expect(loginPage.stagingAppserverNameLabel.isPresent()).toBe(true);
6363
expect(loginPage.stagingAppserverName.getAttribute('value')).toEqual('data-hub-STAGING');
6464
expect(loginPage.modulesDbName.getAttribute('value')).toEqual('data-hub-MODULES');
65-
expect(loginPage.dataHubName.getAttribute('value')).toEqual('');
6665
expect(loginPage.dataHubName.getAttribute('value')).toEqual('data-hub');
6766
browser.driver.sleep(3000);
6867
expect(loginPage.projectDirTab.isDisplayed()).toBe(false);

quick-start/e2e/specs/create/create.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,11 @@ export default function() {
169169
// add id property
170170
console.log('add id property');
171171
entityPage.addProperty.click();
172+
// setting primary key first
173+
entityPage.getPropertyPrimaryKeyColumn(lastProperty).click();
172174
entityPage.getPropertyName(lastProperty).sendKeys('id');
173175
entityPage.getPropertyType(lastProperty).element(by.cssContainingText('option', 'string')).click();
174176
entityPage.getPropertyDescription(lastProperty).sendKeys('id description');
175-
entityPage.getPropertyPrimaryKeyColumn(lastProperty).click();
176177
// add price property
177178
console.log('add price property');
178179
entityPage.addProperty.click();
@@ -190,6 +191,11 @@ export default function() {
190191
entityPage.getPropertyCardinality(lastProperty).element(by.css(selectCardinalityOneToManyOption)).click();
191192
entityPage.getPropertyDescription(lastProperty).sendKeys('products description');
192193
entityPage.getPropertyWordLexiconColumn(lastProperty).click();
194+
// add a duplicate price property, negative test
195+
entityPage.addProperty.click();
196+
lastProperty = entityPage.lastProperty;
197+
entityPage.getPropertyName(lastProperty).sendKeys('price');
198+
entityPage.getPropertyType(lastProperty).element(by.cssContainingText('option', 'decimal')).click();
193199
entityPage.saveEntity.click();
194200
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogYesButton));
195201
expect(entityPage.confirmDialogYesButton.isPresent()).toBe(true);
@@ -223,6 +229,7 @@ export default function() {
223229
browser.wait(EC.visibilityOf(entityPage.entityEditor));
224230
expect(entityPage.entityEditor.isPresent()).toBe(true);
225231
let idProperty = entityPage.getPropertyByPosition(1);
232+
// verify that primary key is retained
226233
expect(entityPage.getPropertyName(idProperty).getAttribute('value')).toEqual('id');
227234
expect(entityPage.getPropertyType(idProperty).getAttribute('ng-reflect-model')).toEqual('string');
228235
expect(entityPage.getPropertyDescription(idProperty).getAttribute('value')).toEqual('id description');
@@ -239,6 +246,8 @@ export default function() {
239246
expect(entityPage.getPropertyCardinality(productsProperty).getAttribute('ng-reflect-model')).toEqual('ONE_TO_MANY');
240247
expect(entityPage.getPropertyDescription(productsProperty).getAttribute('value')).toEqual('products description');
241248
expect(entityPage.hasClass(entityPage.getPropertyWordLexicon(productsProperty), 'active')).toBe(true);
249+
// verify duplicate property is not created, the count should be 3
250+
entityPage.getPropertiesCount().then(function(props){expect(props === 3)});
242251
entityPage.cancelEntity.click();
243252
browser.wait(EC.invisibilityOf(entityPage.entityEditor));
244253
});

quick-start/e2e/specs/run/run.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ export default function(tmpDir) {
6060
browsePage.searchBox().sendKeys('442403950907');
6161
browsePage.searchButton().click();
6262
browser.wait(EC.elementToBeClickable(browsePage.resultsUri()));
63-
expect(browsePage.resultsUri().getText()).toContain('/board_games_accessories.csv-0-1');
63+
expect(browsePage.resultsUri().getText()).toContain('/board_games_accessories.csv-0-1?doc=yes&type=foo');
6464
//verify on viewer page
6565
browsePage.resultsUri().click();
6666
viewerPage.isLoaded();
67-
expect(viewerPage.searchResultUri().getText()).toContain('/board_games_accessories.csv-0-1');
67+
expect(viewerPage.searchResultUri().getText()).toContain('/board_games_accessories.csv-0-1?doc=yes&type=foo');
6868
expect(element(by.cssContainingText('.cm-variable', 'sku')).isPresent()).toBe(true);
6969
expect(element(by.cssContainingText('.cm-string', '442403950907')).isPresent()).toBe(true);
7070
expect(element(by.cssContainingText('.cm-variable', 'attachments')).isPresent()).toBe(true);

quick-start/e2e/specs/traces/traces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function() {
4848
console.log('verifying headers output');
4949
expect(traceViewerPage.pluginSubheader('headers').isPresent()).toBe(true);
5050
expect(element(by.cssContainingText('.cm-variable', 'key1')).isPresent()).toBe(true);
51-
expect(element(by.cssContainingText('.cm-atom', '250.456')).isPresent()).toBe(true);
51+
expect(element(by.cssContainingText('.cm-string', 'world')).isPresent()).toBe(true);
5252
traceViewerPage.tracesTab.click();
5353
});
5454

quick-start/src/main/ui/app/entity-modeler/entity-modeler.component.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,7 @@ export class EntityModelerComponent implements AfterViewChecked {
282282
startEditing(entity: Entity) {
283283
this.entitiesService.editEntity(entity).subscribe(() => {
284284
this.entitiesService.saveEntity(entity).subscribe(() => {
285-
let result = this.dialogService.confirm(`Saved. Update Indexes in MarkLogic?`, 'No', 'Yes');
286-
result.subscribe(() => {
287-
this.installService.updateIndexes().subscribe(() => {
288-
this.snackbar.showSnackbar({
289-
message: 'Indexes updated.',
290-
});
291-
});
292-
}, () => {});
285+
this.confirmUpdateIndexes()
293286
});
294287
},
295288
// cancel... do nothing
@@ -378,12 +371,32 @@ export class EntityModelerComponent implements AfterViewChecked {
378371
this.entitiesService.editEntity(entity).subscribe(() => {
379372
this.adjustCoords(entity);
380373
this.adjustSize(entity);
381-
this.entitiesService.saveEntity(entity);
374+
this.entitiesService.saveEntity(entity).subscribe(() => {
375+
this.confirmUpdateIndexes();
376+
});
382377
},
383378
// cancel... do nothing
384379
() => {
385380
console.log('cancel');
386381
});
387382
}
388383

384+
/**
385+
* Display confirm dialog and update entity indexes upon confirmation
386+
*/
387+
confirmUpdateIndexes() {
388+
let result = this.dialogService.confirm(
389+
`Saved. Update Indexes in MarkLogic?`,
390+
'No',
391+
'Yes'
392+
);
393+
result.subscribe(() => {
394+
this.installService.updateIndexes().subscribe(() => {
395+
this.snackbar.showSnackbar({
396+
message: 'Indexes updated.',
397+
});
398+
});
399+
}, () => {});
400+
}
401+
389402
}

0 commit comments

Comments
 (0)