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

feat: add ability to run tests #7

Merged
merged 1 commit into from
Sep 16, 2024
Merged
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: File an issue
url: https://github.com/gemini-testing/testplane/issues
about: We track issues in the gemini-testing/testplane repository
- name: File an issue
url: https://github.com/gemini-testing/testplane/issues
about: We track issues in the gemini-testing/testplane repository
55 changes: 37 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
name: Node.js CI

on:
push:
branches: [master]
pull_request:
branches: [master]
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
test:
strategy:
matrix:
# TODO: return windows-latest
os: [ubuntu-latest, macos-latest]
node-version: [20.x]
include:
- os: ubuntu-latest
node-version: 18.x
vscodeVersion:
- stable

strategy:
matrix:
node-version: [20.x]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm test
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: npm test
env:
RUN_IN_CI: true
VSCODE_VERSION: ${{ matrix.vscodeVersion }}
- uses: actions/upload-artifact@v4
if: failure()
with:
name: screens-on-fail
path: tests/e2e/screens-on-fail
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
out/
node_modules
.vscode-test/
*.vsix
.DS_Store
vscode.d.ts
.eslintcache
test-project
samples/**/.*
.wdio*
.tmp
tests/e2e/screens-on-fail
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ module.exports = {
singleQuote: false,
trailingComma: "all",
bracketSpacing: true,
arrowParens: "avoid"
arrowParens: "avoid",
};
8 changes: 5 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"name": "Run Extension Basic Sample",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/test-project"
"${workspaceFolder}/samples/basic"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
"env": {
"TESTPLANE_VSCODE_DEBUG": "true"
}
}
]
}
7 changes: 7 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Development

How to build and test the extension:

- Run `npm install` to install deps;
- Run `npm run watch`;
- Press F5 to run extension.
58 changes: 54 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
# vscode-testplane

This extension supports [Testplane][testplane] features in VS Code environment. Available features:
This extension supports [Testplane][testplane] features in VS Code environment.

- [Install Testplane](#install-testplane)
- [Using the REPL mode](#using-the-repl-mode)
## Features

- **Run** tests;
- [Install Testplane](#install-testplane);
- [Using the REPL mode](#using-the-repl-mode);

## Requirements

- Visual Studio Code version >= 1.73.0;
- Testplane version >= v8.20.0;
- Node.js version >= 18.0.0 (follows Testplane).

## Usage

You can manage tests from the Testing view and directly within your test files.

### In the Testing View

![Testing view](./images/testing-view.png "Testing view")

You can access the extension from the Testing view in the Visual Studio Code sidebar.

The toolbar at the top provides various commands to manage test execution:
- **Run Failed Tests**: to run only failed tests (displayed only if there are failed tests in the run);
- **Refresh Tests**: to reload your tests list, reflecting any new changes;
- **Run All Tests**: to run all tests that are currently visible;
- **Show Output**: to display detailed logs from test executions;
- **Miscellaneous Settings**: to customize the Testing view, such as sorting, grouping, collapse tests or even clear all previous results.

The filter bar allows you to narrow down the tests displayed, focusing on specific tests by name or exclusion patterns.

Icons next to each test indicate their status—passed (checkmark), failed (cross), skipped (arrow), queued (yellow icon), or not executed (dot).

#### 💡 Tips & tricks

- Hovering, or right clicking a folder, test file, test suite, or a test will reveal more actions;
- `Option+Left-click` (on Mac OS) and `Alt+Left-click` (on Windows) on folder makes it possible to quickly expand the entire test tree.

### In the Test File

![Testplane test file](./images/test-file.png "Testplane test file")

When viewing a test file, you'll notice test icons in the gutter next to each test case:

- **Run a Single Test:** click the test icon next to a test case to run that specific test in the browsers for which it should run (defined in the config);
- **More Options:** right-click the test icon to open a context menu with additional options:
- `Run All Tests`: execute the selected test case in the browsers for which it should run (defined in the config);
- **Test Name** or **Browser Name**: after `Run All Tests` option, the name of the test and the names of the browsers in which it runs are displayed and they have the following options:
- `Run Test`: execute the selected test case in the browsers for which it should run (defined in the config) if used from **Test Name** and in one specific browser if used from **Browser Name**;
- `Peek Error`: show the error with which the test fail (displayed only in failed tests);
- `Reveal in Test Explorer`: locate and highlight the test in the centralized Testing view.
- `Breakpoint Settings`: set breakpoints to pause execution during debugging. You can add a standard breakpoint, a conditional breakpoint, a logpoint, or a triggered breakpoint.

## Install Testplane

Expand All @@ -13,6 +63,6 @@ If you are not using testplane yet or starting a new testing project, the "Insta

Adds a keybinding (`cmd+shift+8` for mac and `ctrl+shift+8` for others) to run a dedicated section of code in the VSCode terminal. More info about [REPL mode][testplane-repl-mode]. You can overwrite this keybinding in [keyboard shortcuts][vscode-keyboard-shortcuts].

[testplane]: https://github.com/gemini-testing/testplane
[testplane]: https://testplane.io/
[testplane-repl-mode]: https://github.com/gemini-testing/testplane/blob/master/docs/cli.md#repl-mode
[vscode-keyboard-shortcuts]: https://code.visualstudio.com/docs/getstarted/keybindings
Binary file added images/test-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/testing-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading