Skip to content

Commit b461e26

Browse files
authored
fix(dashboards): MBean metrics cards do not fire queries (#220)
1 parent 4706580 commit b461e26

File tree

21 files changed

+265
-121
lines changed

21 files changed

+265
-121
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
**/dist
99
**/.DS_Store
1010
.devcontainer/dev.env
11-
integration-tests/videos
12-
integration-tests/screenshots
1311

1412
locales/en/plugin__cryostat-plugin.json
13+
14+
cypress/screenshots
15+
cypress/videos

cypress/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Cypress Tests (e2e)
2+
3+
### Prerequisites
4+
5+
There are some limitations with the current setup of the Cypress tests.
6+
7+
- Tests run against the Cryostat plugin in development mode (e.g., localhost:9000)
8+
- At least 1 Cryostat instance must be configured and available
9+
- The Cryostat instance must have a Target
10+
11+
### Instructions
12+
13+
1. Start a local running instance of OKD and the Cryostat plugin
14+
15+
`yarn run start-console`
16+
17+
`yarn run start`
18+
19+
2. Run one of the Cypress test commands:
20+
21+
The following will open a Cypress application window:
22+
23+
`yarn cypress`
24+
25+
The following will simply execute the tests from the command line:
26+
27+
`yarn cypress:headed`
28+
29+
`yarn cypress:headless`
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
const { defineConfig } = require('cypress');
1+
import { defineConfig } from 'cypress';
22

3-
module.exports = defineConfig({
3+
export default defineConfig({
44
viewportWidth: 1920,
55
viewportHeight: 1080,
66
screenshotsFolder: './screenshots',
77
videosFolder: './videos',
88
video: true,
99
reporter: '../../node_modules/cypress-multi-reporters',
10+
1011
reporterOptions: {
1112
configFile: 'reporter-config.json',
1213
},
14+
1315
fixturesFolder: 'fixtures',
1416
defaultCommandTimeout: 30000,
17+
1518
retries: {
1619
runMode: 1,
1720
openMode: 0,
1821
},
22+
1923
e2e: {
2024
setupNodeEvents(on, config) {
25+
// eslint-disable-next-line @typescript-eslint/no-require-imports
2126
return require('./plugins/index.ts')(on, config);
2227
},
2328
specPattern: 'tests/**/*.cy.{js,jsx,ts,tsx}',
2429
supportFile: 'support/index.ts',
30+
testIsolation: false,
2531
},
2632
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as wp from '@cypress/webpack-preprocessor';
1+
import wp from '@cypress/webpack-preprocessor';
22

33
module.exports = (on, config) => {
44
const options = {
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Import commands.js using ES2015 syntax:
22
import './login';
3+
import { ConsoleWindowType } from './types';
34

45
export const checkErrors = () =>
5-
cy.window().then((win) => {
6+
cy.window().then((win: ConsoleWindowType) => {
67
assert.isTrue(!win.windowError, win.windowError);
78
});
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export {};
2+
3+
import { ConsoleWindowType } from './types';
4+
15
declare global {
26
namespace Cypress {
37
interface Chainable {
@@ -15,7 +19,7 @@ const loginUsername = Cypress.env('BRIDGE_KUBEADMIN_PASSWORD') ? 'user-dropdown'
1519
Cypress.Commands.add('login', (username: string, password: string) => {
1620
// Check if auth is disabled (for a local development environment).
1721
cy.visit('/'); // visits baseUrl which is set in plugins/index.js
18-
cy.window().then((win) => {
22+
cy.window().then((win: ConsoleWindowType) => {
1923
if (win.SERVER_FLAGS?.authDisabled) {
2024
return;
2125
}
@@ -33,7 +37,7 @@ Cypress.Commands.add('login', (username: string, password: string) => {
3337

3438
Cypress.Commands.add('logout', () => {
3539
// Check if auth is disabled (for a local development environment).
36-
cy.window().then((win) => {
40+
cy.window().then((win: ConsoleWindowType) => {
3741
if (win.SERVER_FLAGS?.authDisabled) {
3842
return;
3943
}

cypress/support/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type ConsoleWindowType = Cypress.AUTWindow & {
2+
SERVER_FLAGS?: {
3+
authDisabled?: boolean;
4+
};
5+
windowError: string;
6+
};

0 commit comments

Comments
 (0)