Skip to content

Commit cdaf586

Browse files
committed
WIP
1 parent 8a011aa commit cdaf586

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3998
-3355
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ jobs:
3434
with:
3535
version: 8.8.0
3636
run_install: false
37+
- name: Install dependencies
38+
run: pnpm install
3739
- name: 📦 Bundle
38-
run: pnpm test
40+
run: pnpm -r --workspace-concurrency=1 build
3941
- name: 🧪 Run Tests
4042
run: pnpm test
4143
- name: 🐛 Debug Build

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ jobs:
5050
- name: Install Dependencies
5151
run: pnpm install
5252
- name: Build
53-
run: pnpm -r --workspace-concurrency=1 build
53+
run: |
54+
pnpm --filter "@wdio/devtools-backend" build
55+
pnpm --filter "@wdio/devtools-script" build
56+
pnpm --filter "@wdio/devtools-service" build
57+
pnpm --filter "@wdio/devtools-app" build
5458
- name: Release
55-
run: pnpm run release:ci -- ${{github.event.inputs.releaseType}}
59+
run: pnpm -r publish --access public --no-git-checks
5660
env:
5761
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5862
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

eslint.config.cjs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
const js = require('@eslint/js')
2+
const tsParser = require('@typescript-eslint/parser')
3+
const tsPlugin = require('@typescript-eslint/eslint-plugin')
4+
const importPlugin = require('eslint-plugin-import')
5+
const unicorn = require('eslint-plugin-unicorn')
6+
const prettierConfig = require('eslint-config-prettier')
7+
const prettierPlugin = require('eslint-plugin-prettier')
8+
9+
module.exports = [
10+
{
11+
ignores: ['node_modules/**', '**/dist/**']
12+
},
13+
// Base JS config
14+
{
15+
...js.configs.recommended,
16+
plugins: {
17+
unicorn,
18+
import: importPlugin,
19+
prettier: prettierPlugin
20+
},
21+
languageOptions: {
22+
ecmaVersion: 2020,
23+
sourceType: 'module'
24+
},
25+
rules: {
26+
...prettierConfig.rules,
27+
'prettier/prettier': [
28+
'error',
29+
{
30+
bracketSpacing: true,
31+
semi: false,
32+
singleQuote: true,
33+
trailingComma: 'none'
34+
}
35+
],
36+
quotes: ['error', 'single', { avoidEscape: true }],
37+
camelcase: ['error', { properties: 'never' }],
38+
semi: ['error', 'never'],
39+
eqeqeq: ['error', 'always'],
40+
'prefer-const': 'error',
41+
'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }],
42+
'array-bracket-spacing': ['error', 'never'],
43+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
44+
'comma-spacing': ['error', { before: false, after: true }],
45+
'no-lonely-if': 'error',
46+
'dot-notation': 'error',
47+
'no-else-return': 'error',
48+
'no-tabs': 'error',
49+
'no-trailing-spaces': [
50+
'error',
51+
{ skipBlankLines: false, ignoreComments: false }
52+
],
53+
'no-var': 'error',
54+
'unicode-bom': ['error', 'never'],
55+
curly: ['error', 'all'],
56+
'object-curly-spacing': ['error', 'always'],
57+
'keyword-spacing': ['error'],
58+
'require-atomic-updates': 0,
59+
'linebreak-style': ['error', 'unix'],
60+
'import/extensions': ['error', 'ignorePackages'],
61+
'no-restricted-syntax': [
62+
'error',
63+
'IfStatement > ExpressionStatement > AssignmentExpression'
64+
]
65+
}
66+
},
67+
68+
// TypeScript files
69+
{
70+
files: ['**/*.ts'],
71+
plugins: {
72+
'@typescript-eslint': tsPlugin
73+
},
74+
languageOptions: {
75+
parser: tsParser
76+
},
77+
rules: {
78+
'@typescript-eslint/no-unused-vars': [
79+
'error',
80+
{ argsIgnorePattern: '^_' }
81+
],
82+
'@typescript-eslint/consistent-type-imports': 'error',
83+
'no-unused-vars': 'off',
84+
'no-undef': 'off',
85+
'no-redeclare': 'off'
86+
}
87+
},
88+
89+
// TypeScript test files
90+
{
91+
files: ['**/*.test.ts'],
92+
rules: {
93+
'dot-notation': 'off'
94+
}
95+
}
96+
]

