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

Feature/allow negative range in filter #3611

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions cypress/e2e/frontend/test_1_runQuery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,38 @@ const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

describe("Run query", () => {
beforeEach(() => {
// run these tests as if in a desktop
// browser with a 720p monitor
cy.viewport(1280, 720)

visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

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

// Drag concept to editor
cy.contains("Concept1").trigger("dragstart").trigger("dragleave");
cy.get("@queryEditor")
.trigger("dragenter")
.trigger("dragover")
.trigger("drop")
.trigger("dragend");

// Set money filter to a negative value
cy.get("@queryEditor").contains("Concept1").click()
cy.get("@queryEditor")
.find('[data-test-id="table-filter-dataset1.concept1.column.sum_money"]').as("money-filter")

cy.get("@money-filter").find('input').first().as("money-min-input")
cy.get("@money-filter").scrollIntoView()
// Unit should be automatically added
cy.get("@money-min-input").type("-4").should('have.value', '-4 €')

// Save the settings
cy.get("@queryEditor").contains("Speichern").click()

// Start query
cy.get("@queryEditor").find('[data-test-id="query-runner-button"]').click();

cy.get("@queryEditor").contains("Ergebnisse");
Expand All @@ -31,4 +50,15 @@ describe("Run query", () => {
cy.get("@leftPaneContainer").contains("Ergebnisse");
cy.get("@leftPaneContainer").contains("Concept1");
});

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

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

cy.get('[data-test-id="project-items-list"]').as("executionList");

cy.get('@executionList').find('[data-test-id="project-item-delete-button"]').click();
cy.get('@executionList').contains('Anfrage jetzt löschen').click();
});
});
4 changes: 3 additions & 1 deletion frontend/src/js/query-node-editor/TableFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ const TableFilter = ({
})();

return filterComponent ? (
<Container className={className}>{filterComponent}</Container>
<Container className={className} data-test-id={"table-filter-" + filter.id}>
{filterComponent}
</Container>
) : null;
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/js/ui-components/InputRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const InputRange = ({
type: "exact" | "max" | "min",
newValue: number | null,
) => {
const nextValue = exists(newValue) && newValue >= 0 ? newValue : null;
const nextValue = exists(newValue) ? newValue : null;

if (type === "exact") {
if (nextValue === null) {
Expand Down
Loading