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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

74 changes: 0 additions & 74 deletions .eslintrc.cjs

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ jobs:
with:
version: 8.8.0
run_install: false
- name: Install dependencies
run: pnpm install
- name: 📦 Bundle
run: pnpm test
run: pnpm -r --workspace-concurrency=1 build
- name: 🧪 Run Tests
run: pnpm test
- name: 🐛 Debug Build
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ jobs:
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm -r --workspace-concurrency=1 build
run: |
pnpm --filter "@wdio/devtools-backend" build
pnpm --filter "@wdio/devtools-script" build
pnpm --filter "@wdio/devtools-service" build
pnpm --filter "@wdio/devtools-app" build
- name: Release
run: pnpm run release:ci -- ${{github.event.inputs.releaseType}}
run: pnpm -r publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96 changes: 96 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const js = require('@eslint/js')
const tsParser = require('@typescript-eslint/parser')
const tsPlugin = require('@typescript-eslint/eslint-plugin')
const importPlugin = require('eslint-plugin-import')
const unicorn = require('eslint-plugin-unicorn')
const prettierConfig = require('eslint-config-prettier')
const prettierPlugin = require('eslint-plugin-prettier')

module.exports = [
{
ignores: ['node_modules/**', '**/dist/**']
},
// Base JS config
{
...js.configs.recommended,
plugins: {
unicorn,
import: importPlugin,
prettier: prettierPlugin
},
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
rules: {
...prettierConfig.rules,
'prettier/prettier': [
'error',
{
bracketSpacing: true,
semi: false,
singleQuote: true,
trailingComma: 'none'
}
],
quotes: ['error', 'single', { avoidEscape: true }],
camelcase: ['error', { properties: 'never' }],
semi: ['error', 'never'],
eqeqeq: ['error', 'always'],
'prefer-const': 'error',
'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }],
'array-bracket-spacing': ['error', 'never'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-spacing': ['error', { before: false, after: true }],
'no-lonely-if': 'error',
'dot-notation': 'error',
'no-else-return': 'error',
'no-tabs': 'error',
'no-trailing-spaces': [
'error',
{ skipBlankLines: false, ignoreComments: false }
],
'no-var': 'error',
'unicode-bom': ['error', 'never'],
curly: ['error', 'all'],
'object-curly-spacing': ['error', 'always'],
'keyword-spacing': ['error'],
'require-atomic-updates': 0,
'linebreak-style': ['error', 'unix'],
'import/extensions': ['error', 'ignorePackages'],
'no-restricted-syntax': [
'error',
'IfStatement > ExpressionStatement > AssignmentExpression'
]
}
},

// TypeScript files
{
files: ['**/*.ts'],
plugins: {
'@typescript-eslint': tsPlugin
},
languageOptions: {
parser: tsParser
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' }
],
'@typescript-eslint/consistent-type-imports': 'error',
'no-unused-vars': 'off',
'no-undef': 'off',
'no-redeclare': 'off'
}
},

// TypeScript test files
{
files: ['**/*.test.ts'],
rules: {
'dot-notation': 'off'
}
}
]
54 changes: 27 additions & 27 deletions example/features/pageobjects/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ import Page from './page.js'
* sub page containing specific selectors and methods for a specific page
*/
class LoginPage extends Page {
/**
* define selectors using getter methods
*/
public get inputUsername () {
return $('#username')
}
/**
* define selectors using getter methods
*/
public get inputUsername() {
return $('#username')
}

public get inputPassword () {
return $('#password')
}
public get inputPassword() {
return $('#password')
}

public get btnSubmit () {
return $('button[type="submit"]')
}
public get btnSubmit() {
return $('button[type="submit"]')
}

/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/
public async login (username: string, password: string) {
await this.inputUsername.setValue(username)
await this.inputPassword.setValue(password)
await this.btnSubmit.click()
}
/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/
public async login(username: string, password: string) {
await this.inputUsername.setValue(username)
await this.inputPassword.setValue(password)
await this.btnSubmit.click()
}

/**
* overwrite specific options to adapt it to page object
*/
public open () {
return super.open('login')
}
/**
* overwrite specific options to adapt it to page object
*/
public open() {
return super.open('login')
}
}

export default new LoginPage()
20 changes: 10 additions & 10 deletions example/features/pageobjects/page.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { browser } from '@wdio/globals'

/**
* main page object containing all methods, selectors and functionality
* that is shared across all page objects
*/
* main page object containing all methods, selectors and functionality
* that is shared across all page objects
*/
export default class Page {
/**
* Opens a sub page of the page
* @param path path of the sub page (e.g. /path/to/page.html)
*/
public open (path: string) {
return browser.url(`https://the-internet.herokuapp.com/${path}`)
}
/**
* Opens a sub page of the page
* @param path path of the sub page (e.g. /path/to/page.html)
*/
public open(path: string) {
return browser.url(`https://the-internet.herokuapp.com/${path}`)
}
}
12 changes: 6 additions & 6 deletions example/features/pageobjects/secure.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import Page from './page.js'
* sub page containing specific selectors and methods for a specific page
*/
class SecurePage extends Page {
/**
* define selectors using getter methods
*/
public get flashAlert () {
return $('#flash')
}
/**
* define selectors using getter methods
*/
public get flashAlert() {
return $('#flash')
}
}

export default new SecurePage()
17 changes: 8 additions & 9 deletions example/features/step-definitions/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@ import LoginPage from '../pageobjects/login.page.js'
import SecurePage from '../pageobjects/secure.page.js'

const pages = {
login: LoginPage
login: LoginPage
} as const

After(async () => {
await browser.reloadSession()
await browser.reloadSession()
})

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

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

Then(/^I should see a flash message saying (.*)$/, async (message) => {
const el = await SecurePage.flashAlert
await expect(el).toBeExisting()
await expect(el).toHaveText(expect.stringContaining(message))
await browser.pause(15000)
const el = await SecurePage.flashAlert
await expect(el).toBeExisting()
await expect(el).toHaveText(expect.stringContaining(message))
// await browser.pause(15000)
})

Loading