|
| 1 | +# E2E Tests |
| 2 | + |
| 3 | +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). |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +```bash |
| 8 | +cd test/e2e |
| 9 | +pnpm install |
| 10 | +``` |
| 11 | + |
| 12 | +## Running Tests |
| 13 | + |
| 14 | +```bash |
| 15 | +pnpm test:e2e |
| 16 | +``` |
| 17 | + |
| 18 | +This will: |
| 19 | +1. Download a VS Code binary (if not already cached in `.wdio-vscode-service/`) |
| 20 | +2. Launch VS Code with the extension loaded |
| 21 | +3. Run all specs in `test/specs/` |
| 22 | + |
| 23 | +## Viewing Reports |
| 24 | + |
| 25 | +After a test run, generate and open the Allure report: |
| 26 | + |
| 27 | +```bash |
| 28 | +pnpm test:report |
| 29 | +``` |
| 30 | + |
| 31 | +## Project Structure |
| 32 | + |
| 33 | +``` |
| 34 | +test/e2e/ |
| 35 | +├── wdio.conf.ts # WebdriverIO configuration |
| 36 | +├── tsconfig.json # TypeScript config for e2e tests |
| 37 | +├── package.json # Dependencies (separate from root) |
| 38 | +├── test/ |
| 39 | +│ └── specs/ # Test spec files |
| 40 | +├── src/ |
| 41 | +│ └── utils/ # Page object utilities |
| 42 | +``` |
| 43 | + |
| 44 | +## Writing Tests |
| 45 | + |
| 46 | +Tests use [Mocha](https://mochajs.org/) as the test framework and the `wdio-vscode-service` page objects to interact with VS Code. |
| 47 | + |
| 48 | +```ts |
| 49 | +import { activityBarUtils } from '../../src/utils/ActivityBarUtils' |
| 50 | +import { sideBarViewUtils } from '../../src/utils/SideBarViewUtils' |
| 51 | + |
| 52 | +it('should open the Cloudinary view', async () => { |
| 53 | + await activityBarUtils.openView('Cloudinary') |
| 54 | + await sideBarViewUtils.validateSideBarViewTitle('CLOUDINARY') |
| 55 | + await sideBarViewUtils.validateContentItemsExist(['cats', 'dogs']) |
| 56 | +}) |
| 57 | +``` |
| 58 | + |
| 59 | +### Allure Reporting |
| 60 | + |
| 61 | +Steps are reported via `allureReporter.addStep()` inside utility methods. WebDriver-level steps (findElement, etc.) are disabled in the config to keep reports clean. |
| 62 | + |
| 63 | +## Configuration |
| 64 | + |
| 65 | +Key settings in `wdio.conf.ts`: |
| 66 | + |
| 67 | +| Setting | Value | Description | |
| 68 | +|---------|-------|-------------| |
| 69 | +| `browserVersion` | `'stable'` | VS Code version to test against | |
| 70 | +| `logLevel` | `'warn'` | Suppresses verbose WebDriver logs | |
| 71 | +| `extensionPath` | `../../` | Points to the root extension directory | |
0 commit comments