Skip to content

Commit

Permalink
Merge pull request #3655 from ingef/fix/e2e-combine-dependent-items
Browse files Browse the repository at this point in the history
combine query execution test case as they are not independent
  • Loading branch information
thoniTUB authored Jan 27, 2025
2 parents b61bfee + e06a22f commit 9b3f3b3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ public record TimeStratifiedSelects(@NotNull String label, String description, @
@JsonIgnore
public boolean isSelectsUnique() {
return timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).map(InfoCardSelect::select).distinct().count()
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).count();
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).mapToLong(Collection::size).sum();
}

@ValidationMethod(message = "Labels must be unique.")
@JsonIgnore
public boolean isLabelsUnique() {
return timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).map(InfoCardSelect::label).distinct().count()
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).count();
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).mapToLong(Collection::size).sum();
}

@JsonIgnore
Expand Down Expand Up @@ -178,7 +178,7 @@ public String resolveSelectLabel(SelectResultInfo info) {
public List<Select> getSelects() {
return getInfoCardSelects().stream()
.map(InfoCardSelect::select)
.map(SelectId::<Select>resolve)
.map(SelectId::resolve)
.collect(Collectors.toList());
}

Expand All @@ -200,10 +200,10 @@ public ConceptId resolveSearchConcept() {


return searchFilters.stream()
.map(FilterId::<Filter<?>>resolve)
.map(FilterId::resolve)
.map(filter -> filter.getConnector().getConcept())
.distinct()
.map(Concept::getId)
.collect(MoreCollectors.onlyElement());
.collect(MoreCollectors.toOptional()).orElse(null);
}
}
10 changes: 5 additions & 5 deletions cypress/e2e/frontend/test_1_runQuery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Run query", () => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

it("Can execute query and see it in the queries tab", () => {
it("Can execute query, see it in the queries tab and delete it", () => {
cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor");

// Drag concept to editor
Expand Down Expand Up @@ -40,18 +40,16 @@ describe("Run query", () => {
cy.get("@queryEditor").find('[data-test-id="query-runner-button"]').click();

cy.get("@queryEditor").contains("Ergebnisse");
});

it("Can see the executed query in the queries tab", () => {
// Lookup executed query in the previous queries tab
cy.get('[data-test-id="left-pane"]').contains("Anfragen").click();

cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer");

cy.get("@leftPaneContainer").contains("Ergebnisse");
cy.get("@leftPaneContainer").contains("Concept1");
});

it("Can delete the query", () => {
// Delete the Query
cy.get('[data-test-id="left-pane"]').contains("Anfragen").click();

cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer");
Expand All @@ -60,6 +58,8 @@ describe("Run query", () => {

cy.get('@executionList').find('[data-test-id="project-item-delete-button"]').click();
cy.get('@executionList').contains('Anfrage jetzt löschen').click();

cy.get('@leftPaneContainer').contains('Keine Anfragen / Formulare gefunden')
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const DeleteProjectItemButton = ({ item }: { item: ProjectItemT }) => {
<IconButton
icon={faTimes}
bare
title="delete"
data-test-id="project-item-delete-button"
/>
</WithTooltip>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/js/previous-queries/list/ProjectItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ const ProjectItem = forwardRef<
<IconButton
icon={isShared ? faUser : faUserRegular}
bare
title="share"
data-test-id="share"
onClick={onIndicateShare}
/>
</WithTooltip>
Expand Down

0 comments on commit 9b3f3b3

Please sign in to comment.