diff --git a/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin.cy.ts b/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_1.cy.ts similarity index 81% rename from web/cypress/e2e/monitoring/regression/02.reg_metrics_admin.cy.ts rename to web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_1.cy.ts index 9d49c10c..109bebfd 100644 --- a/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin.cy.ts +++ b/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_1.cy.ts @@ -1,5 +1,5 @@ -import { runAllRegressionMetricsTests } from '../../../support/monitoring/02.reg_metrics.cy'; -import { runAllRegressionMetricsTestsNamespace } from '../../../support/monitoring/05.reg_metrics_namespace.cy'; +import { runAllRegressionMetricsTests1 } from '../../../support/monitoring/02.reg_metrics_1.cy'; +import { runAllRegressionMetricsTestsNamespace1 } from '../../../support/monitoring/05.reg_metrics_namespace_1.cy'; import { commonPages } from '../../../views/common'; import { nav } from '../../../views/nav'; import { guidedTour } from '../../../views/tour'; @@ -26,7 +26,7 @@ describe('Regression: Monitoring - Metrics (Administrator)', { tags: ['@monitori }); // Run tests in Administrator perspective - runAllRegressionMetricsTests({ + runAllRegressionMetricsTests1({ name: 'Administrator', }); @@ -49,7 +49,7 @@ describe('Regression: Monitoring - Metrics Namespaced (Administrator)', { tags: }); // Run tests in Administrator perspective - runAllRegressionMetricsTestsNamespace({ + runAllRegressionMetricsTestsNamespace1({ name: 'Administrator', }); diff --git a/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_2.cy.ts b/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_2.cy.ts new file mode 100644 index 00000000..52242d6c --- /dev/null +++ b/web/cypress/e2e/monitoring/regression/02.reg_metrics_admin_2.cy.ts @@ -0,0 +1,57 @@ +import { runAllRegressionMetricsTests2 } from '../../../support/monitoring/02.reg_metrics_2.cy'; +import { runAllRegressionMetricsTestsNamespace2 } from '../../../support/monitoring/05.reg_metrics_namespace_2.cy'; +import { commonPages } from '../../../views/common'; +import { nav } from '../../../views/nav'; +import { guidedTour } from '../../../views/tour'; + +const MP = { + namespace: 'openshift-monitoring', + operatorName: 'Cluster Monitoring Operator', +}; + +// Test suite for Administrator perspective +describe('Regression: Monitoring - Metrics (Administrator)', { tags: ['@monitoring', '@metrics'] }, () => { + + before(() => { + cy.beforeBlock(MP); + }); + + beforeEach(() => { + cy.visit('/'); + guidedTour.close(); + cy.validateLogin(); + nav.sidenav.clickNavLink(['Observe', 'Metrics']); + commonPages.titleShouldHaveText('Metrics'); + cy.changeNamespace("All Projects"); + }); + + // Run tests in Administrator perspective + runAllRegressionMetricsTests2({ + name: 'Administrator', + }); + +}); + +// Test suite for Administrator perspective +describe('Regression: Monitoring - Metrics Namespaced (Administrator)', { tags: ['@monitoring', '@metrics'] }, () => { + + before(() => { + cy.beforeBlock(MP); + }); + + beforeEach(() => { + cy.visit('/'); + guidedTour.close(); + cy.validateLogin(); + nav.sidenav.clickNavLink(['Observe', 'Metrics']); + commonPages.titleShouldHaveText('Metrics'); + cy.changeNamespace(MP.namespace); + }); + + // Run tests in Administrator perspective + runAllRegressionMetricsTestsNamespace2({ + name: 'Administrator', + }); + +}); + diff --git a/web/cypress/e2e/virtualization/02.coo_ivt_metrics.cy.ts b/web/cypress/e2e/virtualization/02.coo_ivt_metrics_1.cy.ts similarity index 90% rename from web/cypress/e2e/virtualization/02.coo_ivt_metrics.cy.ts rename to web/cypress/e2e/virtualization/02.coo_ivt_metrics_1.cy.ts index 40cb69b1..1236c6f1 100644 --- a/web/cypress/e2e/virtualization/02.coo_ivt_metrics.cy.ts +++ b/web/cypress/e2e/virtualization/02.coo_ivt_metrics_1.cy.ts @@ -1,6 +1,6 @@ import { alerts } from '../../fixtures/monitoring/alert'; -import { runAllRegressionMetricsTests } from '../../support/monitoring/02.reg_metrics.cy'; -import { runAllRegressionMetricsTestsNamespace } from '../../support/monitoring/05.reg_metrics_namespace.cy'; +import { runAllRegressionMetricsTests1 } from '../../support/monitoring/02.reg_metrics_1.cy'; +import { runAllRegressionMetricsTestsNamespace1 } from '../../support/monitoring/05.reg_metrics_namespace_1.cy'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; @@ -71,7 +71,7 @@ describe('Regression: Monitoring - Metrics (Virtualization)', { tags: ['@virtual alerts.getWatchdogAlert(); }); - runAllRegressionMetricsTests({ + runAllRegressionMetricsTests1({ name: 'Virtualization', }); @@ -91,7 +91,7 @@ describe('Regression: Monitoring - Metrics Namespaced (Virtualization)', { tags: alerts.getWatchdogAlert(); }); - runAllRegressionMetricsTestsNamespace({ + runAllRegressionMetricsTestsNamespace1({ name: 'Virtualization', }); diff --git a/web/cypress/e2e/virtualization/02.coo_ivt_metrics_2.cy.ts b/web/cypress/e2e/virtualization/02.coo_ivt_metrics_2.cy.ts new file mode 100644 index 00000000..eea255db --- /dev/null +++ b/web/cypress/e2e/virtualization/02.coo_ivt_metrics_2.cy.ts @@ -0,0 +1,98 @@ +import { alerts } from '../../fixtures/monitoring/alert'; +import { runAllRegressionMetricsTests2 } from '../../support/monitoring/02.reg_metrics_2.cy'; +import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring/05.reg_metrics_namespace_2.cy'; +import { commonPages } from '../../views/common'; +import { nav } from '../../views/nav'; +import { guidedTour } from '../../views/tour'; + +// Set constants for the operators that need to be installed for tests. +const MCP = { + namespace: 'openshift-cluster-observability-operator', + packageName: 'cluster-observability-operator', + operatorName: 'Cluster Observability Operator', + config: { + kind: 'UIPlugin', + name: 'monitoring', + }, +}; +const MP = { + namespace: 'openshift-monitoring', + operatorName: 'Cluster Monitoring Operator', +}; + +const KBV = { + namespace: 'openshift-cnv', + packageName: 'kubevirt-hyperconverged', + config: { + kind: 'HyperConverged', + name: 'kubevirt-hyperconverged', + }, + crd: { + kubevirt: 'kubevirts.kubevirt.io', + hyperconverged: 'hyperconvergeds.hco.kubevirt.io', + } +}; + +describe('Installation: COO and setting up Monitoring Plugin', { tags: ['@virtualization', '@slow'] }, () => { + + before(() => { + cy.beforeBlockCOO(MCP, MP); + }); + + it('1. Installation: COO and setting up Monitoring Plugin', () => { + cy.log('Installation: COO and setting up Monitoring Plugin'); + }); +}); + +describe('IVT: Monitoring UIPlugin + Virtualization', { tags: ['@virtualization', '@slow'] }, () => { + + before(() => { + cy.beforeBlockVirtualization(KBV); + }); + + it('1. Virtualization perspective - Observe Menu', () => { + cy.log('Virtualization perspective - Observe Menu and verify all submenus'); + cy.switchPerspective('Virtualization'); + guidedTour.closeKubevirtTour(); + }); +}); + +describe('Regression: Monitoring - Metrics (Virtualization)', { tags: ['@virtualization', '@metrics'] }, () => { + + beforeEach(() => { + cy.visit('/'); + cy.validateLogin(); + cy.switchPerspective('Virtualization'); + guidedTour.closeKubevirtTour(); + alerts.getWatchdogAlert(); + nav.sidenav.clickNavLink(['Observe', 'Metrics']); + commonPages.titleShouldHaveText('Metrics'); + cy.changeNamespace("All Projects"); + alerts.getWatchdogAlert(); + }); + + runAllRegressionMetricsTests2({ + name: 'Virtualization', + }); + +}); + +describe('Regression: Monitoring - Metrics Namespaced (Virtualization)', { tags: ['@virtualization', '@metrics'] }, () => { + + beforeEach(() => { + cy.visit('/'); + cy.validateLogin(); + cy.switchPerspective('Virtualization'); + guidedTour.closeKubevirtTour(); + alerts.getWatchdogAlert(); + nav.sidenav.clickNavLink(['Observe', 'Metrics']); + commonPages.titleShouldHaveText('Metrics'); + cy.changeNamespace(MP.namespace); + alerts.getWatchdogAlert(); + }); + + runAllRegressionMetricsTestsNamespace2({ + name: 'Virtualization', + }); + +}); \ No newline at end of file diff --git a/web/cypress/fixtures/coo/force_delete_ns.sh b/web/cypress/fixtures/coo/force_delete_ns.sh new file mode 100755 index 00000000..1cfbbfbb --- /dev/null +++ b/web/cypress/fixtures/coo/force_delete_ns.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Script to force-delete a Kubernetes Namespace stuck in a 'Terminating' state +# by automatically clearing its finalizers using sed and tr (instead of jq). + +NAMESPACE=$1 +KUBECONFIG_PATH=$2 + +echo "NAMESPACE: $NAMESPACE" +echo "KUBECONFIG_PATH: $KUBECONFIG_PATH" + +# --- Input Validation --- +if [ -z "$NAMESPACE" ]; then + echo "Error: Please provide the namespace name as the first argument." + echo "Usage: ./force-delete-ns.sh [kubeconfig-path]" + exit 1 +fi + +# Build kubeconfig flag if provided +KUBECONFIG_FLAG="" +if [ -n "$KUBECONFIG_PATH" ]; then + KUBECONFIG_FLAG="--kubeconfig $KUBECONFIG_PATH" +fi + +# Check if the namespace exists +if ! oc get namespace "$NAMESPACE" $KUBECONFIG_FLAG &> /dev/null; then + echo "Namespace '$NAMESPACE' not found or already deleted." + exit 0 +fi + +echo "Attempting to force-delete namespace '$NAMESPACE' by removing finalizers..." + +# Step 1: Remove finalizers from common problematic resources +echo "Checking for resources with finalizers in namespace '$NAMESPACE'..." +# Focus on common resources that have finalizers (much faster than checking everything) +RESOURCE_TYPES="perses,persesdashboard,persistentvolumeclaims,pods,services,deployments,statefulsets,daemonsets" + +for resource_type in $(echo $RESOURCE_TYPES | tr ',' ' '); do + oc get "$resource_type" -n "$NAMESPACE" $KUBECONFIG_FLAG -o name 2>/dev/null | \ + while read -r item; do + if [ -n "$item" ]; then + # Check if the resource has finalizers + HAS_FINALIZERS=$(oc get "$item" -n "$NAMESPACE" $KUBECONFIG_FLAG -o jsonpath='{.metadata.finalizers}' 2>/dev/null || echo "") + if [ -n "$HAS_FINALIZERS" ] && [ "$HAS_FINALIZERS" != "[]" ]; then + echo " Removing finalizers from $item..." + oc patch "$item" -n "$NAMESPACE" $KUBECONFIG_FLAG --type json -p '[{"op": "remove", "path": "/metadata/finalizers"}]' 2>/dev/null || true + fi + fi + done +done + +# Step 2: Remove finalizers from the namespace itself (if it still exists) +# Check if namespace still exists before trying to remove its finalizers +if oc get namespace "$NAMESPACE" $KUBECONFIG_FLAG &> /dev/null; then + # 1. Retrieve the namespace JSON. + # 2. Use 'tr' to remove all newlines, creating a single-line JSON string. + # 3. Use 'sed' to perform a substitution: + # - It finds the pattern "finalizers": [ ] + # - It replaces the entire pattern with "finalizers": [] (an empty array). + # 4. Pipe the modified JSON directly to the Kubernetes /finalize endpoint. + echo "Removing finalizers from namespace '$NAMESPACE' itself..." + oc get namespace "$NAMESPACE" $KUBECONFIG_FLAG -o json | \ + tr -d '\n' | \ + sed 's/"finalizers": \[[^]]*\]/"finalizers": []/' | \ + oc replace $KUBECONFIG_FLAG --raw "/api/v1/namespaces/$NAMESPACE/finalize" -f - + + EXIT_CODE=$? + + if [ $EXIT_CODE -eq 0 ]; then + echo "" + echo "✅ Success: Finalizers for namespace '$NAMESPACE' have been cleared." + echo "The Namespace should now be fully deleted. Confirm with: oc get ns" + else + echo "" + echo "❌ Error: The command failed with exit code $EXIT_CODE." + echo "Please check your oc connection and the namespace name." + fi +else + echo "" + echo "✅ Success: Namespace '$NAMESPACE' was already deleted after removing resource finalizers." + EXIT_CODE=0 +fi \ No newline at end of file diff --git a/web/cypress/support/commands/operator-commands.ts b/web/cypress/support/commands/operator-commands.ts index afbb3d90..c2a819e0 100644 --- a/web/cypress/support/commands/operator-commands.ts +++ b/web/cypress/support/commands/operator-commands.ts @@ -372,9 +372,9 @@ const operatorUtils = { }); cy.exec( - `sleep 15 && oc wait --for=condition=Ready pods --selector=app.kubernetes.io/instance=perses -n ${MCP.namespace} --timeout=60s --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + `sleep 15 && oc wait --for=condition=Ready pods --selector=app.kubernetes.io/instance=perses -n ${MCP.namespace} --timeout=600s --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, { - timeout: readyTimeoutMilliseconds, + timeout: installTimeoutMilliseconds, failOnNonZeroExit: true } ).then((result) => { @@ -484,28 +484,104 @@ const operatorUtils = { if (checkResult.code === 0) { // Namespace exists, proceed with deletion cy.log('Namespace exists, proceeding with deletion'); - cy.executeAndDelete( - `oc delete namespace ${MCP.namespace} --ignore-not-found --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + cy.log('Eve'); + + // Step 1: Delete CSV (ClusterServiceVersion) + cy.exec( + `oc delete csv --all -n ${MCP.namespace} --ignore-not-found --wait=false --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + { + timeout: 30000, + failOnNonZeroExit: false + } ).then((result) => { if (result.code === 0) { - cy.log(`Cluster Observability Operator namespace is now deleted`); + cy.log(`CSV deletion initiated in ${MCP.namespace}`); } else { - cy.log(`Primary delete failed: ${result.stderr}`); - cy.log(`Attempting force delete...`); - - cy.exec( - `./cypress/fixtures/coo/force_delete_ns.sh ${MCP.namespace} --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, - { - failOnNonZeroExit: false, - timeout: readyTimeoutMilliseconds - } - ).then((forceResult) => { - if (forceResult.code !== 0) { - cy.log(`Force delete also failed: ${forceResult.stderr}`); + cy.log(`CSV deletion failed or not found: ${result.stderr}`); + } + }); + + // Step 2: Delete Subscription + cy.exec( + `oc delete subscription --all -n ${MCP.namespace} --ignore-not-found --wait=false --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + { + timeout: 30000, + failOnNonZeroExit: false + } + ).then((result) => { + if (result.code === 0) { + cy.log(`Subscription deletion initiated in ${MCP.namespace}`); + } else { + cy.log(`Subscription deletion failed or not found: ${result.stderr}`); + } + }); + + // Step 3: Initiate namespace deletion without waiting (--wait=false prevents timeout) + cy.exec( + `oc delete namespace ${MCP.namespace} --ignore-not-found --wait=false --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + { + timeout: 30000, // Short timeout since we're not waiting + failOnNonZeroExit: false + } + ).then((result) => { + if (result.code === 0) { + cy.log(`Namespace deletion initiated for ${MCP.namespace}`); + } else { + cy.log(`Failed to initiate deletion: ${result.stderr}`); + } + }); + + + const checkIntervalMs = 15000; // Check every 15 seconds + const startTime = Date.now(); + const maxWaitTimeMs = 600000; //10min + + const checkStatus = () => { + const elapsed = Date.now() - startTime; + + if (elapsed > maxWaitTimeMs) { + cy.log(`${elapsed}ms - Timeout reached (${maxWaitTimeMs / 60000}m). Namespace ${MCP.namespace} still terminating. Attempting force-delete.`); + // Execute the shell script to remove finalizers + return cy.exec(`./cypress/fixtures/coo/force_delete_ns.sh ${MCP.namespace} ${Cypress.env('KUBECONFIG_PATH')}`, + { failOnNonZeroExit: false, timeout: installTimeoutMilliseconds }).then((result) => { + cy.log(`${elapsed}ms - Force delete output: ${result.stdout}`); + if (result.code !== 0) { + cy.log(`Force delete failed with exit code ${result.code}: ${result.stderr}`); } }); } - }); + + // Command to check the namespace status + // Use 'oc get ns -o jsonpath' for minimal output and fastest check + cy.exec(`oc get ns ${MCP.namespace} --kubeconfig ${`${Cypress.env('KUBECONFIG_PATH')}`} -o jsonpath='{.status.phase}'`, { failOnNonZeroExit: false }) + .then((result) => { + const status = result.stdout.trim(); + + if (status === 'Terminating') { + cy.log(`${elapsed}ms - ${MCP.namespace} is still 'Terminating'. Retrying in ${checkIntervalMs / 1000}s. Elapsed: ${Math.round(elapsed / 1000)}s`); + cy.exec( + `./cypress/fixtures/coo/force_delete_ns.sh ${MCP.namespace} ${Cypress.env('KUBECONFIG_PATH')}`, + { failOnNonZeroExit: false, timeout: installTimeoutMilliseconds } + ).then((forceResult) => { + cy.log(`${elapsed}ms - Force delete output: ${forceResult.stdout}`); + if (forceResult.code !== 0) { + cy.log(`Force delete failed with exit code ${forceResult.code}: ${forceResult.stderr}`); + } + }); + // Wait and call recursively + cy.wait(checkIntervalMs).then(checkStatus); + } else if (status === 'NotFound') { + cy.log(`${elapsed}ms - ${MCP.namespace} is successfully deleted.`); + // Stop recursion + } else { + // Handles 'Active' or other unexpected states if the delete command failed silently earlier + cy.log(`${elapsed}ms - ${MCP.namespace} changed to unexpected state: ${status}. Stopping monitoring.`); + } + }); + }; + + checkStatus(); + } else { cy.log('Namespace does not exist, skipping deletion'); } diff --git a/web/cypress/support/monitoring/02.reg_metrics_1.cy.ts b/web/cypress/support/monitoring/02.reg_metrics_1.cy.ts new file mode 100644 index 00000000..c995ea0e --- /dev/null +++ b/web/cypress/support/monitoring/02.reg_metrics_1.cy.ts @@ -0,0 +1,208 @@ +import { metricsPage } from '../../views/metrics'; +import { Classes, DataTestIDs } from '../../../src/components/data-test'; +import { GraphTimespan, MetricsPagePredefinedQueries, MetricsPageQueryInput, MetricsPageUnits } from '../../fixtures/monitoring/constants'; + +export interface PerspectiveConfig { + name: string; + beforeEach?: () => void; +} + +export function runAllRegressionMetricsTests1(perspective: PerspectiveConfig) { + testMetricsRegression1(perspective); +} + +export function testMetricsRegression1(perspective: PerspectiveConfig) { + + it(`${perspective.name} perspective - Metrics`, () => { + cy.log('1.1 Metrics page loaded'); + metricsPage.shouldBeLoaded(); + + cy.log('1.2 Units dropdown'); + metricsPage.unitsDropdownAssertion(); + + cy.log('1.3 Refresh interval dropdown'); + metricsPage.refreshIntervalDropdownAssertion(); + + cy.log('1.4 Actions dropdown'); + metricsPage.actionsDropdownAssertion(); + + cy.log('1.5 Predefined queries'); + metricsPage.predefinedQueriesAssertion(); + + cy.log('1.6 Kebab dropdown'); + metricsPage.kebabDropdownAssertionWithoutQuery(); + + }); + + it(`${perspective.name} perspective - Metrics > Actions - No query added`, () => { + cy.log('2.1 Only one query loaded'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + + cy.log('2.2 Actions >Add query'); + metricsPage.clickActionsAddQuery(); + + cy.log('2.3 Only one query added, resulting in 2 rows'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); + + cy.log('2.3.1 Assert 2 rows - Empty state'); + metricsPage.addQueryAssertion(); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 1, false, false); + + cy.log('2.4 Actions > Collapse all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(false); + + cy.log('2.5 All queries collapsed'); + metricsPage.expandCollapseAllQueryAssertion(false); + metricsPage.expandCollapseRowAssertion(false, 0, false, false); + metricsPage.expandCollapseRowAssertion(false, 1, false, false); + + cy.log('2.6 Actions > Expand all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(true); + + cy.log('2.7 All queries expanded'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.shouldBeLoaded(); + + cy.log('2.8 Actions > Delete all queries'); + metricsPage.clickActionsDeleteAllQueries(); + + cy.log('2.9 Only one query deleted, resulting in 1 row'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + + }); + + it(`${perspective.name} perspective - Metrics > Actions - One query added`, () => { + cy.log('3.1 Only one query loaded'); + metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.FILESYSTEM_USAGE); + metricsPage.shouldBeLoadedWithGraph(); + + cy.log('3.2 Kebab dropdown'); + metricsPage.kebabDropdownAssertionWithQuery(); + + cy.log('3.3 Actions >Add query'); + metricsPage.clickActionsAddQuery(); + + cy.log('3.4 Only one query added, resulting in 2 rows'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); + + cy.log('3.4.1 Assert 2 rows'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 0, false, false); + metricsPage.expandCollapseRowAssertion(true, 1, true, false); + + cy.log('3.5 Actions > Collapse all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(false); + + cy.log('3.6 All queries collapsed'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'false'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'false'); + + cy.log('3.6.1 Assert 2 rows - Empty state'); + metricsPage.expandCollapseAllQueryAssertion(false); + metricsPage.expandCollapseRowAssertion(false, 0, false, false); + metricsPage.expandCollapseRowAssertion(false, 1, true, false); + + cy.log('3.7 Actions > Expand all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(true); + + cy.log('3.8 All queries expanded'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); + + cy.log('3.8.1 Assert 2 rows'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 0, false, false); + metricsPage.expandCollapseRowAssertion(true, 1, true, false); + + cy.log('3.9 Actions > Delete all queries'); + metricsPage.clickActionsDeleteAllQueries(); + + cy.log('3.10 Only one query deleted, resulting in 1 row'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + metricsPage.shouldBeLoaded(); + + }); + + it(`${perspective.name} perspective - Metrics > Insert Example Query`, () => { + cy.log('4.1 Insert Example Query'); + metricsPage.clickInsertExampleQuery(); + metricsPage.shouldBeLoadedWithGraph(); + cy.get(Classes.MetricsPageQueryInput).eq(0).should('contain', MetricsPageQueryInput.INSERT_EXAMPLE_QUERY); + metricsPage.graphAxisXAssertion(GraphTimespan.THIRTY_MINUTES); + + cy.log('4.2 Graph Timespan Dropdown'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); + metricsPage.clickRunQueriesButton(); + metricsPage.graphTimespanDropdownAssertion(); + + cy.log('4.3 Select and Assert each timespan'); + Object.values(GraphTimespan).forEach((timespan) => { + metricsPage.clickGraphTimespanDropdown(timespan); + metricsPage.graphAxisXAssertion(timespan); + }); + + cy.log('4.4 Enter Graph Timespan'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); + metricsPage.clickRunQueriesButton(); + Object.values(GraphTimespan).forEach((timespan) => { + metricsPage.enterGraphTimespan(timespan); + metricsPage.graphAxisXAssertion(timespan); + }); + + cy.log('4.5 Prepare to test Reset Zoom Button'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.CPU_USAGE); + metricsPage.graphCardInlineInfoAssertion(true); + metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK); + metricsPage.graphCardInlineInfoAssertion(false); + + cy.log('4.6 Reset Zoom Button'); + metricsPage.clickResetZoomButton(); + metricsPage.graphCardInlineInfoAssertion(true); + + cy.log('4.7 Hide Graph Button'); + metricsPage.clickHideGraphButton(); + cy.byTestID(DataTestIDs.MetricGraph).should('not.exist'); + + cy.log('4.8 Show Graph Button'); + metricsPage.clickShowGraphButton(); + cy.byTestID(DataTestIDs.MetricGraph).should('be.visible'); + + cy.log('4.9 Stacked Checkbox'); + cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('not.exist'); + + cy.log('4.10 Disconnected Checkbox'); + cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible'); + + cy.log('4.11 Prepare to test Stacked Checkbox'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.clickInsertExampleQuery(); + + cy.log('4.12 Stacked Checkbox'); + metricsPage.clickStackedCheckboxAndAssert(); + + }); + + //https://issues.redhat.com/browse/OU-974 - [Metrics] - Units - undefined showing in Y axis and tooltip + it(`${perspective.name} perspective - Metrics > Units`, () => { + cy.log('5.1 Preparation to test Units dropdown'); + cy.visit('/monitoring/query-browser'); + metricsPage.clickInsertExampleQuery(); + metricsPage.unitsDropdownAssertion(); + + cy.log('5.2 Units dropdown'); + Object.values(MetricsPageUnits).forEach((unit) => { + metricsPage.clickUnitsDropdown(unit); + metricsPage.unitsAxisYAssertion(unit); + }); + }); + +} + diff --git a/web/cypress/support/monitoring/02.reg_metrics.cy.ts b/web/cypress/support/monitoring/02.reg_metrics_2.cy.ts similarity index 68% rename from web/cypress/support/monitoring/02.reg_metrics.cy.ts rename to web/cypress/support/monitoring/02.reg_metrics_2.cy.ts index 3f23f95d..ee7f5921 100644 --- a/web/cypress/support/monitoring/02.reg_metrics.cy.ts +++ b/web/cypress/support/monitoring/02.reg_metrics_2.cy.ts @@ -1,213 +1,17 @@ import { metricsPage } from '../../views/metrics'; import { Classes, DataTestIDs, LegacyTestIDs } from '../../../src/components/data-test'; -import { GraphTimespan, MetricGraphEmptyState, MetricsPagePredefinedQueries, MetricsPageQueryInput, MetricsPageQueryKebabDropdown, MetricsPageUnits } from '../../fixtures/monitoring/constants'; +import { MetricGraphEmptyState, MetricsPagePredefinedQueries, MetricsPageQueryInput, MetricsPageQueryKebabDropdown } from '../../fixtures/monitoring/constants'; export interface PerspectiveConfig { name: string; beforeEach?: () => void; } -export function runAllRegressionMetricsTests(perspective: PerspectiveConfig) { - testMetricsRegression(perspective); - testMetricsRegression1(perspective); +export function runAllRegressionMetricsTests2(perspective: PerspectiveConfig) { + testMetricsRegression2(perspective); } -export function testMetricsRegression(perspective: PerspectiveConfig) { - - it(`${perspective.name} perspective - Metrics`, () => { - cy.log('1.1 Metrics page loaded'); - metricsPage.shouldBeLoaded(); - - cy.log('1.2 Units dropdown'); - metricsPage.unitsDropdownAssertion(); - - cy.log('1.3 Refresh interval dropdown'); - metricsPage.refreshIntervalDropdownAssertion(); - - cy.log('1.4 Actions dropdown'); - metricsPage.actionsDropdownAssertion(); - - cy.log('1.5 Predefined queries'); - metricsPage.predefinedQueriesAssertion(); - - cy.log('1.6 Kebab dropdown'); - metricsPage.kebabDropdownAssertionWithoutQuery(); - - }); - - it(`${perspective.name} perspective - Metrics > Actions - No query added`, () => { - cy.log('2.1 Only one query loaded'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - - cy.log('2.2 Actions >Add query'); - metricsPage.clickActionsAddQuery(); - - cy.log('2.3 Only one query added, resulting in 2 rows'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); - - cy.log('2.3.1 Assert 2 rows - Empty state'); - metricsPage.addQueryAssertion(); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 1, false, false); - - cy.log('2.4 Actions > Collapse all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(false); - - cy.log('2.5 All queries collapsed'); - metricsPage.expandCollapseAllQueryAssertion(false); - metricsPage.expandCollapseRowAssertion(false, 0, false, false); - metricsPage.expandCollapseRowAssertion(false, 1, false, false); - - cy.log('2.6 Actions > Expand all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(true); - - cy.log('2.7 All queries expanded'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.shouldBeLoaded(); - - cy.log('2.8 Actions > Delete all queries'); - metricsPage.clickActionsDeleteAllQueries(); - - cy.log('2.9 Only one query deleted, resulting in 1 row'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - - }); - - it(`${perspective.name} perspective - Metrics > Actions - One query added`, () => { - cy.log('3.1 Only one query loaded'); - metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.FILESYSTEM_USAGE); - metricsPage.shouldBeLoadedWithGraph(); - - cy.log('3.2 Kebab dropdown'); - metricsPage.kebabDropdownAssertionWithQuery(); - - cy.log('3.3 Actions >Add query'); - metricsPage.clickActionsAddQuery(); - - cy.log('3.4 Only one query added, resulting in 2 rows'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); - - cy.log('3.4.1 Assert 2 rows'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 0, false, false); - metricsPage.expandCollapseRowAssertion(true, 1, true, false); - - cy.log('3.5 Actions > Collapse all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(false); - - cy.log('3.6 All queries collapsed'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'false'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'false'); - - cy.log('3.6.1 Assert 2 rows - Empty state'); - metricsPage.expandCollapseAllQueryAssertion(false); - metricsPage.expandCollapseRowAssertion(false, 0, false, false); - metricsPage.expandCollapseRowAssertion(false, 1, true, false); - - cy.log('3.7 Actions > Expand all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(true); - - cy.log('3.8 All queries expanded'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); - - cy.log('3.8.1 Assert 2 rows'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 0, false, false); - metricsPage.expandCollapseRowAssertion(true, 1, true, false); - - cy.log('3.9 Actions > Delete all queries'); - metricsPage.clickActionsDeleteAllQueries(); - - cy.log('3.10 Only one query deleted, resulting in 1 row'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - metricsPage.shouldBeLoaded(); - - }); - - it(`${perspective.name} perspective - Metrics > Insert Example Query`, () => { - cy.log('4.1 Insert Example Query'); - metricsPage.clickInsertExampleQuery(); - metricsPage.shouldBeLoadedWithGraph(); - cy.get(Classes.MetricsPageQueryInput).eq(0).should('contain', MetricsPageQueryInput.INSERT_EXAMPLE_QUERY); - metricsPage.graphAxisXAssertion(GraphTimespan.THIRTY_MINUTES); - - cy.log('4.2 Graph Timespan Dropdown'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); - metricsPage.clickRunQueriesButton(); - metricsPage.graphTimespanDropdownAssertion(); - - cy.log('4.3 Select and Assert each timespan'); - Object.values(GraphTimespan).forEach((timespan) => { - metricsPage.clickGraphTimespanDropdown(timespan); - metricsPage.graphAxisXAssertion(timespan); - }); - - cy.log('4.4 Enter Graph Timespan'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); - metricsPage.clickRunQueriesButton(); - Object.values(GraphTimespan).forEach((timespan) => { - metricsPage.enterGraphTimespan(timespan); - metricsPage.graphAxisXAssertion(timespan); - }); - - cy.log('4.5 Prepare to test Reset Zoom Button'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.CPU_USAGE); - metricsPage.graphCardInlineInfoAssertion(true); - metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK); - metricsPage.graphCardInlineInfoAssertion(false); - - cy.log('4.6 Reset Zoom Button'); - metricsPage.clickResetZoomButton(); - metricsPage.graphCardInlineInfoAssertion(true); - - cy.log('4.7 Hide Graph Button'); - metricsPage.clickHideGraphButton(); - cy.byTestID(DataTestIDs.MetricGraph).should('not.exist'); - - cy.log('4.8 Show Graph Button'); - metricsPage.clickShowGraphButton(); - cy.byTestID(DataTestIDs.MetricGraph).should('be.visible'); - - cy.log('4.9 Stacked Checkbox'); - cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('not.exist'); - - cy.log('4.10 Disconnected Checkbox'); - cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible'); - - cy.log('4.11 Prepare to test Stacked Checkbox'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.clickInsertExampleQuery(); - - cy.log('4.12 Stacked Checkbox'); - metricsPage.clickStackedCheckboxAndAssert(); - - }); - - //https://issues.redhat.com/browse/OU-974 - [Metrics] - Units - undefined showing in Y axis and tooltip - it(`${perspective.name} perspective - Metrics > Units`, () => { - cy.log('5.1 Preparation to test Units dropdown'); - cy.visit('/monitoring/query-browser'); - metricsPage.clickInsertExampleQuery(); - metricsPage.unitsDropdownAssertion(); - - cy.log('5.2 Units dropdown'); - Object.values(MetricsPageUnits).forEach((unit) => { - metricsPage.clickUnitsDropdown(unit); - metricsPage.unitsAxisYAssertion(unit); - }); - }); - -} - -export function testMetricsRegression1(perspective: PerspectiveConfig) { +export function testMetricsRegression2(perspective: PerspectiveConfig) { it(`${perspective.name} perspective - Metrics > Add Query - Run Queries - Kebab icon`, () => { cy.log('6.1 Preparation to test Add Query button'); diff --git a/web/cypress/support/monitoring/05.reg_metrics_namespace_1.cy.ts b/web/cypress/support/monitoring/05.reg_metrics_namespace_1.cy.ts new file mode 100644 index 00000000..af6e5bfd --- /dev/null +++ b/web/cypress/support/monitoring/05.reg_metrics_namespace_1.cy.ts @@ -0,0 +1,206 @@ +import { metricsPage } from '../../views/metrics'; +import { Classes, DataTestIDs } from '../../../src/components/data-test'; +import { MetricsPageUnits, GraphTimespan, MetricsPagePredefinedQueries, MetricsPageQueryInput, MetricsPageQueryKebabDropdown, MetricsPageQueryInputByNamespace } from '../../fixtures/monitoring/constants'; + +export interface PerspectiveConfig { + name: string; + beforeEach?: () => void; +} + +export function runAllRegressionMetricsTestsNamespace1(perspective: PerspectiveConfig) { + testMetricsRegressionNamespace1(perspective); + +} + +export function testMetricsRegressionNamespace1(perspective: PerspectiveConfig) { + it(`${perspective.name} perspective - Metrics`, () => { + cy.log('1.1 Metrics page loaded'); + metricsPage.shouldBeLoaded(); + + cy.log('1.2 Units dropdown'); + metricsPage.unitsDropdownAssertion(); + + cy.log('1.3 Refresh interval dropdown'); + metricsPage.refreshIntervalDropdownAssertion(); + + cy.log('1.4 Actions dropdown'); + metricsPage.actionsDropdownAssertion(); + + cy.log('1.5 Predefined queries'); + metricsPage.predefinedQueriesAssertion(); + + cy.log('1.6 Kebab dropdown'); + metricsPage.kebabDropdownAssertionWithoutQuery(); + + }); + + it(`${perspective.name} perspective - Metrics > Actions - No query added`, () => { + cy.log('2.1 Only one query loaded'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + + cy.log('2.2 Actions >Add query'); + metricsPage.clickActionsAddQuery(); + + cy.log('2.3 Only one query added, resulting in 2 rows'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); + + cy.log('2.3.1 Assert 2 rows - Empty state'); + metricsPage.addQueryAssertion(); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 1, false, false); + + cy.log('2.4 Actions > Collapse all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(false); + + cy.log('2.5 All queries collapsed'); + metricsPage.expandCollapseAllQueryAssertion(false); + metricsPage.expandCollapseRowAssertion(false, 0, false, false); + metricsPage.expandCollapseRowAssertion(false, 1, false, false); + + cy.log('2.6 Actions > Expand all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(true); + + cy.log('2.7 All queries expanded'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.shouldBeLoaded(); + + cy.log('2.8 Actions > Delete all queries'); + metricsPage.clickActionsDeleteAllQueries(); + + cy.log('2.9 Only one query deleted, resulting in 1 row'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + + }); + + it(`${perspective.name} perspective - Metrics > Actions - One query added`, () => { + cy.log('3.1 Only one query loaded'); + metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.FILESYSTEM_USAGE); + metricsPage.shouldBeLoadedWithGraph(); + + cy.log('3.2 Kebab dropdown'); + metricsPage.kebabDropdownAssertionWithQuery(); + + cy.log('3.3 Actions >Add query'); + metricsPage.clickActionsAddQuery(); + + cy.log('3.4 Only one query added, resulting in 2 rows'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); + + cy.log('3.4.1 Assert 2 rows'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 0, false, false); + metricsPage.expandCollapseRowAssertion(true, 1, true, false); + + cy.log('3.5 Actions > Collapse all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(false); + + cy.log('3.6 All queries collapsed'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'false'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'false'); + + cy.log('3.6.1 Assert 2 rows - Empty state'); + metricsPage.expandCollapseAllQueryAssertion(false); + metricsPage.expandCollapseRowAssertion(false, 0, false, false); + metricsPage.expandCollapseRowAssertion(false, 1, true, false); + + cy.log('3.7 Actions > Expand all query tables'); + metricsPage.clickActionsExpandCollapseAllQuery(true); + + cy.log('3.8 All queries expanded'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); + + cy.log('3.8.1 Assert 2 rows'); + metricsPage.expandCollapseAllQueryAssertion(true); + metricsPage.expandCollapseRowAssertion(true, 0, false, false); + metricsPage.expandCollapseRowAssertion(true, 1, true, false); + + cy.log('3.9 Actions > Delete all queries'); + metricsPage.clickActionsDeleteAllQueries(); + + cy.log('3.10 Only one query deleted, resulting in 1 row'); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); + cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); + metricsPage.shouldBeLoaded(); + + }); + + it(`${perspective.name} perspective - Metrics > Insert Example Query`, () => { + cy.log('4.1 Insert Example Query'); + metricsPage.clickInsertExampleQuery(); + metricsPage.shouldBeLoadedWithGraph(); + cy.get(Classes.MetricsPageQueryInput).eq(0).should('contain', MetricsPageQueryInput.INSERT_EXAMPLE_QUERY); + metricsPage.graphAxisXAssertion(GraphTimespan.THIRTY_MINUTES); + + cy.log('4.2 Graph Timespan Dropdown'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); + metricsPage.clickRunQueriesButton(); + metricsPage.graphTimespanDropdownAssertion(); + + cy.log('4.3 Select and Assert each timespan'); + Object.values(GraphTimespan).forEach((timespan) => { + metricsPage.clickGraphTimespanDropdown(timespan); + metricsPage.graphAxisXAssertion(timespan); + }); + + cy.log('4.4 Enter Graph Timespan'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); + metricsPage.clickRunQueriesButton(); + Object.values(GraphTimespan).forEach((timespan) => { + metricsPage.enterGraphTimespan(timespan); + metricsPage.graphAxisXAssertion(timespan); + }); + + cy.log('4.5 Prepare to test Reset Zoom Button'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_TRANSMITTED_PACKETS_DROPPED); + metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_RECEIVED_PACKETS_DROPPED); + metricsPage.graphCardInlineInfoAssertion(true); + metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK); + metricsPage.graphCardInlineInfoAssertion(false); + + cy.log('4.6 Reset Zoom Button'); + metricsPage.clickResetZoomButton(); + metricsPage.graphCardInlineInfoAssertion(true); + + cy.log('4.7 Hide Graph Button'); + metricsPage.clickHideGraphButton(); + cy.byTestID(DataTestIDs.MetricGraph).should('not.exist'); + + cy.log('4.8 Show Graph Button'); + metricsPage.clickShowGraphButton(); + cy.byTestID(DataTestIDs.MetricGraph).should('be.visible'); + + cy.log('4.9 Stacked Checkbox'); + cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('be.visible'); + + cy.log('4.10 Disconnected Checkbox'); + cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible'); + + cy.log('4.11 Prepare to test Stacked Checkbox'); + metricsPage.clickActionsDeleteAllQueries(); + metricsPage.clickInsertExampleQuery(); + + cy.log('4.12 Stacked Checkbox'); + metricsPage.clickStackedCheckboxAndAssert(); + }); + + //https://issues.redhat.com/browse/OU-974 - [Metrics] - Units - undefined showing in Y axis and tooltip + it(`${perspective.name} perspective - Metrics > Units`, () => { + cy.log('5.1 Preparation to test Units dropdown'); + cy.visit('/monitoring/query-browser'); + metricsPage.clickInsertExampleQuery(); + metricsPage.unitsDropdownAssertion(); + + cy.log('5.2 Units dropdown'); + Object.values(MetricsPageUnits).forEach((unit) => { + metricsPage.clickUnitsDropdown(unit); + metricsPage.unitsAxisYAssertion(unit); + }); + }); +} diff --git a/web/cypress/support/monitoring/05.reg_metrics_namespace.cy.ts b/web/cypress/support/monitoring/05.reg_metrics_namespace_2.cy.ts similarity index 67% rename from web/cypress/support/monitoring/05.reg_metrics_namespace.cy.ts rename to web/cypress/support/monitoring/05.reg_metrics_namespace_2.cy.ts index 3ad4729a..8636c2b8 100644 --- a/web/cypress/support/monitoring/05.reg_metrics_namespace.cy.ts +++ b/web/cypress/support/monitoring/05.reg_metrics_namespace_2.cy.ts @@ -7,205 +7,11 @@ export interface PerspectiveConfig { beforeEach?: () => void; } -export function runAllRegressionMetricsTestsNamespace(perspective: PerspectiveConfig) { - testMetricsRegressionNamespace(perspective); - testMetricsRegressionNamespace1(perspective); +export function runAllRegressionMetricsTestsNamespace2(perspective: PerspectiveConfig) { + testMetricsRegressionNamespace2(perspective); } -export function testMetricsRegressionNamespace(perspective: PerspectiveConfig) { - it(`${perspective.name} perspective - Metrics`, () => { - cy.log('1.1 Metrics page loaded'); - metricsPage.shouldBeLoaded(); - - cy.log('1.2 Units dropdown'); - metricsPage.unitsDropdownAssertion(); - - cy.log('1.3 Refresh interval dropdown'); - metricsPage.refreshIntervalDropdownAssertion(); - - cy.log('1.4 Actions dropdown'); - metricsPage.actionsDropdownAssertion(); - - cy.log('1.5 Predefined queries'); - metricsPage.predefinedQueriesAssertion(); - - cy.log('1.6 Kebab dropdown'); - metricsPage.kebabDropdownAssertionWithoutQuery(); - - }); - - it(`${perspective.name} perspective - Metrics > Actions - No query added`, () => { - cy.log('2.1 Only one query loaded'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - - cy.log('2.2 Actions >Add query'); - metricsPage.clickActionsAddQuery(); - - cy.log('2.3 Only one query added, resulting in 2 rows'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); - - cy.log('2.3.1 Assert 2 rows - Empty state'); - metricsPage.addQueryAssertion(); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 1, false, false); - - cy.log('2.4 Actions > Collapse all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(false); - - cy.log('2.5 All queries collapsed'); - metricsPage.expandCollapseAllQueryAssertion(false); - metricsPage.expandCollapseRowAssertion(false, 0, false, false); - metricsPage.expandCollapseRowAssertion(false, 1, false, false); - - cy.log('2.6 Actions > Expand all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(true); - - cy.log('2.7 All queries expanded'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.shouldBeLoaded(); - - cy.log('2.8 Actions > Delete all queries'); - metricsPage.clickActionsDeleteAllQueries(); - - cy.log('2.9 Only one query deleted, resulting in 1 row'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - - }); - - it(`${perspective.name} perspective - Metrics > Actions - One query added`, () => { - cy.log('3.1 Only one query loaded'); - metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.FILESYSTEM_USAGE); - metricsPage.shouldBeLoadedWithGraph(); - - cy.log('3.2 Kebab dropdown'); - metricsPage.kebabDropdownAssertionWithQuery(); - - cy.log('3.3 Actions >Add query'); - metricsPage.clickActionsAddQuery(); - - cy.log('3.4 Only one query added, resulting in 2 rows'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 2); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); - - cy.log('3.4.1 Assert 2 rows'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 0, false, false); - metricsPage.expandCollapseRowAssertion(true, 1, true, false); - - cy.log('3.5 Actions > Collapse all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(false); - - cy.log('3.6 All queries collapsed'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'false'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'false'); - - cy.log('3.6.1 Assert 2 rows - Empty state'); - metricsPage.expandCollapseAllQueryAssertion(false); - metricsPage.expandCollapseRowAssertion(false, 0, false, false); - metricsPage.expandCollapseRowAssertion(false, 1, true, false); - - cy.log('3.7 Actions > Expand all query tables'); - metricsPage.clickActionsExpandCollapseAllQuery(true); - - cy.log('3.8 All queries expanded'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(1).should('have.attr', 'aria-expanded', 'true'); - - cy.log('3.8.1 Assert 2 rows'); - metricsPage.expandCollapseAllQueryAssertion(true); - metricsPage.expandCollapseRowAssertion(true, 0, false, false); - metricsPage.expandCollapseRowAssertion(true, 1, true, false); - - cy.log('3.9 Actions > Delete all queries'); - metricsPage.clickActionsDeleteAllQueries(); - - cy.log('3.10 Only one query deleted, resulting in 1 row'); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).should('have.length', 1); - cy.byTestID(DataTestIDs.MetricsPageExpandCollapseRowButton).find('button').eq(0).should('have.attr', 'aria-expanded', 'true'); - metricsPage.shouldBeLoaded(); - - }); - - it(`${perspective.name} perspective - Metrics > Insert Example Query`, () => { - cy.log('4.1 Insert Example Query'); - metricsPage.clickInsertExampleQuery(); - metricsPage.shouldBeLoadedWithGraph(); - cy.get(Classes.MetricsPageQueryInput).eq(0).should('contain', MetricsPageQueryInput.INSERT_EXAMPLE_QUERY); - metricsPage.graphAxisXAssertion(GraphTimespan.THIRTY_MINUTES); - - cy.log('4.2 Graph Timespan Dropdown'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); - metricsPage.clickRunQueriesButton(); - metricsPage.graphTimespanDropdownAssertion(); - - cy.log('4.3 Select and Assert each timespan'); - Object.values(GraphTimespan).forEach((timespan) => { - metricsPage.clickGraphTimespanDropdown(timespan); - metricsPage.graphAxisXAssertion(timespan); - }); - - cy.log('4.4 Enter Graph Timespan'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.enterQueryInput(0, MetricsPageQueryInput.VECTOR_QUERY); - metricsPage.clickRunQueriesButton(); - Object.values(GraphTimespan).forEach((timespan) => { - metricsPage.enterGraphTimespan(timespan); - metricsPage.graphAxisXAssertion(timespan); - }); - - cy.log('4.5 Prepare to test Reset Zoom Button'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_TRANSMITTED_PACKETS_DROPPED); - metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_RECEIVED_PACKETS_DROPPED); - metricsPage.graphCardInlineInfoAssertion(true); - metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK); - metricsPage.graphCardInlineInfoAssertion(false); - - cy.log('4.6 Reset Zoom Button'); - metricsPage.clickResetZoomButton(); - metricsPage.graphCardInlineInfoAssertion(true); - - cy.log('4.7 Hide Graph Button'); - metricsPage.clickHideGraphButton(); - cy.byTestID(DataTestIDs.MetricGraph).should('not.exist'); - - cy.log('4.8 Show Graph Button'); - metricsPage.clickShowGraphButton(); - cy.byTestID(DataTestIDs.MetricGraph).should('be.visible'); - - cy.log('4.9 Stacked Checkbox'); - cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('be.visible'); - - cy.log('4.10 Disconnected Checkbox'); - cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible'); - - cy.log('4.11 Prepare to test Stacked Checkbox'); - metricsPage.clickActionsDeleteAllQueries(); - metricsPage.clickInsertExampleQuery(); - - cy.log('4.12 Stacked Checkbox'); - metricsPage.clickStackedCheckboxAndAssert(); - }); - - //https://issues.redhat.com/browse/OU-974 - [Metrics] - Units - undefined showing in Y axis and tooltip - it(`${perspective.name} perspective - Metrics > Units`, () => { - cy.log('5.1 Preparation to test Units dropdown'); - cy.visit('/monitoring/query-browser'); - metricsPage.clickInsertExampleQuery(); - metricsPage.unitsDropdownAssertion(); - - cy.log('5.2 Units dropdown'); - Object.values(MetricsPageUnits).forEach((unit) => { - metricsPage.clickUnitsDropdown(unit); - metricsPage.unitsAxisYAssertion(unit); - }); - }); -} - -export function testMetricsRegressionNamespace1(perspective: PerspectiveConfig) { +export function testMetricsRegressionNamespace2(perspective: PerspectiveConfig) { it(`${perspective.name} perspective - Metrics > Add Query - Run Queries - Kebab icon`, () => { cy.log('6.1 Preparation to test Add Query button'); @@ -478,7 +284,8 @@ export function testMetricsRegressionNamespace1(perspective: PerspectiveConfig) cy.byOUIAID(DataTestIDs.MetricsGraphAlertDanger).should('be.visible'); }); - it(`${perspective.name} perspective - Metrics > Empty state`, () => { + //TODO remove skip when OU-1118 get answered/fixed + it.skip(`${perspective.name} perspective - Metrics > Empty state`, () => { cy.log('11.1 Insert example query - Empty state'); cy.changeNamespace("default"); metricsPage.clickInsertExampleQuery();