Skip to content

Commit

Permalink
Ensure Chromedriver stays up to date (#45)
Browse files Browse the repository at this point in the history
* move chromedriver to peerDependency list

* update vscode versions

* install chromedriver in CI

* fix e2e test

* set Mocha.grep correctly

* fix e2e test

* better identify web tests

* test with implicit pause

* add selector updates for v1.70.0

* fix action button for versions until 1.67

* fix assertion

* don't lead with >

* use command key to clear
  • Loading branch information
christian-bromann authored Sep 22, 2022
1 parent 9cb7671 commit a2d95a2
Show file tree
Hide file tree
Showing 50 changed files with 1,282 additions and 1,060 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
vscodeVersion:
- insiders
- stable
- 1.67.0
- 1.70.0
- web
runs-on: ${{ matrix.os }}

Expand All @@ -27,7 +27,9 @@ jobs:
with:
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: |
yarn install --frozen-lockfile
yarn add chromedriver@latest
- name: Build
run: yarn build
- name: Run Tests
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.9.0
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ To initiate a new WebdriverIO project, run:
npm create wdio ./
```

An installation wizard will guide you through the process. Ensure you select TypeScript as compiler and don't have it generate page objects for you given this project comes with all page objects needed. Then make sure to select `vscode` within the list of services:
An installation wizard will guide you through the process. Ensure you select TypeScript as compiler and don't have it generate page objects for you given this project comes with all page objects needed. Then make sure to select `chromedriver` and `vscode` within the list of services:

![Install Demo](https://raw.githubusercontent.com/webdriverio-community/wdio-vscode-service/main/.github/assets/demo.gif "Install Demo")

__Note:__ remove `chromedriver` from the list of services in the generated `wdio.conf.ts` afterwards. See also configuration example below.

For more information on how to install `WebdriverIO`, please check the [project docs](https://webdriver.io/docs/gettingstarted).

## Example Configuration
Expand All @@ -48,7 +50,7 @@ export const config = {
// ...
capabilities: [{
browserName: 'vscode',
browserVersion: '1.69.0', // "insiders" or "stable" for latest VSCode version
browserVersion: '1.71.0', // "insiders" or "stable" for latest VSCode version
'wdio:vscodeOptions': {
extensionPath: __dirname,
userSettings: {
Expand Down
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,50 @@
"@types/ws": "^8.5.3",
"@vscode/test-electron": "^2.1.3",
"@wdio/logger": "^7.19.0",
"chromedriver": "^103.0.0",
"clipboardy": "^2.3.0",
"decamelize": "5.0.1",
"download": "^8.0.0",
"fastify": "^3.29.0",
"get-port": "5.1.1",
"slash": "^3.0.0",
"tmp-promise": "^3.0.3",
"undici": "^4.15.1",
"undici": "^5.10.0",
"vscode-uri": "^3.0.3",
"wdio-chromedriver-service": "^7.3.2",
"ws": "^8.6.0",
"yargs-parser": "^21.0.1"
},
"peerDependencies": {
"chromedriver": "latest",
"webdriverio": "^7.19.2"
},
"peerDependenciesMeta": {
"webdriverio": {
"optional": false
},
"chromedriver": {
"optional": false
}
},
"devDependencies": {
"@types/chromedriver": "^81.0.1",
"@types/download": "^8.0.1",
"@types/node": "^17.0.35",
"@types/vscode": "^1.67.0",
"@types/node": "^18.7.18",
"@types/vscode": "^1.71.0",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"@wdio/cli": "^7.19.7",
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"@wdio/types": "^7.19.5",
"chromedriver": "*",
"eslint": "^8.16.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-base-typescript": "^1.1.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-wdio": "^7.19.4",
Expand All @@ -94,7 +98,7 @@
"release-it": "^15.0.0",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typedoc": "^0.22.15",
"typedoc": "^0.23.15",
"typescript": "^4.6.4"
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions src/locators/1.37.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export const ScmView = {
initButton: './/a[text()=\'Initialize Repository\']',
providerTitle: '.title',
providerType: '.type',
actionConstructor: (title: string) => `.//a[@title='${title}']`,
action: '.action-label',
inputField: 'textarea',
changeItem: './/div[@role=\'treeitem\']',
Expand Down
33 changes: 33 additions & 0 deletions src/locators/1.67.0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {
BottomBarPanel as BottomBarPanelImport,
ViewSection as ViewSectionImport,
ViewTitlePart as ViewTitlePartImport,
ScmView as ScmViewImport,
TreeItem as TreeItemImport
} from './1.66.0'

export * from './1.66.0'
export const locatorVersion = '1.70.0'
export const BottomBarPanel = {
...BottomBarPanelImport,
action: (label: string) => `.//li[starts-with(@title, '${label}')]`
}
export const ViewSection = {
...ViewSectionImport,
buttonLabel: 'aria-label',
actionConstructor: () => './/a[contains(@class, \'action-label\') and @role=\'button\']'
}
export const ViewTitlePart = {
...ViewTitlePartImport,
action: '.action-label',
actionContstructor: (title: string) => `.//a[@title='${title}']`
}
export const ScmView = {
...ScmViewImport,
action: '.action-item.menu-entry',
actionConstructor: (title: string) => `.//li[@title='${title}']`
}
export const TreeItem = {
...TreeItemImport,
actionLabel: '.action-item'
}
8 changes: 8 additions & 0 deletions src/locators/1.70.0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { TreeItem as TreeItemImport } from './1.67.0'

export * from './1.67.0'
export const locatorVersion = '1.71.0'
export const TreeItem = {
...TreeItemImport,
actionTitle: 'title'
}
4 changes: 2 additions & 2 deletions src/locators/insiders.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
QuickOpenBox as QuickOpenBoxImport
} from './1.66.0'
} from './1.70.0'

