Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.8] Bug 1984102: Switch Cypress OLM tests to use supported Red Hat operators #9560

Merged
merged 3 commits into from Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion frontend/packages/integration-tests-cypress/views/list-page.ts
Expand Up @@ -25,7 +25,9 @@ export const listPage = {
},
filter: {
byName: (name: string) => {
cy.byLegacyTestID('item-filter').type(name);
cy.byTestID('name-filter-input')
.clear()
.type(name);
},
numberOfActiveFiltersShouldBe: (numFilters: number) => {
cy.get("[class='pf-c-toolbar__item pf-m-chip-group']").should('have.length', numFilters);
Expand All @@ -35,6 +37,19 @@ export const listPage = {
cy.byLegacyTestID('dropdown-button').click();
});
},
clickFilterDropdown: () => {
cy.byLegacyTestID('filter-dropdown-toggle').within(() => {
cy.get('button').click();
});
},
clearAllFilters: () => {
cy.log('Clearing all filters');
cy.get('.pf-c-toolbar__content').within(() => {
cy.get('button')
.last()
.click();
});
},
by: (rowFilter: string) => {
cy.get('.pf-c-toolbar__content-section').within(() => {
cy.byLegacyTestID('filter-dropdown-toggle')
Expand Down
Expand Up @@ -61,7 +61,7 @@ describe('Interacting with OperatorHub', () => {
});

it('filters Operators by name', () => {
const operatorName = 'Alcide kAudit Operator';
const operatorName = 'Couchbase Operator';
cy.byTestID('search-operatorhub').type(operatorName);
cy.get('.catalog-tile-pf')
.its('length')
Expand Down
@@ -1,131 +1,51 @@
import { checkErrors } from '../../../integration-tests-cypress/support';
import { modal } from '../../../integration-tests-cypress/views/modal';
import { detailsPage } from '../../../integration-tests-cypress/views/details-page';
import { createCatalogSource, deleteCatalogSource } from '../views/catalog-source.view';
import { nav } from '../../../integration-tests-cypress/views/nav';
import { operator, GlobalInstalledNamespace, TestOperandProps } from '../views/operator.view';

const operatorName = 'Portworx Essentials';
const catalogSourceName = 'console-e2e';
const operatorID = 'portworx-essentials-console-e2e-openshift-marketplace';
const operatorRow = 'Portworx Essentials';
const operatorPkgName = 'portworx-essentials';
const operatorInstallFormURL = `/operatorhub/subscribe?pkg=${operatorPkgName}&catalog=${catalogSourceName}&catalogNamespace=openshift-marketplace&targetNamespace=`;
const operatorInstance = 'StorageCluster';
const openshiftOperatorsNS = 'openshift-operators';
const operandLink = 'portworx';
const testOperator = {
name: 'Service Binding Operator',
operatorHubCardTestID: 'rh-service-binding-operator-redhat-operators-openshift-marketplace',
};

// TODO: Disable until https://github.com/libopenstorage/operator/pull/323 is merged
xdescribe(`Interacting with a global install mode Operator (${operatorName})`, () => {
const testOperand: TestOperandProps = {
name: 'ServiceBinding',
kind: 'ServiceBinding',
tabName: 'Service Binding',
exampleName: `example-servicebinding`,
};

describe(`Globally installing "${testOperator.name}" operator in ${GlobalInstalledNamespace}`, () => {
before(() => {
cy.login();
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
createCatalogSource(operatorName, catalogSourceName);
});

afterEach(() => {
checkErrors();
});

after(() => {
cy.log('navigate to OperatorHub > Sources');
deleteCatalogSource(catalogSourceName);
operator.uninstall(testOperator.name);
operator.shouldNotExist(testOperator.name);
cy.logout();
});

it(`displays subscription creation form for ${operatorName}`, () => {
cy.log('navigate to the Operator install form from OperatorHub');
cy.visit('/operatorhub/all-namespaces');
cy.byTestID('search-operatorhub').type(operatorName);
cy.byTestID(operatorID).click();
cy.log('go to the install form');
cy.byLegacyTestID('operator-install-btn').click({ force: true });
cy.url().should('include', operatorInstallFormURL);
});

it(`creates the global install mode ClusterServiceVersion for ${operatorName}`, () => {
cy.visit(operatorInstallFormURL);
cy.byTestID('install-operator').click();
cy.log('verify Operator began installation');
cy.byTestID('view-installed-operators-btn').should(
'contain',
`View installed Operators in Namespace ${openshiftOperatorsNS}`,
);
cy.log('view the ClusterServiceVersion list page');
cy.byTestID('view-installed-operators-btn').click();
cy.log(`verify the ClusterServiceVersion row for ${operatorRow} exists`);
cy.byTestOperatorRow(operatorRow, { timeout: 60000 }).should('exist');
});
it(`Globally installs ${testOperator.name} operator in ${GlobalInstalledNamespace} and creates ${testOperand.name} operand`, () => {
operator.install(testOperator.name, testOperator.operatorHubCardTestID);
operator.installedSucceeded(testOperator.name);

it(`displays details about ${operatorName} ClusterServiceVersion on the "Details" tab`, () => {
cy.log(`navigate to the ${operatorName} details page`);
cy.byTestOperatorRow(operatorRow).click();
operator.navToDetailsPage(testOperator.name);
cy.byTestSectionHeading('Provided APIs').should('exist');
cy.byTestSectionHeading('ClusterServiceVersion details').should('exist');
cy.byLegacyTestID('resource-summary').should('exist');
});

it(`displays empty message on the ${operatorName} ClusterServiceVersion "All Instances" tab`, () => {
cy.log('navigate to the "All instances" tab');
cy.byLegacyTestID('horizontal-link-olm~All instances').click();
cy.byTestID('msg-box-title').should('contain', 'No operands found');
cy.byTestID('msg-box-detail').should(
'contain',
'Operands are declarative components used to define the behavior of the application.',
);
});

it(`displays ${operatorName} ${operatorInstance} creation form`, () => {
cy.log('navigate to the form');
cy.byLegacyTestID('dropdown-button')
.click()
.get('[data-test-dropdown-menu="storageclusters.core.libopenstorage.org"]')
.click();
cy.byLegacyTestID('resource-title').should('contain', `Create ${operatorInstance}`);
});

it(`creates a ${operatorName} ${operatorInstance} instance via the form`, () => {
cy.log('create a new instance');
cy.byTestID('create-dynamic-form').click();
cy.byTestOperandLink(operandLink).should('contain', 'portworx');
});

it(`displays details about ${operatorName} ${operatorInstance} instance on the "Details" tab`, () => {
cy.log(`navigate to the "Details" tab`);
cy.byTestOperandLink(operandLink).click();
cy.byTestSectionHeading('Storage Cluster overview').should('exist');
});

it(`deletes the ${operatorName} ${operatorInstance} instance`, () => {
detailsPage.clickPageActionFromDropdown(`Delete ${operatorInstance}`);
modal.shouldBeOpened();
modal.submit();
modal.shouldBeClosed();
cy.byTestID('msg-box-title').should('contain', 'No operands found');
cy.byTestID('msg-box-detail').should(
'contain',
'Operands are declarative components used to define the behavior of the application.',
);
});
operator.createOperand(testOperator.name, testOperand);
cy.byTestOperandLink(testOperand.exampleName).should('exist');
operator.operandShouldExist(testOperator.name, testOperand);

it(`uninstalls the Operator`, () => {
cy.log('navigate to the Operator uninstall modal in OperatorHub');
cy.visit('/operatorhub/all-namespaces');
cy.byTestID('search-operatorhub').type(operatorName);
cy.byTestID(operatorID).click();
cy.log('uninstall the operator');
cy.byLegacyTestID('operator-uninstall-btn').click({ force: true });
cy.url().should(
'include',
`/k8s/ns/${openshiftOperatorsNS}/subscriptions/${operatorPkgName}?showDelete=true`,
);
modal.shouldBeOpened();
modal.modalTitleShouldContain('Uninstall Operator?');
modal.submit(true);
modal.shouldBeClosed();
cy.log('verify the Operator is not installed');
cy.get('.loading-skeleton--table').should('not.exist');
cy.byTestOperatorRow(operatorRow).should('not.exist');
operator.deleteOperand(testOperator.name, testOperand);
operator.operandShouldNotExist(testOperator.name, testOperand);
});
});
@@ -1,125 +1,80 @@
import { nav } from '../../../integration-tests-cypress/views/nav';
import { projectDropdown } from '@console/cypress-integration-tests/views/common';
import { listPage } from '@console/cypress-integration-tests/views/list-page';
import { checkErrors, testName } from '../../../integration-tests-cypress/support';
import { modal } from '../../../integration-tests-cypress/views/modal';
import { createCatalogSource, deleteCatalogSource } from '../views/catalog-source.view';
import { nav } from '../../../integration-tests-cypress/views/nav';
import { GlobalInstalledNamespace, operator, TestOperandProps } from '../views/operator.view';

const testOperator = {
name: 'Red Hat CodeReady Workspaces',
operatorHubCardTestID: 'codeready-workspaces-redhat-operators-openshift-marketplace',
installedNamespace: testName,
};

const operatorName = 'Couchbase Operator';
const catalogSourceName = 'console-e2e';
const operatorID = 'couchbase-enterprise-console-e2e-openshift-marketplace';
const operatorRow = 'Couchbase Operator';
const operatorPkgName = 'couchbase-enterprise';
const operatorInstallFormURL = `/operatorhub/subscribe?pkg=${operatorPkgName}&catalog=${catalogSourceName}&catalogNamespace=openshift-marketplace&targetNamespace=${testName}`;
const operatorInstance = 'CouchbaseCluster';
const operandLink = 'cb-example';
const testOperand: TestOperandProps = {
name: 'CodeReady Workspaces instance Specification',
kind: 'CheCluster',
tabName: 'CodeReady Workspaces instance Specification',
exampleName: `codeready-workspaces`,
};

describe(`Interacting with a single namespace install mode Operator (${operatorName})`, () => {
describe(`Installing "${testOperator.name}" operator in ${testOperator.installedNamespace}`, () => {
before(() => {
cy.login();
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
cy.createProject(testName);
createCatalogSource(operatorName, catalogSourceName);
});

afterEach(() => {
checkErrors();
});

after(() => {
operator.uninstall(testOperator.name, testOperator.installedNamespace);
operator.shouldNotExist(testOperator.name, testOperator.installedNamespace);
cy.deleteProject(testName);
deleteCatalogSource(catalogSourceName);
cy.logout();
});

it(`displays subscription creation form for ${operatorName}`, () => {
cy.log('navigate to the Operator install form from OperatorHub');
cy.visit(`/operatorhub/ns/${testName}`);
cy.byTestID('search-operatorhub').type(operatorName);
cy.byTestID(operatorID).click();
cy.log('go to the install form');
cy.byLegacyTestID('operator-install-btn').click({ force: true });
cy.url().should('include', operatorInstallFormURL);
});

it(`creates the single namespace install mode ClusterServiceVersion for ${operatorName}`, () => {
cy.visit(operatorInstallFormURL);
cy.log('configure Operator install form for single namespace');
cy.byTestID('A specific namespace on the cluster-radio-input').check();
cy.log(`verify the dropdown selection shows the ${testName} namespace`);
cy.byTestID('dropdown-selectbox').should('contain', `${testName}`);
cy.byTestID('install-operator').click();
cy.log('verify Operator began installation');
cy.byTestID('view-installed-operators-btn').should(
'contain',
`View installed Operators in Namespace ${testName}`,
it(`Installs ${testOperator.name} operator in ${testOperator.installedNamespace} and creates ${testOperand.name} operand instance`, () => {
operator.install(
testOperator.name,
testOperator.operatorHubCardTestID,
testOperator.installedNamespace,
);
cy.log('view the ClusterServiceVersion list page');
cy.byTestID('view-installed-operators-btn').click();
cy.log(`verify the ClusterServiceVersion row for ${operatorRow} exists`);
cy.byTestOperatorRow(operatorRow, { timeout: 60000 }).should('exist');
});
operator.installedSucceeded(testOperator.name);

it(`displays details about ${operatorName} ClusterServiceVersion on the "Details" tab`, () => {
cy.log(`navigate to the ${operatorName} details page`);
cy.byTestOperatorRow(operatorRow).click();
operator.navToDetailsPage(testOperator.name, testOperator.installedNamespace);
cy.byTestSectionHeading('Provided APIs').should('exist');
cy.byTestSectionHeading('ClusterServiceVersion details').should('exist');
cy.byLegacyTestID('resource-summary').should('exist');
});

it(`displays empty message on the ${operatorName} ClusterServiceVersion "All Instances" tab`, () => {
cy.log('navigate to the "All Instances" tab');
cy.byLegacyTestID('horizontal-link-olm~All instances').click();
cy.byTestID('msg-box-title').should('contain', 'No operands found');
cy.byTestID('msg-box-detail').should(
'contain',
'Operands are declarative components used to define the behavior of the application.',
// should not be installed Globally
cy.log(
`Operator "${testOperator.name}" should not be installed in "${GlobalInstalledNamespace}"`,
);
});

it(`displays ${operatorName} ${operatorInstance} creation form`, () => {
cy.log('navigate to the form');
cy.byLegacyTestID('dropdown-button')
.click()
.get('[data-test-dropdown-menu="couchbaseclusters.couchbase.com"]')
.click();
cy.byLegacyTestID('resource-title').should('contain', `Create ${operatorInstance}`);
});

it(`creates a ${operatorName} ${operatorInstance} instance via the form`, () => {
cy.log('create a new instance');
cy.byTestID('create-dynamic-form').click();
cy.byTestOperandLink(operandLink).should('contain', operandLink);
});
nav.sidenav.clickNavLink(['Operators', 'Installed Operators']);
projectDropdown.selectProject(GlobalInstalledNamespace);
projectDropdown.shouldContain(GlobalInstalledNamespace);
cy.get('.loading-skeleton--table').should('not.exist');
// eslint-disable-next-line promise/catch-or-return
cy.get('body').then(($body) => {
if ($body.find('[data-test="msg-box-title"]').length > 0) {
// when running test in CI on a new cluster
cy.byTestID('msg-box-title').should('contain', 'No Operators found');
} else {
// when running test on a shared cluster
listPage.filter.byName(testOperator.name);
listPage.rows.countShouldBe(0);
}
});

it(`displays details about ${operatorName} ${operatorInstance} instance on the "Details" tab`, () => {
cy.log(`navigate to the "Details" tab`);
cy.byTestOperandLink(operandLink).click();
cy.byTestSectionHeading('Couchbase Cluster overview').should('exist');
});
operator.createOperand(testOperator.name, testOperand, testOperator.installedNamespace);
cy.byTestOperandLink(testOperand.exampleName).should('exist');
operator.operandShouldExist(testOperator.name, testOperand, testOperator.installedNamespace);

it(`uninstalls the Operator from ${testName} namespace`, () => {
cy.log('navigate to the Operator uninstall modal in OperatorHub');
cy.visit(`/operatorhub/ns/${testName}`);
cy.byTestID('search-operatorhub').type(operatorName);
cy.byTestID(operatorID).click();
cy.log('uninstall the Operator');
cy.byLegacyTestID('operator-uninstall-btn').click({ force: true });
cy.url().should(
'include',
`/k8s/ns/${testName}/subscriptions/${operatorPkgName}?showDelete=true`,
);
modal.shouldBeOpened();
modal.modalTitleShouldContain('Uninstall Operator?');
modal.submit(true);
modal.shouldBeClosed();
cy.url().should(
'include',
`/k8s/ns/${testName}/operators.coreos.com~v1alpha1~ClusterServiceVersion`,
);
cy.log(`verify the Operator is not installed in namespace ${testName}`);
cy.get('.loading-skeleton--table').should('not.exist');
cy.byTestOperatorRow(operatorRow).should('not.exist');
operator.deleteOperand(testOperator.name, testOperand, testOperator.installedNamespace);
operator.operandShouldNotExist(testOperator.name, testOperand, testOperator.installedNamespace);
});
});