Skip to content

test: add e2e test for relationships tab feature - #2500

Open
omkar-ethz wants to merge 4 commits into
masterfrom
relationships-e2e
Open

test: add e2e test for relationships tab feature#2500
omkar-ethz wants to merge 4 commits into
masterfrom
relationships-e2e

Conversation

@omkar-ethz

@omkar-ethz omkar-ethz commented Aug 13, 2026

Copy link
Copy Markdown
Member

Description

Adding Cypress tests for the Relationships tab feature introduced in #2416

  1. Check relationship table populated with correct values when feature is enabled
  2. Check Relationships tab is not displayed when feature is disabled

Feature under test:
Screenshot from 2026-08-13 11-23-47

Motivation

#2416 (review)

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Add end-to-end coverage for the dataset relationships tab behavior in the datasets dashboard.

Enhancements:

  • Tag the dataset details dashboard tab navigation with a data-cy attribute to support stable test selectors.

Tests:

  • Add Cypress e2e tests verifying the relationships table renders correct values when the feature is enabled.
  • Add Cypress e2e tests ensuring the Relationships tab is hidden when the feature is disabled via configuration.

Summary by Sourcery

Add end-to-end test coverage for the dataset relationships tab behavior and wire it with a stable UI test selector.

Enhancements:

  • Tag the dataset details dashboard tab navigation with a data-cy attribute to provide a stable selector for e2e tests.

Tests:

  • Add Cypress e2e tests verifying that the relationships table displays the expected relationship entries when the feature is enabled.
  • Add Cypress e2e tests verifying that the Relationships tab is hidden when the feature is disabled via frontend configuration.

@omkar-ethz
omkar-ethz marked this pull request as ready for review August 13, 2026 12:06
@omkar-ethz
omkar-ethz requested a review from a team as a code owner August 13, 2026 12:06

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The Cypress selectors for dataset rows (e.g. .dataset-table mat-row) are fairly brittle; consider adding dedicated data-cy attributes for the dataset table/rows similar to the new tab nav selector to make the tests less sensitive to DOM/layout changes.
  • The stubFrontendConfig helper is only called within individual tests; to avoid future tests accidentally relying on cached /admin/config responses, consider moving a default stub into beforeEach and letting tests override specific options when needed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Cypress selectors for dataset rows (e.g. `.dataset-table mat-row`) are fairly brittle; consider adding dedicated `data-cy` attributes for the dataset table/rows similar to the new tab nav selector to make the tests less sensitive to DOM/layout changes.
- The `stubFrontendConfig` helper is only called within individual tests; to avoid future tests accidentally relying on cached `/admin/config` responses, consider moving a default stub into `beforeEach` and letting tests override specific options when needed.

## Individual Comments

### Comment 1
<location path="cypress/e2e/datasets/datasets-relationships.cy.js" line_range="51-56" />
<code_context>
+      .contains("Relationships")
+      .click();
+    relationships.relationships.forEach((r, i) => {
+      const vals = [
+        r.identifierType == "URL" && r.externalId ? r.externalId : r.identifier,
+        r.entityType,
+        r.identifierType,
+      ];
+      Object.values(vals).forEach((v) => cy.get("mat-row").eq(i).contains(v));
+    });
+  });
</code_context>
<issue_to_address>
**suggestion:** Equality checks and the use of `Object.values` here could be simplified and made more robust.

Since `vals` is already an array, `Object.values(vals)` is unnecessary; iterate over `vals` directly for clarity. Also, prefer `===` over `==` for the `identifierType` comparison to avoid implicit type coercion. For example:

```js
const vals = [
  r.identifierType === "URL" && r.externalId ? r.externalId : r.identifier,
  r.entityType,
  r.identifierType,
];

vals.forEach((v) => cy.get("mat-row").eq(i).contains(v));
```

Suggested implementation:

```javascript
    cy.get("[data-cy=dataset-dashboard-tabs]")
      .contains("Relationships")
      .click();
    relationships.relationships.forEach((r, i) => {
      const vals = [
        r.identifierType === "URL" && r.externalId ? r.externalId : r.identifier,
        r.entityType,
        r.identifierType,
      ];

      vals.forEach((v) => cy.get("mat-row").eq(i).contains(v));
    });

```

The replacement assumes that the body of the `relationships.relationships.forEach` loop was previously empty or only contained assertions related to table cell values. If there are additional assertions or logic inside this loop elsewhere in the file, they should be preserved and placed after the `vals.forEach(...)` call to maintain the existing test behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread cypress/e2e/datasets/datasets-relationships.cy.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant