Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
17 changes: 10 additions & 7 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export default defineConfig({
screenshotsFolder: REPORTS.screenshots,
videosFolder: REPORTS.videos,
experimentalMemoryManagement: true,
Comment thread
pethers marked this conversation as resolved.
Outdated
video: true,
video: false, // Disable video by default to save time - can be enabled via env var

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

The comment and documentation claim video can be enabled via environment variable CYPRESS_VIDEO=true, but there's no implementation to read this environment variable and conditionally enable video recording. The video property is hardcoded to false. To fix this, update the line to: video: process.env.CYPRESS_VIDEO === 'true' || false,

Suggested change
video: false, // Disable video by default to save time - can be enabled via env var
video: process.env.CYPRESS_VIDEO === 'true' || false, // Disable video by default to save time - can be enabled via env var

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bf8bf30. Video recording now reads from CYPRESS_VIDEO environment variable: video: process.env.CYPRESS_VIDEO === 'true' || false

screenshotOnRunFailure: true,
trashAssetsBeforeRuns: true,
viewportWidth: 1280, // More focused viewport default
viewportHeight: 800, // More focused viewport default
retries: {
runMode: 2, // Increase retries for CI runs
openMode: 1, // Allow one retry in open mode
runMode: 1, // Reduce retries to speed up failing tests
openMode: 0, // No retries in open mode
},

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

The retries configuration is defined twice - at the top level (lines 28-31) and again within the e2e configuration (lines 202-205). This duplication is redundant. Remove one of these declarations to maintain cleaner configuration and prevent potential conflicts.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bf8bf30. Removed duplicate retries configuration from top level, kept only in e2e section. Also removed duplicate experimentalMemoryManagement from e2e section, kept only at top level.

reporter: "cypress-multi-reporters",
reporterOptions: {
Expand Down Expand Up @@ -200,11 +200,13 @@ export default defineConfig({
return config;
},
retries: {
runMode: 1,
runMode: 1, // Reduced retries for faster feedback
openMode: 0,
},
defaultCommandTimeout: 8000, // Slightly reduced from 10000
defaultCommandTimeout: 6000, // Reduced from 8000ms
chromeWebSecurity: false,
numTestsKeptInMemory: 10, // Reduce memory usage
experimentalMemoryManagement: true,
},
component: {
devServer: {
Expand All @@ -216,6 +218,7 @@ export default defineConfig({
},
},
waitForAnimations: false,
pageLoadTimeout: 10000,
requestTimeout: 5000,
pageLoadTimeout: 8000, // Reduced from 10000ms
requestTimeout: 4000, // Reduced from 5000ms
responseTimeout: 8000, // Add explicit response timeout
});
33 changes: 7 additions & 26 deletions cypress/e2e/business-outcomes/compliance-validation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Compliance Status Validation", () => {
});

it("accurately reflects compliance status based on security levels", () => {
// Define more resilient test scenarios with flexible assertions
// Reduced to 2 critical scenarios (low and high) - moderate is covered by beforeEach in other tests
const complianceScenarios = [
{
levels: [SECURITY_LEVELS.LOW, SECURITY_LEVELS.LOW, SECURITY_LEVELS.LOW],
Expand All @@ -25,18 +25,6 @@ describe("Compliance Status Validation", () => {
],
name: "low-security",
},
{
levels: [
SECURITY_LEVELS.MODERATE,
SECURITY_LEVELS.MODERATE,
SECURITY_LEVELS.MODERATE,
],
expectedTextPatterns: [
/moderate|partial|medium|some|limited/i,
/compliance|status|framework|requirement/i,
],
name: "moderate-security",
},
{
levels: [
SECURITY_LEVELS.HIGH,
Expand All @@ -54,13 +42,12 @@ describe("Compliance Status Validation", () => {
// Test each scenario with better error handling
complianceScenarios.forEach((scenario, index) => {
cy.log(`Testing compliance scenario ${index + 1}: ${scenario.name}`);
cy.screenshot(`compliance-scenario-start-${scenario.name}`);

// More reliable way to set security levels
cy.setSecurityLevels(...scenario.levels);
cy.wait(1000); // Wait for UI updates
cy.wait(500); // Reduced wait time

// Take screenshot for debugging
// Take screenshot for debugging (only 2 screenshots now instead of 6)
cy.screenshot(`compliance-scenario-${scenario.name}`);

// Search for compliance information using multiple strategies
Expand All @@ -86,9 +73,6 @@ describe("Compliance Status Validation", () => {
}
});
}

// Take a screenshot regardless of result for debugging
cy.screenshot(`compliance-content-${scenario.name}`);
});
});
});
Expand All @@ -100,7 +84,7 @@ describe("Compliance Status Validation", () => {
SECURITY_LEVELS.HIGH,
SECURITY_LEVELS.HIGH
);
cy.wait(1000);
cy.wait(500); // Reduced wait time

// Look for compliance-related elements using multiple selectors
const complianceSelectors = [
Expand All @@ -114,8 +98,7 @@ describe("Compliance Status Validation", () => {
cy.get("body").then(($body) => {
if ($body.find(complianceSelectors).length > 0) {
cy.get(complianceSelectors).first().scrollIntoView();
cy.get(complianceSelectors).first().screenshot("compliance-element");


// Try to find clickable items
const clickableSelectors = [
'[data-testid*="framework"] button',
Expand All @@ -128,15 +111,13 @@ describe("Compliance Status Validation", () => {

if ($body.find(clickableSelectors).length > 0) {
cy.get(clickableSelectors).first().click({ force: true });
cy.wait(500);
cy.screenshot("after-framework-click");
cy.wait(300); // Reduced wait time
cy.log("✓ Successfully clicked on framework item");
} else {
cy.log("⚠️ No clickable framework items found");
cy.screenshot("no-clickable-frameworks");
}
} else {
cy.log("⚠️ No compliance elements found");
cy.screenshot("no-compliance-elements");
}
});
});
Expand Down
36 changes: 23 additions & 13 deletions cypress/e2e/screenshots/widget-screenshots.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,51 @@ describe("Widget UI/UX Screenshots", () => {
const viewportWidth = 1920;
const viewportHeight = 1080;

// Essential widgets to capture in different themes
// Reduced to only critical widgets to capture - reduces test time significantly
const essentialWidgets = [
"security-level",
"business-impact",
"security-summary",
"compliance-status",
"technical-details",
"security-visualization",
"value-creation",
];

// Only run screenshot tests when explicitly enabled or on scheduled runs
before(function() {
if (!Cypress.env('CAPTURE_SCREENSHOTS') && Cypress.config('isInteractive')) {
cy.log('Skipping screenshot tests - set CAPTURE_SCREENSHOTS=true to enable');

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

The environment variable check pattern is inconsistent with widget-testing-template.ts which uses CYPRESS_SCREENSHOTS with string comparison. This uses CAPTURE_SCREENSHOTS with boolean logic. Consider standardizing the environment variable naming and checking pattern across all test files for consistency.

Suggested change
if (!Cypress.env('CAPTURE_SCREENSHOTS') && Cypress.config('isInteractive')) {
cy.log('Skipping screenshot tests - set CAPTURE_SCREENSHOTS=true to enable');
if (Cypress.env('CYPRESS_SCREENSHOTS') !== 'true' && Cypress.config('isInteractive')) {
cy.log('Skipping screenshot tests - set CYPRESS_SCREENSHOTS=true to enable');

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bf8bf30. Standardized to use CYPRESS_SCREENSHOTS environment variable across all test files for consistency. Changed check to: if (Cypress.env('CYPRESS_SCREENSHOTS') !== 'true' && Cypress.config('isInteractive'))

this.skip();
}
});

beforeEach(() => {
cy.visit("/");
cy.ensureAppLoaded();
cy.viewport(viewportWidth, viewportHeight);
applyTestStyles();
});

it("captures full dashboard grid with widgets in light and dark mode", () => {
it("captures full dashboard grid in light mode only", () => {
// Set wider viewport to ensure all columns are visible
cy.viewport(2400, 1200);
// Ensure grid layout is properly displayed
cy.get('[data-testid="dashboard-grid"]').should("be.visible");

// Capture optimized grid screenshots only (no HTML)
captureFullDashboardGrid("dashboard-grid");
// Capture only light mode to reduce test time by 50%
cy.screenshot("dashboard-grid-light", { capture: "viewport" });
});

it("captures essential widgets in both light and dark themes", () => {
// For each essential widget, capture both light and dark themes
it("captures essential widgets in light theme only", () => {
// Capture only light theme to reduce test time - dark theme can be tested separately if needed
essentialWidgets.forEach((widgetName) => {
cy.log(`Capturing themes for widget: ${widgetName}`);
cy.log(`Capturing widget: ${widgetName}`);

// Use the simplified capture function
captureSimpleWidgetThemes(widgetName);
// Simplified capture - just take a single screenshot
cy.findWidget(widgetName).then(($widget) => {
if ($widget.length > 0) {
cy.wrap($widget.first()).screenshot(`widget-${widgetName}-light`, {
overwrite: true,
});
}
});
});
});
});
38 changes: 11 additions & 27 deletions cypress/e2e/security/security-level-transitions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Security Level Transitions", () => {
});

it("maintains application integrity during security level changes", () => {
// Define only critical transitions to test
// Reduced to only the most critical transition to test (low to high covers edge cases)
const securityTransitions = [
{
from: [
Expand All @@ -49,19 +49,6 @@ describe("Security Level Transitions", () => {
] as const,
name: "low-to-high",
},
{
from: [
SECURITY_LEVELS.HIGH,
SECURITY_LEVELS.HIGH,
SECURITY_LEVELS.HIGH,
] as const,
to: [
SECURITY_LEVELS.HIGH,
SECURITY_LEVELS.LOW,
SECURITY_LEVELS.MODERATE,
] as const,
name: "high-to-mixed",
},
];

// Test each transition with better error handling
Expand All @@ -79,12 +66,10 @@ describe("Security Level Transitions", () => {
transition.from[1],
transition.from[2]
);
cy.wait(1000);
cy.wait(500); // Reduced wait time

// Take screenshot only if it's the first transition
if (index === 0) {
cy.screenshot(`transition-initial-${transition.name}`);
}
// Take screenshot only once
cy.screenshot(`transition-initial-${transition.name}`);

// Look for important widgets to verify initial state
findImportantWidgets().then((widgets) => {
Expand All @@ -101,12 +86,10 @@ describe("Security Level Transitions", () => {
transition.to[1],
transition.to[2]
);
cy.wait(1000);
cy.wait(500); // Reduced wait time

// Take screenshot only if it's the first transition
if (index === 0) {
cy.screenshot(`transition-after-${transition.name}`);
}
// Take screenshot after transition
cy.screenshot(`transition-after-${transition.name}`);

// Check widgets after transition
findImportantWidgets().then((newWidgets) => {
Expand All @@ -121,7 +104,7 @@ describe("Security Level Transitions", () => {
"Number of widgets shouldn't decrease significantly during transitions"
);

// Process each widget after transition
// Process each widget after transition - reduced screenshot overhead
cy.wrap(newWidgets).each(($widget, i) => {
const id = $widget.attr("data-testid") || `widget-${i}`;

Expand Down Expand Up @@ -196,6 +179,7 @@ describe("Security Level Transitions", () => {
if (hasProblems) {
const id = $widget.attr("data-testid") || "unknown";
cy.log(`⚠️ Widget ${id} contains problematic content`);
// Only take screenshot on actual problems
cy.wrap($widget).screenshot(`widget-problematic-${id}`);
}
}
Expand All @@ -213,16 +197,16 @@ describe("Security Level Transitions", () => {
// Content should change, but shouldn't be empty
if (newText.trim().length === 0) {
cy.log(`⚠️ Widget ${id} content is empty after transition`);
// Only screenshot on error
cy.wrap($widget).screenshot(`widget-empty-${id}`);
}

// Log significant changes
// Log significant changes but don't screenshot (saves time)
if (
initialContent.length > 0 &&
newText.length < initialContent.length * 0.5
) {
cy.log(`⚠️ Widget ${id} content reduced significantly`);
cy.wrap($widget).screenshot(`widget-reduced-${id}`);
}

// Changes in content are expected and good
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/widgets/assessmentcenter/business-impact.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const additionalTests = () => {
SECURITY_LEVELS.HIGH,
SECURITY_LEVELS.HIGH
);
cy.wait(1000);
cy.wait(500); // Reduced wait time

// Get current widget
cy.get("@currentWidget").then(($widget) => {
Expand All @@ -75,8 +75,8 @@ const additionalTests = () => {
return;
}

// Take screenshot of high security state
cy.wrap($widget).screenshot("business-impact-high-security");
// Verify widget is still visible
expect($widget).to.be.visible;
});
});
};
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/widgets/assessmentcenter/security-level.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const additionalTests = () => {
// Verify the selection happened
cy.wrap($selects).first().should("have.value", SECURITY_LEVELS.HIGH);

// Screenshot for documentation
cy.wrap($widget).screenshot("security-level-selection");
// Log for documentation (no screenshot needed)
cy.log("✓ Security level selection verified");
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/widgets/assessmentcenter/security-summary.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const additionalTests = () => {
});
});

// Take screenshot for documentation
cy.wrap($widget).screenshot("security-summary-indicators");
// Log for documentation (no screenshot needed)
cy.log("✓ Security level indicators check completed");
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const additionalTests = () => {
});

// Screenshot for documentation
cy.wrap($widget).screenshot("compliance-frameworks");
cy.log("✓ Compliance frameworks check completed");
});
});
});
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/widgets/businessvalue/cost-estimation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ const additionalTests = () => {
});
});

// Take screenshot for documentation
cy.wrap($widget).screenshot("cost-estimation-content");
cy.log("✓ Cost estimation content verified");
});
});
});
Expand Down Expand Up @@ -93,8 +92,7 @@ const additionalTests = () => {
expect(highSecurityContent).not.to.equal(lowSecurityContent);
});

// Take screenshot for documentation
cy.wrap($widget).screenshot("cost-estimation-high-security");
cy.log("✓ Cost estimation high security verified");
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/widgets/businessvalue/value-creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const additionalTests = () => {
});

// Take screenshot for documentation - FIX: Since we're already in a single element's context, this is fine
cy.wrap($widget).screenshot("value-creation-metrics");
cy.log("✓ Value creation metrics verified");
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const additionalTests = () => {
});

// Screenshot for documentation
cy.wrap($widget).screenshot("availability-metrics");
cy.log("✓ Availability metrics check completed");
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const additionalTests = () => {
});

// Screenshot for documentation
cy.wrap($widget).screenshot("confidentiality-concepts");
cy.log("✓ Confidentiality concepts check completed");
});
});
});
Expand Down
Loading
Loading