Skip to content
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
41 changes: 41 additions & 0 deletions .github/workflows/actions/set-screen-resolution/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'vscode-webdriverio Set screen resolution'
description: 'Set screen resolution'
inputs:
width:
description: 'screen width'
default: '1920'
height:
description: 'screen height'
default: '1080'
runs:
using: 'composite'
steps:
# https://github.com/actions/runner-images/issues/2935
- name: Set display resolution on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
Set-DisplayResolution -Width ${{ inputs.width }} -Height ${{ inputs.height }} -Force

# I don't know the details, but it appears that it needs to be maximized at the Webdriver level
# because it does not launch in full screen on Linux.
# However, as the following Issue states, Electron(base of vscode) can not be muximize by webdriver protocol.
# https://github.com/electron/electron/issues/33942
# Therefore, GUI-based methods are used to maximize the screen.
# The process of maximizing screen size using xdotool is done in the before hook of wdio.conf.ts.
- name: Set display resolution on Linux
if: runner.os == 'Linux'
shell: bash
run: |
pnpm --filter @vscode-wdio/xvfb-patch run patch -w ${{ inputs.width }} -h ${{ inputs.height }}
echo "::group::apt install -y xdotool"
sudo apt install -y xdotool
echo "::endgroup::"

# already use FHD resolution
- name: Set display resolution on MacOS
if: runner.os == 'macOS'
shell: bash
run: |
brew install displayplacer
displayplacer list
16 changes: 11 additions & 5 deletions .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ env:
VSCODE_WDIO_E2E_COMPATIBILITY_MODE: ${{ inputs.compatibility-mode }}

jobs:
unit:
name: E2E Tests (${{ matrix.os }}.${{ matrix.node-version }})
e2e:
name: E2E Tests - ${{ matrix.scenario }} (${{ matrix.os }}.${{ matrix.node-version }})
strategy:
fail-fast: false
matrix:
node-version: ['20']
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
scenario: ['basic', 'workspace']
runs-on: ${{ matrix.os }}
steps:
- name: 👷 Checkout
Expand All @@ -46,16 +47,21 @@ jobs:
with:
path: e2e/.wdio-vscode-service

- name: 🖥️ Set screen resolution
uses: ./.github/workflows/actions/set-screen-resolution

- name: 🧪 Run the e2e test
run: pnpm run test:e2e
env:
E2E_SCENARIO: ${{ matrix.scenario }}
run: pnpm --filter @vscode-wdio/e2e run test:e2e:${E2E_SCENARIO}
shell: bash

- name: 📦 Upload Test Logs on Failure
uses: ./.github/workflows/actions/upload-archive
if: failure()
with:
name: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-logs-${{ matrix.os }}
output: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-logs-${{ matrix.os }}.zip
name: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-${{ matrix.scenario }}-logs-${{ matrix.os }}
output: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-${{ matrix.scenario }}-logs-${{ matrix.os }}.zip
paths: e2e/logs

- name: 🐛 Debug Build
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Static code analysis

on:
workflow_call:
Expand All @@ -11,12 +11,7 @@ env:
jobs:
lint:
name: Lint
strategy:
fail-fast: false
matrix:
node-version: ['20']
os: ['ubuntu-latest']
runs-on: ${{ matrix.os }}
runs-on: 'ubuntu-latest'
steps:
- name: 👷 Checkout
uses: actions/[email protected]
Expand All @@ -26,14 +21,7 @@ jobs:
- name: 🛠️ Setup workspace
uses: ./.github/workflows/actions/setup-workspace
with:
node-version: ${{ matrix.node-version }}

- name: ⬇️ Download Build Archive
uses: ./.github/workflows/actions/download-archive
with:
name: vscode-webdriverio
path: .
filename: vscode-webdriverio-build.zip
node-version: '20'

- name: 📃 Run the lint
run: pnpm run style:fix
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/ci-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ on:
workflow_call:
# Make this a reusable workflow, no value needed
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
inputs:
scenario:
description: 'Smoke scenario'
type: string

env:
TURBO_TELEMETRY_DISABLED: 1