example/features/pageobjects/login.page.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ import Page from './page.js'
55
* sub page containing specific selectors and methods for a specific page
66
*/
77
class LoginPage extends Page {
8-
/**
9-
* define selectors using getter methods
10-
*/
11-
public get inputUsername () {
12-
return $('#username')
13-
}
8+
/**
9+
* define selectors using getter methods
10+
*/
11+
public get inputUsername() {
12+
return $('#username')
13+
}
1414

15-
public get inputPassword () {
16-
return $('#password')
17-
}
15+
public get inputPassword() {
16+
return $('#password')
17+
}
1818

19-
public get btnSubmit () {
20-
return $('button[type="submit"]')
21-
}
19+
public get btnSubmit() {
20+
return $('button[type="submit"]')
21+
}
2222

23-
/**
24-
* a method to encapsule automation code to interact with the page
25-
* e.g. to login using username and password
26-
*/
27-
public async login (username: string, password: string) {
28-
await this.inputUsername.setValue(username)
29-
await this.inputPassword.setValue(password)
30-
await this.btnSubmit.click()
31-
}
23+
/**
24+
* a method to encapsule automation code to interact with the page
25+
* e.g. to login using username and password
26+
*/
27+
public async login(username: string, password: string) {
28+
await this.inputUsername.setValue(username)
29+
await this.inputPassword.setValue(password)
30+
await this.btnSubmit.click()
31+
}
3232

33-
/**
34-
* overwrite specific options to adapt it to page object
35-
*/
36-
public open () {
37-
return super.open('login')
38-
}
33+
/**
34+
* overwrite specific options to adapt it to page object
35+
*/
36+
public open() {
37+
return super.open('login')
38+
}
3939
}
4040

4141
export default new LoginPage()
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { browser } from '@wdio/globals'
22

33
/**
4-
* main page object containing all methods, selectors and functionality
5-
* that is shared across all page objects
6-
*/
4+
* main page object containing all methods, selectors and functionality
5+
* that is shared across all page objects
6+
*/
77
export default class Page {
8-
/**
9-
* Opens a sub page of the page
10-
* @param path path of the sub page (e.g. /path/to/page.html)
11-
*/
12-
public open (path: string) {
13-
return browser.url(`https://the-internet.herokuapp.com/${path}`)
14-
}
8+
/**
9+
* Opens a sub page of the page
10+
* @param path path of the sub page (e.g. /path/to/page.html)
11+
*/
12+
public open(path: string) {
13+
return browser.url(`https://the-internet.herokuapp.com/${path}`)
14+
}
1515
}

example/features/pageobjects/secure.page.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import Page from './page.js'
55
* sub page containing specific selectors and methods for a specific page
66
*/
77
class SecurePage extends Page {
8-
/**
9-
* define selectors using getter methods
10-
*/
11-
public get flashAlert () {
12-
return $('#flash')
13-
}
8+
/**
9+
* define selectors using getter methods
10+
*/
11+
public get flashAlert() {
12+
return $('#flash')
13+
}
1414
}
1515

1616
export default new SecurePage()

example/features/step-definitions/steps.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ import LoginPage from '../pageobjects/login.page.js'
55
import SecurePage from '../pageobjects/secure.page.js'
66

77
const pages = {
8-
login: LoginPage
8+
login: LoginPage
99
} as const
1010

1111
After(async () => {
12-
await browser.reloadSession()
12+
await browser.reloadSession()
1313
})
1414

1515
Given(/^I am on the (\w+) page$/, async (page: keyof typeof pages) => {
16-
await pages[page].open()
16+
await pages[page].open()
1717
})
1818

1919
When(/^I login with (\w+) and (.+)$/, async (username, password) => {
20-
await LoginPage.login(username, password)
20+
await LoginPage.login(username, password)
2121
})
2222

2323
Then(/^I should see a flash message saying (.*)$/, async (message) => {
24-
const el = await SecurePage.flashAlert
25-
await expect(el).toBeExisting()
26-
await expect(el).toHaveText(expect.stringContaining(message))
27-
await browser.pause(15000)
24+
const el = await SecurePage.flashAlert
25+
await expect(el).toBeExisting()
26+
await expect(el).toHaveText(expect.stringContaining(message))
27+
// await browser.pause(15000)
2828
})
29-

0 commit comments

Comments
 (0)