Skip to content

Commit

Permalink
Clean up of test env. before ui-test (#313)
Browse files Browse the repository at this point in the history
* Clean up of test env. before ui-test

Signed-off-by: Ondrej Dockal <[email protected]>
  • Loading branch information
odockal authored Oct 25, 2022
1 parent ab158d5 commit 87d1854
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: failure()
with:
name: screenshots-${{ matrix.os }}
path: ~/**/screenshots/*.png
path: 'test-resources/**/screenshots/*.png'
retention-days: 2
if-no-files-found: warn
- uses: codecov/codecov-action@v1
Expand Down
16 changes: 16 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ node('rhel8'){
}
}

stage('UI Tests') {
wrap([$class: 'Xvnc']) {
try {
sh """
if [ -f \$HOME/.vs-kn/kn ]; then
rm \$HOME/.vs-kn/kn
fi
"""
sh "npm run base-ui-test"
}
finally {
archiveArtifacts artifacts: 'test-resources/*.log,test-resources/**/*.png'
}
}
}

stage('Package') {
def packageJson = readJSON file: 'package.json'
packageJson.extensionDependencies = ["ms-kubernetes-tools.vscode-kubernetes-tools"]
Expand Down
20 changes: 20 additions & 0 deletions test/ui-test/extensionUITest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/await-thenable */
import fs = require('fs');
import os = require('os');
import path = require('path');
import { expect } from 'chai';
import {
ActivityBar,
Expand Down Expand Up @@ -37,12 +40,29 @@ function execShellCommand(cmd) {
export function extensionsUITest(clusterIsAvailable: boolean): void {
let driver: WebDriver;
let kubectlExists: boolean;
const homeDir = os.homedir();
const vskn = path.join(homeDir, '.vs-kn');
const vsfunc = path.join(homeDir, '.vs-func');
const vskubectl = path.join(homeDir, '.vs-kubectl');

before(async () => {
driver = VSBrowser.instance.driver;
// check existence of kubectl on the path or in the home folder
const kubectl = await execShellCommand('kubectl version --output json');
kubectlExists = !(kubectl as string).includes('kubectl: command not found');
if (fs.existsSync(vsfunc)) {
console.log(`.vs-func does exist - removing`);
fs.rmSync(vsfunc, { recursive: true, force: true });
}
if (fs.existsSync(vskn)) {
console.log(`.vs-kn does exist - removing`);
fs.rmSync(vskn, { recursive: true, force: true });
}
if (fs.existsSync(vskubectl)) {
console.log(`.vs-kubectl does exist - removing`);
fs.rmSync(vskubectl, { recursive: true, force: true });
}
console.log(`kubectl is on path: ${kubectlExists === true ? 'true' : 'false'}`);
});

describe('Knative extension UI', () => {
Expand Down

0 comments on commit 87d1854

Please sign in to comment.