diff --git a/package.json b/package.json index dee94b31..3d081b78 100644 --- a/package.json +++ b/package.json @@ -1059,7 +1059,7 @@ "watch:webview": "webpack-cli -w --mode development", "generate:hub-client": "openapi-generator-cli generate -i https://raw.githubusercontent.com/tektoncd/hub/main/api/gen/http/openapi3.json -g typescript-axios -o src/tekton-hub-client --additional-properties=supportsES6=true", "ui-test": "extest setup-and-run ./out/ui-test/all.js", - "public-ui-test": "extest setup-and-run ./out/ui-test/publicAllTests.js -c max" + "public-ui-test": "extest setup-and-run ./out/ui-test/public-suite/all-public.js" }, "devDependencies": { "@babel/core": "7.19.6", diff --git a/ui-test/all.ts b/ui-test/all.ts index 0c01966d..0698bafb 100644 --- a/ui-test/all.ts +++ b/ui-test/all.ts @@ -4,8 +4,15 @@ *-----------------------------------------------------------------------------------------------*/ import * as taskTest from './suite/task-test'; import * as tektonViewTest from './suite/tekton-view-test'; +import * as extensionActivityTest from './public-suite/extension-activity-test'; +import * as commandPaletteTest from './public-suite/command-palette-test'; +import * as extensionViewTest from './public-suite/extension-view-test'; describe('VSCode Tekton UI Tests Suite', () => { + commandPaletteTest.commandPaletteTest() + extensionActivityTest.extensionActivityTest(); + extensionViewTest.extensionViewTest(); + const clusterUrl = process.env.CLUSTER_URL || 'https://api.openshift4.cluster.adapters-crs-qe.com:6443'; const username = process.env.CLUSTER_USER || 'kubeadmin'; const password = process.env.CLUSTER_PASSWORD || 'password'; diff --git a/ui-test/common/constants.ts b/ui-test/common/constants.ts index d7da7734..ec639dbb 100644 --- a/ui-test/common/constants.ts +++ b/ui-test/common/constants.ts @@ -16,4 +16,5 @@ export namespace commands { export namespace views { export const TEKTON_TITLE = 'Tekton Pipelines'; + export const TEKTON_CATS = [TEKTON_TITLE, 'Debug Sessions', 'TektonHub']; } diff --git a/ui-test/publicAllTests.ts b/ui-test/public-suite/all-public.ts similarity index 56% rename from ui-test/publicAllTests.ts rename to ui-test/public-suite/all-public.ts index 24ad1267..2c201f25 100644 --- a/ui-test/publicAllTests.ts +++ b/ui-test/public-suite/all-public.ts @@ -3,8 +3,12 @@ * Licensed under the MIT License. See LICENSE file in the project root for license information. *-----------------------------------------------------------------------------------------------*/ -import { dummyTest } from './suite/dummy-test'; +import * as extensionActivityTest from './extension-activity-test'; +import * as commandPaletteTest from './command-palette-test'; +import * as extensionViewTest from './extension-view-test'; describe('VSCode Tekton Public UI Tests Suite', () => { - dummyTest(); + commandPaletteTest.commandPaletteTest() + extensionActivityTest.extensionActivityTest(); + extensionViewTest.extensionViewTest(); }); diff --git a/ui-test/public-suite/command-palette-test.ts b/ui-test/public-suite/command-palette-test.ts new file mode 100644 index 00000000..9675ad9d --- /dev/null +++ b/ui-test/public-suite/command-palette-test.ts @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ +import { InputBox, Workbench, EditorView } from 'vscode-extension-tester'; +import { expect } from 'chai'; + +export function commandPaletteTest() : void{ + + describe('Tekton Command Palette Test', () => { + + before(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + + it('Search Tekton', async function(){ + this.timeout(20000); + await new Workbench().openCommandPrompt(); + const paletteInput = await InputBox.create(); + await paletteInput.setText('> tekton'); + + const tektonPicks = await paletteInput.getQuickPicks(); + expect(tektonPicks).not.empty; + }); + + after(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + }); +} diff --git a/ui-test/public-suite/extension-activity-test.ts b/ui-test/public-suite/extension-activity-test.ts new file mode 100644 index 00000000..a70bc957 --- /dev/null +++ b/ui-test/public-suite/extension-activity-test.ts @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ +import { SideBarView, ActivityBar, EditorView } from 'vscode-extension-tester'; +import { expect } from 'chai'; +import { views } from '../common/constants'; + +export function extensionActivityTest() : void{ + + describe('Tekton Activity Test', () => { + + before(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + + it('Check Tekton Pipelines Exists', async function(){ + this.timeout(20000); + const tektonPip = await new ActivityBar().getViewControl(views.TEKTON_TITLE); + expect(tektonPip).not.undefined; + }); + + it('Check Tekton View Categories', async function(){ + this.timeout(20000); + await (await new ActivityBar().getViewControl(views.TEKTON_TITLE)).openView(); + const tektonCats = await new SideBarView().getContent().getSections(); + expect(tektonCats.length).equals(3); + expect(await Promise.all(tektonCats.map(async item => await item.getTitle()))).to.has.members(views.TEKTON_CATS); + }); + + it('Check Tekton Pipelines Actions', async function(){ + this.timeout(20000); + await (await new ActivityBar().getViewControl(views.TEKTON_TITLE)).openView(); + const tektonPipSection = await new SideBarView().getContent().getSection(views.TEKTON_TITLE); + await tektonPipSection.expand(); + expect(tektonPipSection.isExpanded()); + + + const actions = await tektonPipSection.getActions(); + expect(actions.length).greaterThan(0); + }); + + after(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + }); +} diff --git a/ui-test/public-suite/extension-view-test.ts b/ui-test/public-suite/extension-view-test.ts new file mode 100644 index 00000000..fe04fb3e --- /dev/null +++ b/ui-test/public-suite/extension-view-test.ts @@ -0,0 +1,37 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ +import { ActivityBar, EditorView, ExtensionsViewItem } from 'vscode-extension-tester'; +import { expect } from 'chai'; + +export function extensionViewTest() : void{ + + describe('Tekton Extension View Test', () => { + + before(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + + it('Check Tekton Installation And Information', async function(){ + this.timeout(20000); + const extensionView = await (await new ActivityBar().getViewControl('Extensions')).openView(); + const installedSection = await extensionView.getContent().getSection('Installed'); + const tektonItem = await installedSection.findItem('@installed Tekton Pipelines') as ExtensionsViewItem; + expect(tektonItem).not.undefined; + + const tektonTitle = await tektonItem.getTitle(); + const tektonInstalled = await tektonItem.isInstalled(); + const tektonAuthor = await tektonItem.getAuthor(); + expect(tektonTitle).equals('Tekton Pipelines'); + expect(tektonInstalled).is.true; + expect(tektonAuthor).equals('Red Hat'); + }); + + after(async function() { + this.timeout(20000); + await new EditorView().closeAllEditors(); + }); + }); +}