|
| 1 | +// Copyright 2025 The Cockroach Authors. |
| 2 | +// |
| 3 | +// Use of this software is governed by the CockroachDB Software License |
| 4 | +// included in the /LICENSE file. |
| 5 | + |
| 6 | +describe("Scale Testing - DB Console", () => { |
| 7 | + beforeEach(() => { |
| 8 | + cy.login("roachprod", "cockroachdb"); |
| 9 | + }); |
| 10 | + |
| 11 | + it("loads the overview page within acceptable time", () => { |
| 12 | + cy.measureRender( |
| 13 | + "Overview Page", |
| 14 | + () => cy.visit("#/"), |
| 15 | + () => |
| 16 | + cy |
| 17 | + .get(".node-liveness.cluster-summary__metric.live-nodes", { |
| 18 | + timeout: 30000, |
| 19 | + }) |
| 20 | + .invoke("text") |
| 21 | + .then((text) => { |
| 22 | + const value = parseInt(text.trim(), 10); |
| 23 | + expect(value).to.be.greaterThan(0); |
| 24 | + }), |
| 25 | + ); |
| 26 | + |
| 27 | + cy.get(".cluster-overview").should("be.visible"); |
| 28 | + }); |
| 29 | + it("loads the Metrics page and displays the correct heading and key elements", () => { |
| 30 | + cy.measureRender( |
| 31 | + "Metrics Page Graph", |
| 32 | + () => cy.visit("#/metrics/hardware/cluster"), |
| 33 | + () => |
| 34 | + cy.get("canvas", { timeout: 30000 }).then(($canvas) => { |
| 35 | + const canvas = $canvas[0]; |
| 36 | + const ctx = canvas.getContext("2d"); |
| 37 | + const { width, height } = canvas; |
| 38 | + const imageData = ctx.getImageData(0, 0, width, height).data; |
| 39 | + |
| 40 | + // Check if any pixel is not fully transparent (alpha > 0) |
| 41 | + const hasPixels = Array.from({ length: width * height }).some( |
| 42 | + (_, i) => { |
| 43 | + return imageData[i * 4 + 3] !== 0; // alpha channel |
| 44 | + }, |
| 45 | + ); |
| 46 | + |
| 47 | + expect(hasPixels).to.be.true; |
| 48 | + }), |
| 49 | + ); |
| 50 | + |
| 51 | + cy.get("h3").contains("Metrics").should("be.visible"); |
| 52 | + cy.contains("Dashboard:").should("be.visible"); |
| 53 | + cy.get("button") |
| 54 | + .contains(/Past Hour|1h/) |
| 55 | + .should("be.visible"); |
| 56 | + }); |
| 57 | + |
| 58 | + it("loads the Databases page, refreshes, and displays the correct heading and key elements", () => { |
| 59 | + cy.measureRender( |
| 60 | + "Databases Page", |
| 61 | + () => cy.visit("#/databases"), |
| 62 | + () => |
| 63 | + cy |
| 64 | + .get("[data-row-key='1']", { timeout: 30000 }) |
| 65 | + .contains("system") |
| 66 | + .should("exist"), |
| 67 | + ); |
| 68 | + |
| 69 | + cy.get("h3").contains("Databases").should("be.visible"); |
| 70 | + }); |
| 71 | + |
| 72 | + it("loads the SQL Activity page and displays the correct heading and key elements", () => { |
| 73 | + cy.measureRender( |
| 74 | + "SQL Activity Page Table", |
| 75 | + () => cy.visit("#/sql-activity"), |
| 76 | + () => cy.get("table tr td", { timeout: 30000 }).should("exist"), |
| 77 | + ); |
| 78 | + |
| 79 | + cy.get("h3").contains("SQL Activity").should("be.visible"); |
| 80 | + cy.get('[role="tablist"]').should("be.visible"); |
| 81 | + cy.get('[role="tab"]').contains("Statements").should("be.visible"); |
| 82 | + cy.get('[role="tab"]').contains("Transactions").should("be.visible"); |
| 83 | + cy.get('[role="tab"]').contains("Sessions").should("be.visible"); |
| 84 | + cy.get("button") |
| 85 | + .contains(/Past Hour|1h/) |
| 86 | + .should("be.visible"); |
| 87 | + }); |
| 88 | + |
| 89 | + it("loads the Jobs page and displays the correct heading and key elements", () => { |
| 90 | + cy.measureRender( |
| 91 | + "Jobs Page Table", |
| 92 | + () => cy.visit("#/jobs"), |
| 93 | + () => cy.get("table tr td", { timeout: 30000 }).should("exist"), |
| 94 | + ); |
| 95 | + |
| 96 | + cy.get("h3").contains("Jobs").should("be.visible"); |
| 97 | + |
| 98 | + cy.get("button") |
| 99 | + .contains(/Status:/) |
| 100 | + .should("be.visible"); |
| 101 | + cy.get("button").contains(/Type:/).should("be.visible"); |
| 102 | + cy.get("button").contains(/Show:/).should("be.visible"); |
| 103 | + }); |
| 104 | + |
| 105 | + it("loads the Network page and displays the correct heading and key elements", () => { |
| 106 | + cy.measureRender( |
| 107 | + "Network Page Table", |
| 108 | + () => cy.visit("#/reports/network/region"), |
| 109 | + () => cy.get("table", { timeout: 30000 }).should("exist"), |
| 110 | + ); |
| 111 | + |
| 112 | + cy.get("h3").contains("Network").should("be.visible"); |
| 113 | + cy.contains("Sort By:").should("be.visible"); |
| 114 | + }); |
| 115 | + |
| 116 | + it("loads the Insights page and displays the correct heading and key elements", () => { |
| 117 | + cy.measureRender( |
| 118 | + "Insights Page Table", |
| 119 | + () => cy.visit("#/insights"), |
| 120 | + () => cy.get("table tr td", { timeout: 30000 }).should("exist"), |
| 121 | + ); |
| 122 | + |
| 123 | + cy.get("h3").contains("Insights").should("be.visible"); |
| 124 | + cy.get('[role="tablist"]').should("be.visible"); |
| 125 | + cy.get('[role="tab"]').contains("Workload Insights").should("be.visible"); |
| 126 | + cy.get('[role="tab"]').contains("Schema Insights").should("be.visible"); |
| 127 | + cy.get("button") |
| 128 | + .contains(/Past Hour|1h/) |
| 129 | + .should("be.visible"); |
| 130 | + }); |
| 131 | + |
| 132 | + it("loads the Hot Ranges page and displays the correct heading and key elements", () => { |
| 133 | + cy.measureRender( |
| 134 | + "Hot Ranges Table", |
| 135 | + () => cy.visit("#/hotranges"), |
| 136 | + () => cy.get("table tr td", { timeout: 30000 }).should("exist"), |
| 137 | + ); |
| 138 | + }); |
| 139 | + |
| 140 | + it("loads the Schedules page and displays the correct heading and key elements", () => { |
| 141 | + cy.measureRender( |
| 142 | + "Schedules Page", |
| 143 | + () => cy.visit("#/schedules"), |
| 144 | + () => cy.get("table tr td", { timeout: 30000 }).should("exist"), |
| 145 | + ); |
| 146 | + |
| 147 | + cy.get("h3").contains("Schedules").should("be.visible"); |
| 148 | + cy.get("button") |
| 149 | + .contains(/Status:/) |
| 150 | + .should("be.visible"); |
| 151 | + cy.get("button").contains(/Show:/).should("be.visible"); |
| 152 | + }); |
| 153 | +}); |
0 commit comments