--- /dev/null
+import { DashboardPageHelper } from '../ui/dashboard.po';
+import { MultiClusterPageHelper } from './multi-cluster.po';
+
+describe('Muti-cluster management page', () => {
+ const multiCluster = new MultiClusterPageHelper();
+ const dashboard = new DashboardPageHelper();
+
+ const hubName = 'local-cluster';
+ const url = Cypress.env('CEPH2_URL');
+ const alias = 'ceph2';
+ const username = 'admin';
+ const password = 'admin';
+
+ const editedAlias = 'ceph2-edited';
+
+ beforeEach(() => {
+ cy.login();
+ multiCluster.navigateTo('manage-clusters');
+ });
+
+ it('should authenticate the second cluster', () => {
+ multiCluster.auth(url, alias, username, password);
+ multiCluster.existTableCell(alias);
+ });
+
+ it('should switch to the second cluster and back to hub', () => {
+ dashboard.navigateTo();
+ cy.get('[data-testid="selected-cluster"]').click();
+ cy.get('[data-testid="select-a-cluster"]').contains(alias).click();
+ cy.get('[data-testid="selected-cluster"]').contains(alias);
+ cy.get('cd-dashboard-v3').should('exist');
+
+ // now switch back to the hub cluster
+ cy.get('[data-testid="selected-cluster"]').click();
+ cy.get('[data-testid="select-a-cluster"]').contains(hubName).click();
+ cy.get('[data-testid="selected-cluster"]').contains(hubName);
+ cy.get('cd-dashboard-v3').should('exist');
+ });
+
+ it('should reconnect the second cluster', () => {
+ multiCluster.reconnect(alias, password);
+ multiCluster.existTableCell(alias);
+ });
+
+ it('should edit the second cluster', () => {
+ multiCluster.edit(alias, editedAlias);
+ multiCluster.existTableCell(editedAlias);
+ });
+
+ it('should disconnect the second cluster', () => {
+ multiCluster.disconnect(editedAlias);
+ multiCluster.existTableCell(editedAlias, false);
+ });
+});
--- /dev/null
+import { PageHelper } from '../page-helper.po';
+
+const pages = {
+ index: { url: '#/multi-cluster/overview', id: 'cd-multi-cluster' },
+ 'manage-clusters': { url: '#/multi-cluster/manage-clusters', id: 'cd-multi-cluster-list' }
+};
+
+const WAIT_TIMER = 1000;
+
+export class MultiClusterPageHelper extends PageHelper {
+ pages = pages;
+
+ auth(url: string, alias: string, username: string, password: string) {
+ this.clickActionButton('connect');
+ cy.get('cd-multi-cluster-form').should('exist');
+ cy.get('cd-modal').within(() => {
+ cy.get('input[name=remoteClusterUrl]').type(url);
+ cy.get('input[name=clusterAlias]').type(alias);
+ cy.get('input[name=username]').type(username);
+ cy.get('input[name=password]').type(password);
+ cy.get('cd-submit-button').click();
+ });
+ cy.wait(WAIT_TIMER);
+ }
+
+ disconnect(alias: string) {
+ this.getFirstTableCell(alias).click();
+ this.clickActionButton('disconnect');
+ cy.get('cd-modal').within(() => {
+ cy.get('#confirmation').click();
+ cy.get('cd-submit-button').click();
+ });
+ cy.wait(WAIT_TIMER);
+ }
+
+ reconnect(alias: string, password: string) {
+ this.getFirstTableCell(alias).click();
+ this.clickActionButton('reconnect');
+ cy.get('cd-modal').within(() => {
+ cy.get('input[name=password]').type(password);
+ cy.get('cd-submit-button').click();
+ });
+ cy.wait(WAIT_TIMER);
+ }
+
+ edit(alias: string, newAlias: string) {
+ this.getFirstTableCell(alias).click();
+ this.clickActionButton('edit');
+ cy.get('cd-modal').within(() => {
+ cy.get('input[name=clusterAlias]').clear().type(newAlias);
+ cy.get('cd-submit-button').click();
+ });
+ cy.wait(WAIT_TIMER);
+ }
+}
<!-- ************************* -->
<cds-header-navigation class="cluster-switcher"
*ngIf="clustersMap?.size > 1">
- <cds-header-menu [title]="currentClusterName">
+ <cds-header-menu [title]="currentClusterName"
+ data-testid="selected-cluster">
<ng-container *ngFor="let cluster of clustersMap | keyvalue; trackBy:trackByFn ">
<cds-header-item (click)="onClusterSelection(cluster.value)"
- [class.disabled]="cluster.value.cluster_connection_status === 1">
+ [class.disabled]="cluster.value.cluster_connection_status === 1"
+ data-testid="select-a-cluster">
{{ cluster.value.name }} - {{ cluster.value?.cluster_alias }} - {{ cluster.value?.user }}
</cds-header-item>
</ng-container>
# Set SSL verify to False
ceph_all dashboard set-rgw-api-ssl-verify False
- CYPRESS_BASE_URL=$(ceph mgr services | jq -r .dashboard)
+ # Set test_orchestrator as orch backend
+ ceph mgr module enable test_orchestrator
+ ceph orch set backend test_orchestrator
+
+ CYPRESS_BASE_URL=""
+ retry=0
+ while [[ -z "${CYPRESS_BASE_URL}" || "${CYPRESS_BASE_URL}" == "null" ]]; do
+ CYPRESS_BASE_URL=$(ceph mgr services | jq -r .dashboard)
+ if [ $retry -eq 10 ]; then
+ echo "ERROR: Could not get the dashboard URL"
+ stop 1
+ fi
+ retry=$((retry + 1))
+ sleep 1
+ done
CYPRESS_CEPH2_URL=$(ceph2 mgr services | jq -r .dashboard)
# start rbd-mirror daemon in the cluster