jobs:
unit:
smoke:
name: Smoke Tests (${{ matrix.os }}.${{ matrix.node-version }})
strategy:
fail-fast: false
Expand Down Expand Up @@ -40,16 +44,21 @@ jobs:
with:
path: e2e/.wdio-vscode-service

- name: 🖥️ Set screen resolution
uses: ./.github/workflows/actions/set-screen-resolution

- name: 🚂 Run the smoke test
run: pnpm run test:smoke
env:
E2E_SCENARIO: ${{ inputs.scenario }}
run: pnpm --filter @vscode-wdio/e2e run test:smoke:${E2E_SCENARIO}
shell: bash

- name: 📦 Upload Test Logs on Failure
uses: ./.github/workflows/actions/upload-archive
if: failure()
with:
name: smoke-logs-${{ matrix.os }}
output: smoke-logs-${{ matrix.os }}.zip
name: smoke-${{ inputs.scenario }}--logs-${{ matrix.os }}
output: smoke-${{ inputs.scenario }}-logs-${{ matrix.os }}.zip
paths: e2e/logs

- name: 🐛 Debug Build
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,41 @@ jobs:
os: 'ubuntu-latest'

lint:
name: Lint
needs: [build]
name: Static code analysis
uses: ./.github/workflows/ci-lint.yml

typecheck:
name: Typecheck
needs: [build]
needs: [lint, build]
uses: ./.github/workflows/ci-typecheck.yml

unit:
name: Unit
needs: [build]
needs: [lint, build]
uses: ./.github/workflows/ci-unit.yml

e2e:
name: E2E
needs: [build]
needs: [lint, build]
uses: ./.github/workflows/ci-e2e.yml

compatibility:
name: Compatibility
needs: [build]
needs: [lint, build]
uses: ./.github/workflows/ci-e2e.yml
with:
compatibility-mode: 'yes'

smoke:
name: Smoke
needs: [build, e2e]
smoke-config:
name: Smoke - Update Config
needs: [lint, build, e2e]
uses: ./.github/workflows/ci-smoke.yml
with:
scenario: 'config'

smoke-timeout:
name: Smoke - Worker idle timeout
needs: [lint, build, e2e]
uses: ./.github/workflows/ci-smoke.yml
with:
scenario: 'timeout'
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ This Extension consists of several packages. Eventually, these packages will be
<br>
**Service Layer**<br>
@vscode-wdio/config (constants, logger, utils)<br>
└── @vscode-wdio/api (constants, logger, utils)<br>
└── @vscode-wdio/server (constants, logger, utils)<br>
<br>
**Integration Layer**<br>
├── @vscode-wdio/worker (constants, utils)<br>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ This extension contributes the following settings:

- `webdriverio.nodeExecutable`: The path to the Node.js executable. If not assigned, WebdriverIO try to resolve the node path from environment valuables of `PATH`.
- `webdriverio.configFilePattern`: Glob pattern for WebdriverIO configuration file
- `webdriverio.workerIdleTimeout`: If no processing is performed in the Worker for the set amount of time(defined by seconds), the Worker is terminated. If processing is requested again, it will be started automatically.
- `webdriverio.logLevel`: Set the logLevel
- `webdriverio.showOutput`: Show WebdriverIO output in the test result when set `true` this option

Expand Down
Binary file modified assets/build.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion e2e/assertions/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MatcherContext } from 'expect'
import type { TreeItem } from 'wdio-vscode-service'
import type { BottomBarPanel, TreeItem, Workbench } from 'wdio-vscode-service'
import type { STATUS } from '../helpers/index.ts'

