Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(advanced search): try to reuse resource and property selection (DSP-1587) #290

Merged
merged 23 commits into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
177b410
feat(advanced search): try to reuse resource and property selection
May 3, 2021
8eaf7ef
feat(advanced search): restrict resource classes by linking property'…
May 4, 2021
203c06d
feat(advanced search): restrict resource classes by linking property'…
May 4, 2021
8f31bdb
feat(advanced search): make new parent component for resource and pro…
May 4, 2021
ed398f5
feat(advanced search): move new parent component into lib
May 4, 2021
9118503
feat(advanced search): use new component in advanced search form
May 4, 2021
85fefe9
Merge branch 'main' into wip/dsp-1587-search-linked-res
tobiasschweizer May 4, 2021
86beef7
test(advanced search): adapt tests (ongoing)
May 4, 2021
5565abc
test(advanced search): adapt tests (ongoing)
May 4, 2021
3559f1b
test(advanced search): adapt tests (ongoing)
May 4, 2021
0ee6604
fix(dev build): remove exports from module
May 4, 2021
9901371
test(advanced search): adapt tests (ongoing)
May 4, 2021
e5eb3a1
test(advanced search): adapt tests (ongoing)
May 4, 2021
ab6a580
test(advanced search): adapt tests (ongoing)
May 4, 2021
25659f2
test(advanced search): adapt tests (ongoing)
May 4, 2021
93a85c5
refactor(advanced search): start from validation on AfterViewChecked
May 4, 2021
99bc16c
test(advanced search): fix e2e tests (ongoing)
May 5, 2021
a4b2a70
test(advanced search): fix e2e tests (ongoing)
May 5, 2021
e7f00ec
test(advanced search): do not install specific version of webdriver
May 5, 2021
7d66e2c
refactor(advanced search): move CSS
May 5, 2021
522191b
test(advanced search): simplify spec
May 5, 2021
7e21377
test(advanced search): simplify spec
May 6, 2021
cde4769
test(advanced search): simplify spec
May 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -62,7 +62,6 @@ jobs:
run: npm run build-lib
- name: Run knora stack
run: make knora-stack
- run: npm run webdriver-update
- name: Run e2e tests
run: npm run e2e
env:
Expand Down
34 changes: 14 additions & 20 deletions e2e/src/app.e2e-spec.ts
Expand Up @@ -88,9 +88,7 @@ describe('Test App', () => {

const loader = ProtractorHarnessEnvironment.loader();

const submitButton = await page.getAdvancedSearchSubmitButton(loader);

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectOntos = await page.getAdvancedSearchOntologySelection(loader, timeout);

Expand Down Expand Up @@ -121,7 +119,7 @@ describe('Test App', () => {

await resClasses.clickOptions({ text: 'Thing'});

expect(await submitButton.isDisabled()).toBe(false);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(false);

// browser.sleep(200000);

Expand All @@ -134,9 +132,7 @@ describe('Test App', () => {

const loader = ProtractorHarnessEnvironment.loader();

const submitButton = await page.getAdvancedSearchSubmitButton(loader);

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectOntos = await page.getAdvancedSearchOntologySelection(loader, timeout);

Expand All @@ -146,33 +142,33 @@ describe('Test App', () => {
await browser.wait(EC.presenceOf(element(by.css('.select-resource-class'))), timeout,
'Wait for resource class options to be visible.');

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const addPropButton = await page.getAdvancedSearchPropertyAddButton(loader);

await addPropButton.click();

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectProps = await page.getAdvancedSearchPropertySelection(loader);

await selectProps.open();

await selectProps.clickOptions({text: 'Integer'});

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectCompOps = await page.getAdvancedSearchComparisonOperatorSelection(loader);

await selectCompOps.clickOptions({ text: 'is equal to'});

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const input = await loader.getHarness(MatInputHarness);

await input.setValue('1');

expect(await submitButton.isDisabled()).toBe(false);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(false);

// browser.sleep(200000);
});
Expand All @@ -184,9 +180,7 @@ describe('Test App', () => {

const loader = ProtractorHarnessEnvironment.loader();

const submitButton = await page.getAdvancedSearchSubmitButton(loader);

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectOntos = await page.getAdvancedSearchOntologySelection(loader, timeout);

Expand All @@ -196,27 +190,27 @@ describe('Test App', () => {
await browser.wait(EC.presenceOf(element(by.css('.select-resource-class'))), timeout,
'Wait for resource class options to be visible.');

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const addPropButton = await page.getAdvancedSearchPropertyAddButton(loader);

await addPropButton.click();

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectProps = await page.getAdvancedSearchPropertySelection(loader);

await selectProps.open();

await selectProps.clickOptions({text: 'Another thing'});

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const selectCompOps = await page.getAdvancedSearchComparisonOperatorSelection(loader);

await selectCompOps.clickOptions({ text: 'is equal to'});

expect(await submitButton.isDisabled()).toBe(true);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(true);

const input = await loader.getHarness(MatInputHarness);

Expand All @@ -236,7 +230,7 @@ describe('Test App', () => {

await options[0].click();

expect(await submitButton.isDisabled()).toBe(false);
expect(await (await page.getAdvancedSearchSubmitButton(loader)).isDisabled()).toBe(false);

// browser.sleep(200000);
});
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -30,8 +30,7 @@
"yalc-publish-lib": "npm run build-lib && yalc publish dist/@dasch-swiss/dsp-ui",
"build-app": "ng b --prod",
"lint": "ng lint",
"e2e": "ng e2e --prod=true --protractor-config=./e2e/protractor.conf.js --webdriver-update=false",
"webdriver-update": "webdriver-manager update --standalone false --gecko false --versions.chrome 2.37"
"e2e": "ng e2e --prod=true --protractor-config=./e2e/protractor.conf.js --webdriver-update"
},
"private": true,
"dependencies": {
Expand Down
Expand Up @@ -2,41 +2,14 @@

<div *ngIf="ontologiesMetadata?.ontologies.length > 0">
<dsp-select-ontology [formGroup]="form" [ontologiesMetadata]="ontologiesMetadata"
(ontologySelected)="getResourceClassesAndPropertiesForOntology($event)"></dsp-select-ontology>
(ontologySelected)="setActiveOntology($event)"></dsp-select-ontology>
</div>

<div class="select-resource-class">
<dsp-select-resource-class *ngIf="resourceClasses?.length > 0"
#resourceClass
[formGroup]="form"
[resourceClassDefinitions]="resourceClasses"
(resourceClassSelected)="getPropertiesForResourceClass($event)">
</dsp-select-resource-class>
</div>

<div class="select-property" *ngIf="properties !== undefined">
<div *ngFor="let prop of activeProperties; let i = index">

<dsp-select-property #property [activeResourceClass]="activeResourceClass" [formGroup]="form" [index]="i"
[properties]="properties"></dsp-select-property>

</div>
</div>

<div class="select-property buttons">
<button mat-mini-fab class="property-button add-property-button" color="primary" type="button"
(click)="addProperty()" [disabled]="activeOntology === undefined || activeProperties.length >= 4">
<mat-icon aria-label="add a property">add</mat-icon>
</button>

<button mat-mini-fab class="property-button remove-property-button" color="primary" type="button"
(click)="removeProperty()" [disabled]="activeProperties.length == 0">
<mat-icon aria-label="remove property">remove</mat-icon>
</button>
</div>
<dsp-resource-and-property-selection *ngIf="activeOntology !== undefined" #resAndPropSel [formGroup]="form" [activeOntology]="activeOntology">
</dsp-resource-and-property-selection>

<div class="dsp-form-action">
<button class="reset" mat-button type="button" (click)="resetForm()" [disabled]="this.activeOntology === undefined">
<button class="reset" mat-button type="button" (click)="resourceAndPropertySelection?.resetForm()" [disabled]="this.activeOntology === undefined">
Reset
</button>
<span class="fill-remaining-space"></span>
Expand Down
@@ -1,10 +1 @@
.select-resource-class {
margin-left: 8px;
}
.select-property {
margin-left: 16px;

.property-button {
margin: 0 12px 64px 0;
}
}