From 710a0fb6af04fbcbf3e01b8ef20eb2f9216df7fe Mon Sep 17 00:00:00 2001 From: xiaocwan Date: Wed, 24 Apr 2019 17:51:53 +0800 Subject: [PATCH 1/2] Add scenarios for test OCP-19704 --- .../integration-tests/tests/crd.scenario.ts | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 frontend/integration-tests/tests/crd.scenario.ts diff --git a/frontend/integration-tests/tests/crd.scenario.ts b/frontend/integration-tests/tests/crd.scenario.ts new file mode 100644 index 00000000000..5187898ddd8 --- /dev/null +++ b/frontend/integration-tests/tests/crd.scenario.ts @@ -0,0 +1,55 @@ +import { browser, $, $$, by, ExpectedConditions as until, Key, element } from 'protractor'; +import { appHost, checkLogs, checkErrors, testName } from '../protractor.conf'; + + + + +describe('Test for CRD related pages', () => { + + + afterEach(() => { + checkLogs(); + checkErrors(); + }); + + it('Check CatalogSource instances', async() => { + browser.get(`${appHost}/k8s/cluster/customresourcedefinitions`); + await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); + + console.log("############ check CRD CatalogSource ########") + var cs = element(by.linkText('CatalogSource')); + expect(cs.getAttribute('href')).toContain('catalogsources.operators.coreos.com'); + await cs.click() + + console.log("############ go to instances page from CRD page ########") + await browser.wait(until.presenceOf($('.btn-dropdown__item'))); + await $('.btn-dropdown__item').click() + var viewInstance = element(by.xpath('//a[contains(text(),"View Instances")]')); + await viewInstance.click() + + console.log("############ check instances ########") + browser.sleep('5000'); + expect($$('.ReactVirtualized__Grid__innerScrollContainer .co-m-row').count()).toBeGreaterThan(0); + browser.sleep('10000'); + + }); + + it('Check CatalogSource instances without OperatorGroup - certified-operators', async() => { + browser.get(`${appHost}/k8s/ns/openshift-marketplace/operators.coreos.com~v1alpha1~CatalogSource/certified-operators`); + // await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); + + + + }); + + + it('Check CatalogSource instances without OperatorGroup - olm-operators', async() => { + browser.get(`${appHost}/k8s/ns/openshift-operator-lifecycle-manager/operators.coreos.com~v1alpha1~CatalogSource/olm-operators`); + // await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); + + + + }); + + +}); From fc7f1c59fae63d4377d9380c8b4c9898fb276215 Mon Sep 17 00:00:00 2001 From: xiaocwan Date: Wed, 22 May 2019 10:35:22 +0800 Subject: [PATCH 2/2] Update for rebase and resolving conflicts --- .../integration-tests/tests/crd.scenario.ts | 55 ------------------- .../tests/olm/crd.scenario.ts | 38 +++++++++++++ 2 files changed, 38 insertions(+), 55 deletions(-) delete mode 100644 frontend/integration-tests/tests/crd.scenario.ts create mode 100644 frontend/integration-tests/tests/olm/crd.scenario.ts diff --git a/frontend/integration-tests/tests/crd.scenario.ts b/frontend/integration-tests/tests/crd.scenario.ts deleted file mode 100644 index 5187898ddd8..00000000000 --- a/frontend/integration-tests/tests/crd.scenario.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { browser, $, $$, by, ExpectedConditions as until, Key, element } from 'protractor'; -import { appHost, checkLogs, checkErrors, testName } from '../protractor.conf'; - - - - -describe('Test for CRD related pages', () => { - - - afterEach(() => { - checkLogs(); - checkErrors(); - }); - - it('Check CatalogSource instances', async() => { - browser.get(`${appHost}/k8s/cluster/customresourcedefinitions`); - await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); - - console.log("############ check CRD CatalogSource ########") - var cs = element(by.linkText('CatalogSource')); - expect(cs.getAttribute('href')).toContain('catalogsources.operators.coreos.com'); - await cs.click() - - console.log("############ go to instances page from CRD page ########") - await browser.wait(until.presenceOf($('.btn-dropdown__item'))); - await $('.btn-dropdown__item').click() - var viewInstance = element(by.xpath('//a[contains(text(),"View Instances")]')); - await viewInstance.click() - - console.log("############ check instances ########") - browser.sleep('5000'); - expect($$('.ReactVirtualized__Grid__innerScrollContainer .co-m-row').count()).toBeGreaterThan(0); - browser.sleep('10000'); - - }); - - it('Check CatalogSource instances without OperatorGroup - certified-operators', async() => { - browser.get(`${appHost}/k8s/ns/openshift-marketplace/operators.coreos.com~v1alpha1~CatalogSource/certified-operators`); - // await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); - - - - }); - - - it('Check CatalogSource instances without OperatorGroup - olm-operators', async() => { - browser.get(`${appHost}/k8s/ns/openshift-operator-lifecycle-manager/operators.coreos.com~v1alpha1~CatalogSource/olm-operators`); - // await browser.wait(until.presenceOf($('.ReactVirtualized__Grid__innerScrollContainer'))); - - - - }); - - -}); diff --git a/frontend/integration-tests/tests/olm/crd.scenario.ts b/frontend/integration-tests/tests/olm/crd.scenario.ts new file mode 100644 index 00000000000..a38a33088bf --- /dev/null +++ b/frontend/integration-tests/tests/olm/crd.scenario.ts @@ -0,0 +1,38 @@ +import { browser, $, by, ExpectedConditions as until, element } from 'protractor'; +import { appHost, checkLogs, checkErrors } from '../../protractor.conf'; +import * as crudView from '../../views/crud.view'; +import * as olmCatalogView from '../../views/olm-catalog.view'; +import * as crdView from '../../views/crd.view'; + +describe('Test for CRD related pages', () => { + + afterEach(() => { + checkLogs(); + checkErrors(); + }); + + it('View instances list of crd/catalogsource', async() => { + browser.get(`${appHost}/k8s/cluster/customresourcedefinitions`); + await browser.wait(until.presenceOf(crdView.resourceListLogoCRD)); + await crudView.clickResourceNameLink('CatalogSource'); + await crudView.clickDetailsPageAction('View Instances'); + await browser.wait(until.presenceOf(olmCatalogView.entryRows.get(0))); + expect(olmCatalogView.entryRows.count()).toBeGreaterThan(0); + }); + + it('Check catalogsource instance without OperatorGroup has correct message', async() => { + await crudView.clickResourceNameLink('certified-operators'); + await browser.wait(until.presenceOf(element(by.cssContainingText('.cos-status-box__title', 'Namespace Not Enabled')))); + expect($('.cos-status-box__detail').getText()).toContain('not configured with an OperatorGroup'); + expect(element(by.partialLinkText('Create one here')).isPresent()).toBe(true); + }); + + it('Check catalogsource instance with OperatorGroup displays well', async() => { + await browser.navigate().back(); + await crudView.clickResourceNameLink('olm-operators'); + await browser.wait(until.textToBePresentInElement($('.co-catalogsource-list__section__packages'), 'OLM Operators')); + expect($('.co-clusterserviceversion-logo__name__clusterserviceversion').getText()).toContain('Package Server'); + expect(element(by.partialLinkText('View')).isPresent()).toBe(true); + }); + +});