Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sanket
committed
Jan 8, 2020
1 parent
f625b90
commit df26495
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
frontend/packages/dev-console/integration-tests/tests/pipeline.scenario.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { execSync } from 'child_process'; | ||
import { browser, ExpectedConditions as until, by, element } from 'protractor'; | ||
import { | ||
appHost, | ||
checkLogs, | ||
checkErrors, | ||
testName, | ||
retry, | ||
} from '../../../../integration-tests/protractor.conf'; | ||
import { switchPerspective, Perspective, sideHeader } from '../views/dev-perspective.view'; | ||
import { | ||
pipelinecheckStatus, | ||
pageSidebar, | ||
pipelinePage, | ||
pipelineScriptRunner, | ||
createPipelineYamlError, | ||
pipelineOverviewName, | ||
pipelineTable, | ||
pipelineTableBody, | ||
} from '../views/pipeline.view'; | ||
import * as sidenavView from '../../../../integration-tests/views/sidenav.view'; | ||
import * as crudView from '../../../../integration-tests/views/crud.view'; | ||
import * as catalogView from '../../../../integration-tests/views/catalog.view'; | ||
import * as catalogPageView from '../../../../integration-tests/views/catalog-page.view'; | ||
import * as operatorView from '../../../operator-lifecycle-manager/integration-tests/views/operator.view'; | ||
import * as operatorHubView from '../../../operator-lifecycle-manager/integration-tests/views/operator-hub.view'; | ||
|
||
describe('Pipeline', async () => { | ||
beforeAll(async () => { | ||
await browser.get(`${appHost}/k8s/cluster/projects`); | ||
await browser.wait(until.presenceOf(sidenavView.navSectionFor('Operators'))); | ||
await sidenavView.clickNavLink(['Operators', 'OperatorHub']); | ||
await crudView.isLoaded(); | ||
}); | ||
|
||
afterEach(() => { | ||
checkLogs(); | ||
checkErrors(); | ||
}); | ||
|
||
it('displays subscription creation form for selected Operator', async () => { | ||
await catalogView.categoryTabsPresent(); | ||
await catalogView.categoryTabs.get(0).click(); | ||
await catalogPageView.catalogTileFor('Pipelines Operator').click(); | ||
await browser.wait(until.visibilityOf(operatorHubView.operatorModal)); | ||
await browser.wait(until.presenceOf(element(by.id('confirm-action')))); | ||
await element(by.id('confirm-action')).click(); | ||
await operatorHubView.operatorModalInstallBtn.click(); | ||
await operatorHubView.createSubscriptionFormLoaded(); | ||
|
||
expect(operatorHubView.createSubscriptionFormName.getText()).toEqual( | ||
'OpenShift Pipelines Operator', | ||
); | ||
await browser.wait(until.visibilityOf(operatorHubView.createSubscriptionFormInstallMode)); | ||
await operatorHubView.allNamespacesInstallMode.click(); | ||
expect(operatorHubView.createSubscriptionError.isPresent()).toBe(false); | ||
expect(operatorHubView.createSubscriptionFormBtn.getAttribute('disabled')).toEqual(null); | ||
await operatorHubView.createSubscriptionFormBtn.click(); | ||
await crudView.isLoaded(); | ||
await browser.get(`${appHost}/operatorhub/ns/${testName}`); | ||
await crudView.isLoaded(); | ||
await catalogPageView.clickFilterCheckbox('installState-installed'); | ||
|
||
expect(catalogPageView.catalogTileFor('OpenShift Pipelines Operator').isDisplayed()).toBe(true); | ||
}); | ||
|
||
it(`displays Operator in "Cluster Service Versions" view for "${testName}" namespace`, async () => { | ||
await retry(() => catalogPageView.catalogTileFor('OpenShift Pipelines Operator').click()); | ||
await operatorHubView.operatorModalIsLoaded(); | ||
await element(by.id('confirm-action')).click(); | ||
await operatorHubView.viewInstalledOperator(); | ||
await crudView.isLoaded(); | ||
|
||
await browser.wait( | ||
until.visibilityOf(operatorView.rowForOperator('OpenShift Pipelines Operator')), | ||
); | ||
expect(operatorView.rowForOperator('OpenShift Pipelines Operator').isDisplayed()).toBe(true); | ||
}); | ||
|
||
it('pipeline is installed', async () => { | ||
await switchPerspective(Perspective.Developer); | ||
expect(sideHeader.getText()).toContain('Developer'); | ||
await browser.wait(until.visibilityOf(pageSidebar)); | ||
expect(pageSidebar.getText()).toContain('Pipelines'); | ||
}); | ||
|
||
it('pipeline tab scenario', async () => { | ||
await switchPerspective(Perspective.Developer); | ||
expect(sideHeader.getText()).toContain('Developer'); | ||
await browser.wait(until.visibilityOf(pageSidebar)); | ||
expect(pageSidebar.getText()).toContain('Pipelines'); | ||
await pipelinecheckStatus(); | ||
expect(pipelinePage.getText()).toContain('Pipelines'); | ||
await pipelineScriptRunner(); | ||
expect(createPipelineYamlError.isPresent()).toBe(false); | ||
await browser.wait(until.visibilityOf(pipelineOverviewName)); | ||
expect(pipelineOverviewName.getText()).toContain('new-pipeline'); | ||
await execSync( | ||
`oc create -f ./packages/dev-console/integration-tests/views/simple-pipeline-demo.yaml -n ${testName}`, | ||
); | ||
await pipelinecheckStatus(); | ||
await browser.wait(until.visibilityOf(pipelineTable)); | ||
expect(pipelineTableBody.element(by.css('[data-test-id="simple-pipeline"]')).isPresent()).toBe( | ||
true, | ||
); | ||
expect(pipelineTableBody.element(by.css('[data-test-id="new-pipeline"]')).isPresent()).toBe( | ||
true, | ||
); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
frontend/packages/dev-console/integration-tests/views/pipeline.view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { browser, ExpectedConditions as until, by, element, $ } from 'protractor'; | ||
|
||
export const pageSidebar = element(by.id('page-sidebar')); | ||
export const pipelineTab = element(by.css('[data-test-id="pipeline-header"]')); | ||
export const pipelinePage = element(by.css('[data-test-id="resource-title"]')); | ||
export const createPipelineYaml = element(by.id('yaml-create')); | ||
export const yamlPipeline = element(by.className('lines-content monaco-editor-background')); | ||
export const saveChangesYamlPipeline = element(by.id('save-changes')); | ||
export const createPipelineYamlError = $('.pf-c-alert.pf-m-danger'); | ||
export const pipelineTable = element( | ||
by.className('ReactVirtualized__VirtualGrid ReactVirtualized__List'), | ||
); | ||
export const pipelineTableBody = element( | ||
by.className('ReactVirtualized__VirtualGrid__innerScrollContainer'), | ||
); | ||
export const pipelineGraph = $('.odc-pipeline-vis-graph__stages'); | ||
export const pipelineOverviewName = element(by.css('[data-test-id="resource-title"]')); | ||
|
||
export const pipelineScriptRunner = async function() { | ||
await browser.wait(until.presenceOf(createPipelineYaml)); | ||
await createPipelineYaml.click(); | ||
await browser.wait(until.presenceOf(saveChangesYamlPipeline)); | ||
await saveChangesYamlPipeline.click(); | ||
await browser.wait(until.visibilityOf(pipelineGraph), 5000); | ||
}; | ||
|
||
export const pipelinecheckStatus = async function() { | ||
await pipelineTab.click(); | ||
await browser.wait(until.textToBePresentInElement(pipelinePage, 'Pipelines')); | ||
}; |
34 changes: 34 additions & 0 deletions
34
frontend/packages/dev-console/integration-tests/views/simple-pipeline-demo.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Pipeline | ||
metadata: | ||
name: simple-pipeline | ||
spec: | ||
tasks: | ||
- name: push | ||
taskRef: | ||
name: echo-hello-world | ||
- name: build-1 | ||
taskRef: | ||
name: echo-hello-world | ||
runAfter: | ||
- push | ||
- name: build-2 | ||
taskRef: | ||
name: echo-hello-world | ||
runAfter: | ||
- push | ||
- name: deploy | ||
taskRef: | ||
name: echo-hello-world | ||
runAfter: | ||
- build-2 | ||
- name: test-1 | ||
taskRef: | ||
name: echo-hello-world | ||
runAfter: | ||
- deploy | ||
- name: test-2 | ||
taskRef: | ||
name: echo-hello-world | ||
runAfter: | ||
- deploy |