From e21a9caae2d44514dba265dbd6ea1df7b4db8a5d Mon Sep 17 00:00:00 2001 From: jbpratt Date: Fri, 2 Jan 2026 16:21:30 -0600 Subject: [PATCH] test(web): fix service-keys tests failing due to past expiration dates (#4768) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded expiration date '2025-12-31T23:59' with dynamically generated future date. The tests were failing with "Expiration date must be in the future" validation error since it's now 2026. Added getFutureExpirationDate() helper that returns a date 1 year from now in the required datetime-local format. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 --- web/cypress/e2e/superuser-service-keys.cy.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/web/cypress/e2e/superuser-service-keys.cy.ts b/web/cypress/e2e/superuser-service-keys.cy.ts index 1a0b09b51..f9b840571 100644 --- a/web/cypress/e2e/superuser-service-keys.cy.ts +++ b/web/cypress/e2e/superuser-service-keys.cy.ts @@ -1,5 +1,15 @@ /// +/** + * Generate a future expiration date string for datetime-local input + * Returns a date 1 year from now in the format "YYYY-MM-DDTHH:mm" + */ +function getFutureExpirationDate(): string { + const futureDate = new Date(); + futureDate.setFullYear(futureDate.getFullYear() + 1); + return futureDate.toISOString().slice(0, 16); +} + describe('Service Keys Management', () => { before(() => { cy.exec('npm run quay:seed'); @@ -322,7 +332,7 @@ describe('Service Keys Management', () => { // Fill out required form fields cy.get('#service-name').type('new_service'); // Must match [a-z0-9_]+ pattern cy.get('#key-name').type('New Test Key'); - cy.get('#expiration').type('2025-12-31T23:59'); // Required field + cy.get('#expiration').type(getFutureExpirationDate()); // Required field // Submit form cy.get('[data-testid="create-key-submit"]').click(); @@ -356,7 +366,7 @@ describe('Service Keys Management', () => { cy.get('[data-testid="create-key-submit"]').should('be.disabled'); // Fill all required fields - cy.get('#expiration').type('2025-12-31T23:59'); + cy.get('#expiration').type(getFutureExpirationDate()); // Submit button should now be enabled cy.get('[data-testid="create-key-submit"]').should('not.be.disabled'); @@ -382,7 +392,7 @@ describe('Service Keys Management', () => { cy.get('#create-service-key-button').click(); cy.get('#service-name').type('existing_service'); // Must match [a-z0-9_]+ pattern cy.get('#key-name').type('Test Key'); - cy.get('#expiration').type('2025-12-31T23:59'); // Required field + cy.get('#expiration').type(getFutureExpirationDate()); // Required field // Submit form cy.get('[data-testid="create-key-submit"]').click();