Skip to content
Open
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ CLAUDE.md
*.temp
temp/


# Test reports
test/e2e/allure-results/
test/e2e/allure-report/
test/e2e/.wdio-vscode-service/
test/e2e/.env
82 changes: 82 additions & 0 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# E2E Tests

End-to-end tests for the Cloudinary VS Code extension using [WebdriverIO](https://webdriver.io/) and [wdio-vscode-service](https://github.com/webdriverio-community/wdio-vscode-service).

## Setup

```bash
cd test/e2e
pnpm install
```

## Environment variables

End-to-end runs require Cloudinary credentials in `process.env`. The `onPrepare` hook in `wdio.conf.ts` reads `E2E_CLOUD`, `E2E_API_KEY`, and `E2E_API_SECRET`, then writes `~/.cloudinary/environments.json` in the shape the extension expects (cloud name as the top-level key, with `apiKey` and `apiSecret`).

| Variable | Description |
|----------|-------------|
| `E2E_CLOUD` | Cloudinary cloud name |
| `E2E_API_KEY` | API key |
| `E2E_API_SECRET` | API secret |

**Local:** add a `test/e2e/.env` file (gitignored) such as:

## Running Tests

```bash
pnpm test:e2e
```

This will:
1. Download a VS Code binary (if not already cached in `.wdio-vscode-service/`)
2. Launch VS Code with the extension loaded
3. Run all specs in `specs/`

## Viewing Reports

After a test run, generate and open the Allure report:

```bash
pnpm test:report
```

## Project Structure

```
test/e2e/
├── wdio.conf.ts # WebdriverIO configuration
├── tsconfig.json # TypeScript config for e2e tests
├── package.json # Dependencies (separate from root)
├── specs/ # Test spec files
├── src/
│ └── utils/ # Page object utilities
```

## Writing Tests

Tests use [Mocha](https://mochajs.org/) as the test framework and the `wdio-vscode-service` page objects to interact with VS Code.

```ts
import { activityBarUtils } from '../src/utils/ActivityBarUtils.js'
import { sideBarViewUtils } from '../src/utils/SideBarViewUtils.js'

it('should open the Cloudinary view', async () => {
await activityBarUtils.openView('Cloudinary')
await sideBarViewUtils.validateSideBarViewTitle('CLOUDINARY')
await sideBarViewUtils.validateContentItemsExist(['cats', 'dogs'])
})
```

### Allure Reporting

Steps are reported via `allureReporter.addStep()` inside utility methods. WebDriver-level steps (findElement, etc.) are disabled in the config to keep reports clean.

## Configuration

Key settings in `wdio.conf.ts`:

| Setting | Value | Description |
|---------|-------|-------------|
| `browserVersion` | `'stable'` | VS Code version to test against |
| `logLevel` | `'warn'` | Suppresses verbose WebDriver logs |
| `extensionPath` | `../../` | Points to the root extension directory |
Binary file added test/e2e/assets/sample_png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions test/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "e2e",
"type": "module",
"devDependencies": {
"@types/node": "^25.5.2",
"@wdio/allure-reporter": "^9.27.0",
"@wdio/cli": "^9.27.0",
"@wdio/globals": "^9.27.0",
"@wdio/local-runner": "^9.27.0",
"@wdio/mocha-framework": "^9.27.0",
"@wdio/spec-reporter": "^9.27.0",
"allure-commandline": "^2.38.1",
"cloudinary": "^2.9.0",
"expect-webdriverio": "^5.6.5",
"wdio-vscode-service": "^6.1.4"
},
"scripts": {
"test:e2e": "wdio run ./wdio.conf.ts",
"test:report": "allure generate allure-results -o allure-report --clean && allure open allure-report"
}
}
Loading
Loading