Skip to content

Commit

Permalink
Merge pull request #51768 from rhcs-dashboard/wip-61323-quincy
Browse files Browse the repository at this point in the history
quincy: mgr/dashboard: batch backport hackathon prs

Reviewed-by: Pegonzal <NOT@FOUND>
Reviewed-by: Aashish Sharma <aasharma@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: cloudbehl <NOT@FOUND>
Reviewed-by: Pere Diaz Bou <pdiazbou@redhat.com>
  • Loading branch information
nizamial09 committed Jun 1, 2023
2 parents a5f79ff + 72c61bc commit 8fd1c26
Show file tree
Hide file tree
Showing 132 changed files with 1,673 additions and 2,355 deletions.
1 change: 0 additions & 1 deletion doc/dev/developer_guide/dash-devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,6 @@ Tests can be found under the `a11y folder <./src/pybind/mgr/dashboard/frontend/c
beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
shared.navigateTo();
});
Expand Down
1 change: 1 addition & 0 deletions qa/tasks/mgr/dashboard/test_rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def test_list(self):
self.assertIn('server_hostname', data)
self.assertIn('zonegroup_name', data)
self.assertIn('zone_name', data)
self.assertIn('port', data)

def test_get(self):
data = self._get('/api/rgw/daemon')
Expand Down
6 changes: 3 additions & 3 deletions src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export CYPRESS_BASE_URL CYPRESS_LOGIN_USER CYPRESS_LOGIN_PWD
cypress_run () {
local specs="$1"
local timeout="$2"
local override_config="ignoreTestFiles=*.po.ts,retries=0,testFiles=${specs},chromeWebSecurity=false"
local override_config="excludeSpecPattern=*.po.ts,retries=0,specPattern=${specs},chromeWebSecurity=false"
if [[ -n "$timeout" ]]; then
override_config="${override_config},defaultCommandTimeout=${timeout}"
fi
Expand Down Expand Up @@ -53,5 +53,5 @@ kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-prometheus-api-
kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-grafana-api-url https://192.168.100.100:3000"'
kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch apply node-exporter --placement 'count:2'"'

cypress_run ["orchestrator/workflow/*.feature, orchestrator/workflow/*-spec.ts"]
cypress_run "orchestrator/grafana/*.feature"
cypress_run ["cypress/e2e/orchestrator/workflow/*.feature","cypress/e2e/orchestrator/workflow/*-spec.ts"]
cypress_run "cypress/e2e/orchestrator/grafana/*.feature"
6 changes: 4 additions & 2 deletions src/pybind/mgr/dashboard/controllers/rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"version": (str, "Ceph Version"),
"server_hostname": (str, ""),
"zonegroup_name": (str, "Zone Group"),
"zone_name": (str, "Zone")
"zone_name": (str, "Zone"),
"port": (int, "Port"),
}

RGW_USER_SCHEMA = {
Expand Down Expand Up @@ -103,7 +104,8 @@ def list(self) -> List[dict]:
'realm_name': metadata['realm_name'],
'zonegroup_name': metadata['zonegroup_name'],
'zone_name': metadata['zone_name'],
'default': instance.daemon.name == metadata['id']
'default': instance.daemon.name == metadata['id'],
'port': int(metadata['frontend_config#0'].split('port=')[1])
}

daemons.append(daemon)
Expand Down
4 changes: 1 addition & 3 deletions src/pybind/mgr/dashboard/frontend/applitools.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ module.exports = {
apiKey: process.env.APPLITOOLS_API_KEY,
browser: [
{ width: 1920, height: 1080, name: 'chrome' },
{ width: 1920, height: 1080, name: 'firefox' },
{ width: 800, height: 600, name: 'chrome' },
{ width: 800, height: 600, name: 'firefox' }
{ width: 1920, height: 1080, name: 'firefox' }
],
showLogs: false,
saveDebugData: true,
Expand Down
37 changes: 37 additions & 0 deletions src/pybind/mgr/dashboard/frontend/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineConfig } from 'cypress'

export default defineConfig({
video: true,
videoUploadOnPasses: false,
defaultCommandTimeout: 120000,
responseTimeout: 45000,
viewportHeight: 1080,
viewportWidth: 1920,
projectId: 'k7ab29',
reporter: 'cypress-multi-reporters',
reporterOptions: {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: 'cypress/reports/results-[hash].xml',
},
},
retries: 1,
chromeWebSecurity: false,
eyesIsDisabled: false,
eyesFailCypressOnDiff: true,
eyesDisableBrowserFetching: false,
eyesLegacyHooks: true,
eyesTestConcurrency: 5,
eyesPort: 35321,
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)
},
baseUrl: 'https://localhost:4200/',
excludeSpecPattern: ['*.po.ts', '**/orchestrator/**'],
experimentalSessionAndOrigin: true,
specPattern: 'cypress/e2e/**/*-spec.{js,jsx,ts,tsx}',
},
})
22 changes: 0 additions & 22 deletions src/pybind/mgr/dashboard/frontend/cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Dashboard Main Page', { retries: 0 }, () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
dashboard.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Navigation accessibility', { retries: 0 }, () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
shared.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ describe('Images page', () => {

before(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
// Need pool for image testing
pools.navigateTo('create');
pools.create(poolName, 8, 'rbd');
Expand All @@ -26,7 +25,6 @@ describe('Images page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
images.navigateTo();
});

Expand Down Expand Up @@ -70,7 +68,6 @@ describe('Images page', () => {

before(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
// Need image for trash testing
images.createImage(imageName, poolName, '1');
images.getFirstTableCell(imageName).should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Iscsi Page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
iscsi.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ describe('Mirroring page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
mirroring.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Configuration page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
configuration.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('CRUSH map page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
crushmap.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Hosts page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
hosts.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ export class HostsPageHelper extends PageHelper {
}

checkExist(hostname: string, exist: boolean) {
this.getTableCell(this.columnIndex.hostname, hostname).should(($elements) => {
const hosts = $elements.map((_, el) => el.textContent).get();
if (exist) {
expect(hosts).to.include(hostname);
} else {
expect(hosts).to.not.include(hostname);
}
});
this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.hostname}) span`)
.should(($elements) => {
const hosts = $elements.toArray().map((v) => v.innerText);
if (exist) {
expect(hosts).to.include(hostname);
} else {
expect(hosts).to.not.include(hostname);
}
});
}

remove(hostname: string) {
Expand All @@ -63,7 +66,7 @@ export class HostsPageHelper extends PageHelper {

// Add or remove labels on a host, then verify labels in the table
editLabels(hostname: string, labels: string[], add: boolean) {
this.getTableCell(this.columnIndex.hostname, hostname).click();
this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('edit');

// add or remove label badges
Expand All @@ -87,7 +90,7 @@ export class HostsPageHelper extends PageHelper {
checkLabelExists(hostname: string, labels: string[], add: boolean) {
// Verify labels are added or removed from Labels column
// First find row with hostname, then find labels in the row
this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.click()
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.labels}) .badge`)
Expand All @@ -107,14 +110,14 @@ export class HostsPageHelper extends PageHelper {
maintenance(hostname: string, exit = false, force = false) {
this.clearTableSearchInput();
if (force) {
this.getTableCell(this.columnIndex.hostname, hostname).click();
this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('enter-maintenance');

cy.get('cd-modal').within(() => {
cy.contains('button', 'Continue').click();
});

this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`)
.should(($ele) => {
Expand All @@ -123,7 +126,7 @@ export class HostsPageHelper extends PageHelper {
});
}
if (exit) {
this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.click()
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
Expand All @@ -134,18 +137,18 @@ export class HostsPageHelper extends PageHelper {
}
});

this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
.should(($ele) => {
const status = $ele.toArray().map((v) => v.innerText);
expect(status).to.not.include('maintenance');
});
} else {
this.getTableCell(this.columnIndex.hostname, hostname).click();
this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('enter-maintenance');

this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`)
.should(($ele) => {
Expand All @@ -157,7 +160,7 @@ export class HostsPageHelper extends PageHelper {

@PageHelper.restrictTo(pages.index.url)
drain(hostname: string) {
this.getTableCell(this.columnIndex.hostname, hostname).click();
this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('start-drain');
this.checkLabelExists(hostname, ['_no_schedule'], true);

Expand All @@ -169,7 +172,7 @@ export class HostsPageHelper extends PageHelper {
}

checkServiceInstancesExist(hostname: string, instances: string[]) {
this.getTableCell(this.columnIndex.hostname, hostname)
this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.services}) .badge`)
.should(($ele) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('Logs page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
});

describe('breadcrumb and tab tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Manager modules page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
mgrmodules.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Monitors page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
monitors.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('OSDs page', () => {

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
osds.navigateTo();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { UsersPageHelper } from './users.po';

describe('Cluster Users', () => {
describe('Cluster Ceph Users', () => {
const users = new UsersPageHelper();

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
users.navigateTo();
});

describe('breadcrumb and tab tests', () => {
it('should open and show breadcrumb', () => {
users.expectBreadcrumbText('Users');
users.expectBreadcrumbText('Ceph Users');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export class UsersPageHelper extends PageHelper {
pages = pages;

columnIndex = {
entity: 1,
capabilities: 2,
key: 3
entity: 2,
capabilities: 3,
key: 4
};

checkForUsers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const urlsCollection = new UrlsCollection();

Given('I am logged in', () => {
cy.login();
Cypress.Cookies.preserveOnce('token');
});

Given('I am on the {string} page', (page: string) => {
Expand Down

0 comments on commit 8fd1c26

Please sign in to comment.