export * from './1.66.0'
export * from './1.70.0'
export const locatorVersion = 'insiders'
export const QuickOpenBox = {
...QuickOpenBoxImport,
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/activityBar/ActionsControl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ElementWithContextMenu } from '../utils'
import { ActivityBar as ActivityBarLocators } from '../../locators/1.66.0'
import { ActivityBar as ActivityBarLocators } from '../../locators/1.70.0'
import type { ContextMenu } from '../menu/ContextMenu'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/activityBar/ActivityBar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ViewControl, ActionsControl } from '..'
import { PageDecorator, IPageDecorator, ElementWithContextMenu } from '../utils'
import { ActivityBar as ActivityBarLocators } from '../../locators/1.66.0'
import { ActivityBar as ActivityBarLocators } from '../../locators/1.70.0'

export interface ActivityBar extends IPageDecorator<typeof ActivityBarLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/activityBar/ViewControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { NewScmView } from '../sidebar/scm/NewScmView'
import {
PageDecorator, IPageDecorator, ElementWithContextMenu, VSCodeLocatorMap
} from '../utils'
import { ViewControl as ViewControlLocators } from '../../locators/1.66.0'
import { ViewControl as ViewControlLocators } from '../../locators/1.70.0'

export interface ViewControl extends IPageDecorator<typeof ViewControlLocators> { }
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/bottomBar/BottomBarPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
StatusBar
} from '..'
import { BasePage, PageDecorator, IPageDecorator } from '../utils'
import { BottomBarPanel as BottomBarPanelLocators } from '../../locators/1.66.0'
import { BottomBarPanel as BottomBarPanelLocators } from '../../locators/1.70.0'

export interface BottomBarPanel extends IPageDecorator<typeof BottomBarPanelLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/bottomBar/ProblemsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BottomBarPanel } from '..'
import {
BasePage, ElementWithContextMenu, PageDecorator, IPageDecorator, VSCodeLocatorMap
} from '../utils'
import { ProblemsView as ProblemsViewLocators, Marker as MarkerLocators } from '../../locators/1.66.0'
import { ProblemsView as ProblemsViewLocators, Marker as MarkerLocators } from '../../locators/1.70.0'

export interface ProblemsView extends IPageDecorator<typeof ProblemsViewLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/bottomBar/Views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
OutputView as OutputViewLocators,
DebugConsoleView as DebugConsoleViewLocators,
TerminalView as TerminalViewLocators
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'

export interface OutputView extends IPageDecorator<typeof OutputViewLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/dialog/ModalDialog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PageDecorator, IPageDecorator, BasePage } from '../utils'
import { Dialog as DialogLocators } from '../../locators/1.66.0'
import { Dialog as DialogLocators } from '../../locators/1.70.0'

export interface ModalDialog extends IPageDecorator<typeof DialogLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/ContentAssist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import {
PageDecorator, IPageDecorator, VSCodeLocatorMap, sleep
} from '../utils'
import { ContentAssist as ContentAssistLocators } from '../../locators/1.66.0'
import { ContentAssist as ContentAssistLocators } from '../../locators/1.70.0'

export interface ContentAssist extends IPageDecorator<typeof ContentAssistLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/CustomEditor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Editor, InputBox } from '..'
import { PageDecorator, IPageDecorator } from '../utils'
import { Editor as EditorLocators } from '../../locators/1.66.0'
import { Editor as EditorLocators } from '../../locators/1.70.0'
import { CMD_KEY } from '../../constants'

export interface CustomEditor extends IPageDecorator<typeof EditorLocators> {}
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/DiffEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Editor, EditorLocators } from './Editor'
import { TextEditor } from './TextEditor'
import { EditorView } from './EditorView'
import { PageDecorator, IPageDecorator } from '../utils'
import { DiffEditor as DiffEditorLocators } from '../../locators/1.66.0'
import { DiffEditor as DiffEditorLocators } from '../../locators/1.70.0'

export interface DiffEditor extends IPageDecorator<EditorLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TextEditor as TextEditorLocators,
DiffEditor as DiffEditorLocators,
EditorView as EditorViewLocators
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'

