Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinsonneau committed Feb 27, 2023
1 parent 5101014 commit de405ce
Show file tree
Hide file tree
Showing 17 changed files with 1,021 additions and 714 deletions.
24 changes: 24 additions & 0 deletions web/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from "cypress";

export default defineConfig({
viewportWidth: 1600,
viewportHeight: 800,
defaultCommandTimeout: 10000,
projectId: "tjknpb",

e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
},
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
},

component: {
devServer: {
framework: "react",
bundler: "webpack",
},
},
});
4 changes: 0 additions & 4 deletions web/cypress.json

This file was deleted.

54 changes: 54 additions & 0 deletions web/cypress/e2e/overview/overview.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/// <reference types="cypress" />

describe('netflow-overview', () => {
beforeEach(() => {
cy.openNetflowTrafficPage();
//clear default app filters
cy.get('#clear-all-filters-button').click();
});

it('displays overview and panels', () => {
cy.get('#overview-container').should('exist');
cy.checkPanels();
});

it('manage panels', () => {
//first open modal
cy.openPanelsModal();

//Select all panels
cy.get('#overview-panels-modal').contains('Select all').click();

//Save
cy.get('#overview-panels-modal').contains('Save').click();
cy.checkPanels(6);

//reopen modal
cy.openPanelsModal();

//Unselect all panels
cy.get('#overview-panels-modal').contains('Unselect all').click();

//Save should be disabled
cy.get('#overview-panels-modal').contains('Save').should('be.disabled');

//Select some panels
cy.selectPopupItems('#overview-panels-modal', ['Total rate (line)']);

//Save new panels
cy.get('#overview-panels-modal').contains('Save').click();

//Should have 1 panel
cy.checkPanels(1);

//reopen modal
cy.openPanelsModal();

//Restore default panels
cy.get('#overview-panels-modal').contains('Restore default panels').click();

//Save default panels
cy.get('#overview-panels-modal').contains('Save').click();
cy.checkPanels();
});
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ import * as c from '../../support/const'
describe('netflow-table', () => {
beforeEach(() => {
cy.openNetflowTrafficPage();
//move to table view
cy.get('.tableTabButton').click();
//clear default app filters
cy.get('#clear-all-filters-button').click();
});

it('displays table and rows', () => {
cy.get('#table-container').should('exist');
//expect 100 results without filters
cy.get('#table-container').find('tr').its('length').should('be.gte', 100);
cy.get('#flowsCount').contains('100 flows');
cy.get('#flowsCount').contains('100+ flows');

cy.addCommonFilter('namespace', c.namespace);
cy.addCommonFilter('name', c.pod);
cy.changeQueryOption('Match all');
cy.changeQueryOption('Both');
cy.changeQueryOption('1000');
cy.changeQueryOption('1000');
cy.changeTimeRange('Last 1 day');
});

Expand All @@ -42,7 +46,7 @@ describe('netflow-table', () => {
cy.get('#columns-modal').contains('Save').should('be.disabled');

//Select some columns
cy.selectColumns(['Start Time', 'Names', 'Packets']);
cy.selectPopupItems('#columns-modal', ['Start Time', 'Names', 'Packets']);

//Save new columns
cy.get('#columns-modal').contains('Save').click();
Expand All @@ -55,7 +59,7 @@ describe('netflow-table', () => {

//add End Time, Owners, Ports
//remove Packets
cy.selectColumns(['End Time', 'Owners', 'Ports', 'Packets']);
cy.selectPopupItems('#columns-modal', ['End Time', 'Owners', 'Ports', 'Packets']);

//Save new columns
cy.get('#columns-modal').contains('Save').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ describe('netflow-topology', () => {
beforeEach(() => {
cy.openNetflowTrafficPage();
//move to topology view
cy.get('#topologyViewButton').click();
cy.get('.topologyTabButton').click();
//clear default app filters
cy.get('#clear-all-filters-button').click();
});

it('displays topology and namespaces', () => {
Expand All @@ -16,10 +18,6 @@ describe('netflow-topology', () => {

cy.addCommonFilter('namespace', c.namespace, true);
cy.addCommonFilter('name', c.pod, true);
cy.changeMetricFunction('Rate');
cy.changeMetricFunction('Max');
cy.changeMetricFunction('Avg');
cy.changeMetricFunction('Sum');
cy.changeMetricType('Packets');
cy.changeMetricType('Bytes');
cy.changeQueryOption('Both', true);
Expand All @@ -28,13 +26,16 @@ describe('netflow-topology', () => {
});

it('find network observability namespace', () => {
//show advanced options
cy.showAdvancedOptions();
//type our namespace name and press enter
cy.get('#search-topology-element-input').type(`${c.namespace}{enter}`);
//cy.get('.node-highlighted').should('exist');

//should show the drawer
cy.get('.pf-c-drawer__panel-main').should('exist');
cy.get('#metrics').should('exist');
cy.get('#pf-tab-metrics-drawer-tabs').click();
cy.get('.element-metrics-container').should('exist');
cy.get('.pf-c-chart').should('exist');

//close drawer
Expand All @@ -44,27 +45,38 @@ describe('netflow-topology', () => {

it('update options', () => {
//open options panel
cy.get('.pf-topology-control-bar').find('#options').click();
cy.get('.pf-c-drawer__panel-main').should('exist');
cy.showAdvancedOptions();
cy.showDisplayOptions();

//select some displays
cy.wait(c.waitTime);
cy.dropdownSelect('layout-dropdown', 'Cola');
cy.wait(c.waitTime);
cy.dropdownSelect('layout-dropdown', 'Dagre');
cy.wait(c.waitTime);
cy.dropdownSelect('layout-dropdown', 'Concentric');
cy.wait(c.waitTime);
cy.dropdownSelect('layout-dropdown', 'Grid');
cy.wait(c.waitTime);


//select some scopes / groups
cy.dropdownSelect('scope-dropdown', 'host');
cy.get('#group-dropdown').should('be.disabled');

cy.wait(c.waitTime);
cy.dropdownSelect('scope-dropdown', 'namespace');
cy.wait(c.waitTime);
cy.dropdownSelect('group-dropdown', 'hosts');

cy.wait(c.waitTime);
cy.dropdownSelect('scope-dropdown', 'owner');
cy.wait(c.waitTime);
cy.dropdownSelect('group-dropdown', 'namespaces');

cy.wait(c.waitTime);
cy.dropdownSelect('scope-dropdown', 'resource');
cy.wait(c.waitTime);
cy.dropdownSelect('group-dropdown', 'owners');
cy.wait(c.waitTime);

//toggle switches
cy.get('#group-collapsed-switch').click();
Expand Down
102 changes: 0 additions & 102 deletions web/cypress/support/commands.js

This file was deleted.

Loading

0 comments on commit de405ce

Please sign in to comment.