Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ describe('Subscribing to an Operator from Operator Hub', () => {

afterAll(() => {
// FIXME: Don't hardcode namespace for running tests against upstream k8s
execSync('kubectl delete catalogsourceconfig -n openshift-marketplace installed-community-openshift-operators');
execSync('kubectl delete subscription -n openshift-operators --all');
execSync('kubectl delete clusterserviceversion -n openshift-operators --all');
execSync(`kubectl delete catalogsourceconfig -n openshift-marketplace installed-community-${testName}`);
execSync(`kubectl delete subscription -n ${testName} --all`);
execSync(`kubectl delete clusterserviceversion -n ${testName} --all`);
execSync(`kubectl delete operatorgroup -n ${testName} --all`);
});

afterEach(() => {
Expand All @@ -25,7 +26,7 @@ describe('Subscribing to an Operator from Operator Hub', () => {
});

it('displays Operator Hub with expected available operators', async() => {
await browser.get(`${appHost}/operatorhub`);
await browser.get(`${appHost}/operatorhub/ns/${testName}`);
await crudView.isLoaded();

openCloudServices.forEach(name => {
Expand Down Expand Up @@ -128,17 +129,21 @@ describe('Subscribing to an Operator from Operator Hub', () => {
it('selects target namespace for Operator subscription', async() => {
await browser.wait(until.visibilityOf(operatorHubView.createSubscriptionFormInstallMode));

expect($('input[value="AllNamespaces"]').getAttribute('disabled')).toBe(null);
expect($('input[value="OwnNamespace"]').getAttribute('disabled')).toBe(null);
});

it('displays Operator as subscribed in Operator Hub', async() => {
await operatorHubView.installNamespaceDropdownBtn.click();
await operatorHubView.installNamespaceDropdownFilter(testName);
await operatorHubView.installNamespaceDropdownSelect(testName).click();

await operatorHubView.createSubscriptionFormBtn.click();
await crudView.isLoaded();

expect(catalogPageView.catalogTileFor('etcd').$('.catalog-tile-pf-footer').getText()).toContain('Installed');
});

it('displays Operator in "Cluster Service Versions" view for "default" namespace', async() => {
it(`displays Operator in "Cluster Service Versions" view for "${testName}" namespace`, async() => {
await browser.get(`${appHost}/operatorhub/ns/${testName}`);
await crudView.isLoaded();
await catalogPageView.catalogTileFor('etcd').click();
Expand Down
7 changes: 7 additions & 0 deletions frontend/integration-tests/views/operator-hub.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export const createSubscriptionFormTitle = element(by.cssContainingText('h1', 'C
export const createSubscriptionFormBtn = element(by.buttonText('Subscribe'));
export const createSubscriptionFormInstallMode = element(by.cssContainingText('label', 'Installation Mode'));

export const installNamespaceDropdown = $('.dropdown--full-width');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might give this a more descriptive ID than we're currently using in the form, and then we can select the right dropdown by ID here.

Don't worry about this if the PR passes tests, though. We need to unblock the queue.

export const installNamespaceDropdownBtn = installNamespaceDropdown.$('.dropdown-toggle');
export const installNamespaceDropdownFilter = (filter: string) => installNamespaceDropdown
.$('.dropdown-menu__filter').$('input').sendKeys(filter);
export const installNamespaceDropdownSelect = (namespace: string) => installNamespaceDropdown
.$(`#${namespace}-Project-link`);

export const communityWarningModal = $('.co-modal-ignore-warning');
export const operatorCommunityWarningIsLoaded = () => browser.wait(until.presenceOf(communityWarningModal), 1000)
.then(() => browser.sleep(500));
Expand Down