/**
* @hidden
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/EditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import {
EditorView as EditorViewLocators,
Editor as EditorLocatorsObj
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'

export interface EditorView extends IPageDecorator<typeof EditorViewLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/SettingsEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { EditorView, EditorGroup } from '..'
import {
PageDecorator, IPageDecorator, BasePage, VSCodeLocatorMap, sleep
} from '../utils'
import { SettingsEditor as SettingsEditorLocators } from '../../locators/1.66.0'
import { SettingsEditor as SettingsEditorLocators } from '../../locators/1.70.0'

export interface SettingsEditor extends IPageDecorator<EditorLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/editor/TextEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import {
TextEditor as TextEditorLocators,
FindWidget as FindWidgetLocators
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'
import { CMD_KEY } from '../../constants'

export interface TextEditor extends IPageDecorator<EditorLocators> {}
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/menu/ContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Menu, MenuItem } from '..'
import {
PageDecorator, IPageDecorator, VSCodeLocatorMap, sleep
} from '../utils'
import { ContextMenu as ContextMenuLocators } from '../../locators/1.66.0'
import { ContextMenu as ContextMenuLocators } from '../../locators/1.70.0'

export interface ContextMenu extends IPageDecorator<typeof ContextMenuLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/menu/TitleBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PageDecorator, IPageDecorator, VSCodeLocatorMap } from '../utils'
import { WindowControls, ContextMenu } from '..'
import { Menu } from './Menu'
import { MenuItem } from './MenuItem'
import { TitleBar as TitleBarLocators } from '../../locators/1.66.0'
import { TitleBar as TitleBarLocators } from '../../locators/1.70.0'

export interface TitleBar extends IPageDecorator<typeof TitleBarLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/menu/WindowControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PageDecorator, IPageDecorator, BasePage, VSCodeLocatorMap
} from '../utils'
import { TitleBar } from '../..'
import { WindowControls as WindowControlsLocators } from '../../locators/1.66.0'
import { WindowControls as WindowControlsLocators } from '../../locators/1.70.0'

export interface WindowControls extends IPageDecorator<typeof WindowControlsLocators> {}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/sidebar/SideBarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ViewContent, ViewTitlePart } from '..'
import {
PageDecorator, IPageDecorator, BasePage, LocatorComponents
} from '../utils'
import { SideBarView as SideBarViewLocators } from '../../locators/1.66.0'
import { SideBarView as SideBarViewLocators } from '../../locators/1.70.0'

export interface SideBarView<T> extends IPageDecorator<typeof SideBarViewLocators> { }
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/sidebar/ViewContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ExtensionsViewSection } from './extensions/ExtensionsViewSection'
import {
PageDecorator, IPageDecorator, BasePage, VSCodeLocatorMap
} from '../utils'
import { ViewContent as ViewContentLocators } from '../../locators/1.66.0'
import { ViewContent as ViewContentLocators } from '../../locators/1.70.0'

export interface ViewContent extends IPageDecorator<typeof ViewContentLocators> { }
/**
Expand Down
17 changes: 12 additions & 5 deletions src/pageobjects/sidebar/ViewItem.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ChainablePromiseElement } from 'webdriverio'
import {
IPageDecorator, BasePage, ElementWithContextMenu, PageDecorator, VSCodeLocatorMap
} from '../utils'
Expand All @@ -7,7 +8,7 @@ import {
CustomTreeItem as CustomTreeItemLocators,
DefaultTreeItem as DefaultTreeItemLocators,
ExtensionsViewItem as ExtensionsViewItemLocators
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'

/**
* Abstract representation of a row in the tree inside a view content section
Expand Down Expand Up @@ -138,10 +139,15 @@ export abstract class TreeItem extends ViewItem {

const actions: ViewItemAction[] = []
const items = await container.$$(this.locators.actionLabel)

for (const item of items) {
const label = await item.getAttribute(this.locators.actionTitle)
actions.push(new ViewItemAction(this.locatorMap, label, this))
const elem = item.$((this.locatorMap.ViewSection.actionConstructor as () => string)())
const label = (
// v1.69.0 and before
await elem.getAttribute(this.locators.actionTitle)
// v1.70.0 and after
|| await item.getAttribute(this.locators.actionTitle)
)
actions.push(new ViewItemAction(this.locatorMap, elem, label, this))
}
return actions
}
Expand Down Expand Up @@ -213,10 +219,11 @@ export class ViewItemAction extends BasePage<typeof ViewSectionLocators> {

constructor (
locators: VSCodeLocatorMap,
elem: ChainablePromiseElement<WebdriverIO.Element>,
label: string,
viewItem: TreeItem
) {
super(locators, (locators.ViewSection.actionConstructor as Function)(label) as string, viewItem.elem)
super(locators, elem, viewItem.elem)
this.label = label
}

Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/sidebar/ViewSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ExtensionsViewSection as ExtensionsViewSectionLocators,
CustomTreeSection as CustomTreeSectionLocators,
DefaultTreeSection as DefaultTreeSectionLocators
} from '../../locators/1.66.0'
} from '../../locators/1.70.0'

/**
* @hidden
Expand Down
Loading

0 comments on commit a2d95a2

Please sign in to comment.