export interface ExpectedTreeItem {
Expand Down Expand Up @@ -92,8 +92,38 @@ try {
async toMatchTreeStructure(tree: TreeItem[], expectedStructure: ExpectedTreeItem[]) {
return await expectTreeToMatchStructure.call(this as unknown as MatcherContext, tree, expectedStructure)
},
async hasExpectedLog(workbench: Workbench, expectedLog: RegExp | string) {
const bottomBar = workbench.getBottomBar()

const outputView = await bottomBar.openOutputView()
await outputView.selectChannel('WebdriverIO')
await clickGlobalAction(bottomBar, bottomBar.locators.maximize)
const logs = await outputView.getText()

const regexp = typeof expectedLog === 'string' ? new RegExp(expectedLog) : expectedLog

const pass = logs.some((log) => regexp.test(log))

await clickGlobalAction(bottomBar, bottomBar.locators.restore)
const message = pass ? 'The log outputs include expected text.' : 'The expected text is not included'
return { pass, message: () => message }
},
})
}
} catch (error) {
console.warn('Failed to extend expect:', error)
}

async function clickGlobalAction(bottomBar: BottomBarPanel, label: string) {
let action
try {
action = (await bottomBar.elem
.$(bottomBar.locators.globalActions)
.$(`.//a[contains(@aria-label, '${label}') and @role='checkbox']`)) as WebdriverIO.Element
} catch {
// the panel is already maximized
}
if (action) {
await action.click({})
}
}
1 change: 1 addition & 0 deletions e2e/assertions/wdio.shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare global {
namespace ExpectWebdriverIO {
interface Matchers<R, T> {
toMatchTreeStructure(expectedStructure: ExpectedTreeItem[]): R
hasExpectedLog(expectedLog: RegExp | string): R
}
}
}
14 changes: 8 additions & 6 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
}
},
"scripts": {
"test:e2e": "run-s test:e2e:*",
"test:e2e:mocha": "cross-env VSCODE_WDIO_E2E_FRAMEWORK=mocha xvfb-maybe pnpm run wdio",
"test:e2e:jasmine": "cross-env VSCODE_WDIO_E2E_FRAMEWORK=jasmine xvfb-maybe pnpm run wdio",
"test:e2e:cucumber": "cross-env VSCODE_WDIO_E2E_FRAMEWORK=cucumber xvfb-maybe pnpm run wdio",
"test:e2e:workspace": "cross-env VSCODE_WDIO_E2E_FRAMEWORK=workspace xvfb-maybe pnpm run wdio",
"test:e2e": "run-s test:e2e:basic test:e2e:workspace",
"test:e2e:basic": "run-s test:e2e:basic:*",
"test:e2e:basic:mocha": "cross-env VSCODE_WDIO_E2E_SCENARIO=mocha xvfb-maybe pnpm run wdio",
"test:e2e:basic:jasmine": "cross-env VSCODE_WDIO_E2E_SCENARIO=jasmine xvfb-maybe pnpm run wdio",
"test:e2e:basic:cucumber": "cross-env VSCODE_WDIO_E2E_SCENARIO=cucumber xvfb-maybe pnpm run wdio",
"test:e2e:workspace": "cross-env VSCODE_WDIO_E2E_SCENARIO=workspace xvfb-maybe pnpm run wdio",
"test:smoke": "run-s test:smoke:*",
"test:smoke:update-config": "xvfb-maybe wdio run ./wdioSmoke.conf.ts",
"test:smoke:config": "cross-env VSCODE_WDIO_E2E_SCENARIO=config xvfb-maybe wdio run ./wdioSmoke.conf.ts",
"test:smoke:timeout": "cross-env VSCODE_WDIO_E2E_SCENARIO=timeout xvfb-maybe wdio run ./wdioSmoke.conf.ts",
"wdio": "wdio run ./wdio.conf.ts"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

import type { SideBarView, ViewControl, Workbench } from 'wdio-vscode-service'

const targetFramework = (process.env.VSCODE_WDIO_E2E_FRAMEWORK || 'mocha') as 'mocha' | 'jasmine'
const targetFramework = (process.env.VSCODE_WDIO_E2E_SCENARIO || 'mocha') as 'mocha' | 'jasmine'

const expected = createExpected(targetFramework)

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/basicCucumber.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

import type { SideBarView, ViewControl, Workbench } from 'wdio-vscode-service'

const targetFramework = process.env.VSCODE_WDIO_E2E_FRAMEWORK || 'mocha'
const targetFramework = process.env.VSCODE_WDIO_E2E_SCENARIO || 'mocha'

const expected = createCucumberExpected()

Expand Down
Loading