Skip to content

[UI][Auto] Project Secrets > creates a project-scoped secret and displays it in the list#413

Description

@yonasberhe23

Failure Details

Framework: Cypress
Suite: Project Secrets

Failing Environments

Version Environment User
head community @adminUser

Error Summary

expected 'p-k5qbd' to equal 'c-95tf4-p-fwwrc'

馃 AI Fix Suggestions

Explanation of Failure:

The test failed because the secret ID or name displayed in the list ('p-k5qbd') does not match the expected value ('c-95tf4-p-fwwrc'). This indicates a mismatch between the created secret's identifier and the one being validated in the test.


Likely Root Causes:

  1. Incorrect Secret Scope: The secret might have been created with a different scope (e.g., cluster-scoped instead of project-scoped), leading to a different ID prefix ('p-' vs. 'c-').
  2. Test Data Issue: The test might be using hardcoded or stale expected values ('c-95tf4-p-fwwrc') that do not align with the dynamically generated secret ID.
  3. UI or Backend Bug: The application may be incorrectly assigning or displaying the secret ID, possibly due to a bug in the backend or frontend logic.
  4. Test Timing Issue: The test might be asserting the secret ID before the secret creation process is fully completed, leading to inconsistent results.

Suggested Fix:

Code Snippet:

Update the test to dynamically fetch the created secret's ID instead of relying on hardcoded or static values. This ensures the test adapts to dynamically generated IDs.

// Locate the created secret dynamically and assert its presence
cy.get('[data-testid="create-secret-button"]').click();
cy.get('[data-testid="secret-name-input"]').type('test-secret');
cy.get('[data-testid="save-secret-button"]').click();

// Wait for the secret to appear in the list
cy.get('[data-testid="secret-list"]').contains('test-secret').should('exist');

// Dynamically fetch the secret ID from the list
cy.get('[data-testid="secret-list"]')
  .contains('test-secret')
  .parent() // Navigate to the parent element containing the ID
  .find('[data-testid="secret-id"]')
  .invoke('text')
  .then((secretId) => {
    // Assert that the secret ID starts with the correct prefix
    expect(secretId).to.match(/^p-/); // Adjust prefix based on scope
  });

Explanation of Fix:

  1. Dynamic Secret ID Retrieval: The test dynamically fetches the secret ID from the DOM instead of relying on hardcoded values.
  2. Validation of Scope Prefix: The test asserts that the secret ID starts with the expected prefix ('p-' for project-scoped secrets).
  3. Ensures Secret Creation Completeness: The test waits for the secret to appear in the list before performing assertions, avoiding timing issues.

This fix ensures the test is robust against dynamically generated IDs and aligns with the expected behavior of the application.


Auto-generated by CI Failure Inspector

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions