-
Notifications
You must be signed in to change notification settings - Fork 35
fix: preserve condition values when updating user settings #2203
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
base: master
Are you sure you want to change the base?
Changes from all commits
797aa56
70f419e
1154640
69147b6
76f2a4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -669,4 +669,61 @@ describe("Datasets general", () => { | |
| .should("be.visible"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("Condition value persistence after navigation", () => { | ||
| beforeEach(() => { | ||
| cy.login(Cypress.env("username"), Cypress.env("password")); | ||
| cy.createDataset({ | ||
| type: "raw", | ||
| dataFileSize: "small", | ||
| scientificMetadata: { | ||
| run_number: { type: "number", value: 76129, unit: "" }, | ||
| }, | ||
| }); | ||
| cy.visit("/datasets"); | ||
| }); | ||
|
|
||
| it("should persist condition values after navigating away and back", () => { | ||
| cy.get('[data-cy="scientific-condition-filter-list"]').within(() => { | ||
| cy.get('[data-cy="add-condition-button"]').click(); | ||
| }); | ||
|
|
||
| cy.get('input[name="lhs"]').type("run_number"); | ||
|
|
||
| cy.get("mat-dialog-container").find('button[type="submit"]').click(); | ||
|
|
||
| cy.get(".condition-panel").first().click(); | ||
|
|
||
| cy.get(".condition-panel") | ||
| .first() | ||
| .within(() => { | ||
| cy.get("mat-select").click(); | ||
| }); | ||
| cy.get("mat-option").contains(">").click(); | ||
|
|
||
| cy.get(".condition-panel") | ||
| .first() | ||
| .within(() => { | ||
| cy.get("input[matInput]").eq(0).clear().type("19"); | ||
| }); | ||
|
|
||
| cy.get('[data-cy="filter-search-button"]').click(); | ||
|
|
||
| cy.get(".dataset-table mat-row").first().click(); | ||
|
|
||
| cy.get('[data-cy="edit-general-information"]').should("exist"); | ||
|
|
||
| cy.go('back'); | ||
|
|
||
| cy.get(".condition-panel") | ||
| .first() | ||
| .find("mat-panel-title") | ||
| .should("contain", ">") | ||
| .and("contain", "19"); | ||
|
Comment on lines
+716
to
+722
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Selectors in the new test are fairly generic and may be brittle over time. The assertions after Suggested implementation: cy.go('back');
cy.get('[data-cy="condition-panel"]')
.first()
.within(() => {
cy.get('[data-cy="condition-operator"]').should("contain", ">");
cy.get('[data-cy="condition-value"]').should("contain", "19");
});To make this test pass and keep it robust, you’ll need to:
|
||
|
|
||
| cy.get(".condition-panel").first().click(); | ||
|
|
||
| cy.get('[data-cy="remove-condition-button"]').click(); | ||
| }); | ||
| }) | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -748,8 +748,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy { | |
| index: number, | ||
| newOperator: ScientificCondition["relation"], | ||
| ) { | ||
| delete this.tempConditionValues[index]; | ||
|
|
||
|
Comment on lines
-751
to
-752
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain why this line is removed? |
||
| const updates: Partial<ScientificCondition> = { | ||
| relation: newOperator, | ||
| rhs: newOperator === "RANGE" ? [undefined, undefined] : "", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use generic selector here to make the test stable, e.g, check if mat-card exist or not.
The edit button displays based on user permission and do not exist in the dynamic dataset detail view.