Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure integration tests #123

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ jobs:

- run: yarn --frozen-lockfile

- name: Integration UI Test
shell: bash
env:
DISPLAY: :0
run: |
yarn ui-test

code-lint:
runs-on: ubuntu-latest

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules/
# testing
coverage/
.vscode-test/
vscode-trace-extension/test-resources/

# production
lib/
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"lint": "lerna run lint",
"download:server": "curl -o trace-compass-server.tar.gz https://download.eclipse.org/tracecompass.incubator/trace-server/rcp/trace-compass-server-latest-linux.gtk.x86_64.tar.gz; tar -xf trace-compass-server.tar.gz",
"start:server": "./trace-compass-server/tracecompass-server",
"download:sample-traces": "curl -o TraceCompassTutorialTraces.tgz https://raw.githubusercontent.com/dorsal-lab/tracevizlab/master/labs/TraceCompassTutorialTraces.tgz; tar -xf TraceCompassTutorialTraces.tgz"
"download:sample-traces": "curl -o TraceCompassTutorialTraces.tgz https://raw.githubusercontent.com/dorsal-lab/tracevizlab/master/labs/TraceCompassTutorialTraces.tgz; tar -xf TraceCompassTutorialTraces.tgz",
"ui-test": "yarn -s --cwd vscode-trace-extension extest setup-and-run -y ./lib/ui-test/*.js"
},
"devDependencies": {
"lerna": "^3.20.2"
Expand Down
1 change: 1 addition & 0 deletions vscode-trace-extension/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ webpack.config.js
*.tsbuildinfo
.eslintrc.js
src
test-resources/**
19 changes: 11 additions & 8 deletions vscode-trace-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,25 @@
"devDependencies": {
"@types/jest": "^23.3.13",
"@types/json-bigint": "^1.0.1",
"@types/mocha": "^10.0.1",
"@types/node": "^10.1.2",
"@types/vscode": "^1.52.0",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"rimraf": "^2.6.3",
"source-map-loader": "^1.0.2",
"css-loader": "^5.0.1",
"eslint": "^7.3.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-react": "^7.20.0",
"mocha": "^10.2.0",
"rewire": "^4.0.1",
"rimraf": "^2.6.3",
"source-map-loader": "^1.0.2",
"style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1",
"ts-loader": "^8.0.14",
"typescript": "^4.1.3",
"eslint": "^7.3.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-react": "^7.20.0"
"vscode-extension-tester": "^5.5.2"
},
"resolutions": {
"terser": "3.14.1",
Expand All @@ -176,8 +179,8 @@
"@types/react-dom": "^18.0.0"
},
"scripts": {
"prepare": "yarn run clean && yarn run build && yarn run webpack",
"clean": "rimraf lib",
"prepare": "yarn run build && yarn run webpack",
"clean": "rimraf **/*.tsbuildinfo lib",
"build": "tsc -p tsconfig.json",
"webpack": "webpack --mode development",
"webpack-dev": "webpack --mode development --watch",
Expand Down
56 changes: 56 additions & 0 deletions vscode-trace-extension/src/ui-test/extension-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { ActivityBar, By, InputBox, VSBrowser, WebDriver } from 'vscode-extension-tester';
import assert from 'assert';

describe('VSCode Trace Extension UI Tests', () => {
let driver: WebDriver;

before(() => {
driver = VSBrowser.instance.driver;
});

it('Open Trace from Explorer', async () => {
const activityBar = new ActivityBar();
const explorerControl = await activityBar.getViewControl('Explorer');
assert(explorerControl);
const explorerView = await explorerControl.openView();
const explorerContent = explorerView.getContent();
const noFolderOpenedSection = await explorerContent.getSection('No Folder Opened');
const button = await noFolderOpenedSection.findElement(By.className('monaco-button'));
await button.click();
const input = await InputBox.create();
await input.setText('/tmp/foo');
await input.confirm();
await sleep(1000);
await input.cancel();
}).timeout(60000);

it('Open Trace from Trace Viewer', async () => {
const activityBar = new ActivityBar();
const traceViewerControl = await activityBar.getViewControl('Trace Viewer');
assert(traceViewerControl);
const traceViewerView = await traceViewerControl.openView();
const traceViewerContent = traceViewerView.getContent();
const openedTracesSection = await traceViewerContent.getSection('Opened Traces');
await openedTracesSection.expand();
const actions = driver.actions();
const openTraceAction = await openedTracesSection.getAction('Open Trace');
assert(openTraceAction);
const rect = await openedTracesSection.getRect();
const location = { x: rect.x, y: rect.y, duration: 0 };
actions.move( location ).perform();
await sleep(0);
openTraceAction.click();
const input = await InputBox.create();
await input.setText('/tmp/bar');
await input.confirm();
await sleep(1000);
await input.cancel();
}).timeout(60000);

});

function sleep(ms: number): Promise<void> {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
5 changes: 3 additions & 2 deletions vscode-trace-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"extends": "../common-tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"outDir": "lib"
},
"include": [
"src"
],
"exclude": [
"node_modules",
"lib"
"lib",
"test-resources"
],
"references": [
{
Expand Down
Loading