Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- ionic-react
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 18
node-version: 22
- name: Install
run: npm install
working-directory: ${{ matrix.exampleDir }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.0
v22
3,017 changes: 1,543 additions & 1,474 deletions react-typescript-vite/package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions react-typescript-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
"wdio": "wdio run ./wdio.conf.ts"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@testing-library/react": "^16.2.0",
"@testing-library/react": "^16.3.0",
"@types/mocha": "^10.0.10",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
"@wdio/browser-runner": "^9.7.3",
"@wdio/cli": "^9.7.3",
"@wdio/globals": "^9.7.3",
"@wdio/mocha-framework": "^9.7.3",
"@wdio/spec-reporter": "^9.6.3",
"@types/react": "^19.1.14",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.3",
"@wdio/browser-runner": "^9.19.2",
"@wdio/cli": "^9.19.2",
"@wdio/globals": "^9.17.0",
"@wdio/mocha-framework": "^9.19.2",
"@wdio/spec-reporter": "^9.19.2",
"ts-node": "^10.9.2",
"typescript": "^5.7.3",
"vite": "^6.1.0"
"typescript": "^5.9.2",
"vite": "^7.1.7"
}
}
10 changes: 4 additions & 6 deletions react-typescript-vite/src/tests/HelloWorld.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import React from 'react'
/// <reference types="@wdio/globals/types" />
import 'react'
import { $, expect } from '@wdio/globals'
import { render } from '@testing-library/react'
import App from '../App'

describe('React Component Testing', () => {
it('increments value on click', async () => {
// The render method returns a collection of utilities to query your component.
const { getByText } = render(<App />)
render(<App />)

// getByText returns the first matching node for the provided text, and
// throws an error if no elements match or if more than one match is found.
const btn = getByText('count is 0')
const button = await $(btn)
const button = await $('button*=count is')

// Dispatch a native click event to our button element.
await button.click()
Expand Down
16 changes: 8 additions & 8 deletions react-typescript-vite/src/tests/LoginForm.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference types="@wdio/globals/types" />
import React from 'react'
import 'react'
import { $, expect } from '@wdio/globals'
import { fn } from '@wdio/browser-runner'
import { Key } from 'webdriverio'
Expand Down Expand Up @@ -46,16 +46,16 @@ describe('LoginForm', () => {
await $username.setValue(username)
await $password.setValue(password)
await $btnLogin.click()
expect(onLogin).toBeCalledTimes(1)
expect(onLogin).toBeCalledWith({ username, password })
expect(onLogin).toHaveBeenCalledTimes(1)
expect(onLogin).toHaveBeenCalledWith({ username, password })
})

it('should call onLogin with username and password when enter is pressed in an input', async () => {
await $username.setValue(username)
await $password.setValue(password)
await browser.keys(Key.Enter)
expect(onLogin).toBeCalledTimes(1)
expect(onLogin).toBeCalledWith({ username, password })
expect(onLogin).toHaveBeenCalledTimes(1)
expect(onLogin).toHaveBeenCalledWith({ username, password })
})

it('should show both validation errors if login is attempted without entering username or password', async () => {
Expand All @@ -66,7 +66,7 @@ describe('LoginForm', () => {
await expect($form).toHaveText(
expect.stringContaining('Password is required')
)
expect(onLogin).toBeCalledTimes(0)
expect(onLogin).toHaveBeenCalledTimes(0)
})

it('should only show password validation error if login is attempted without entering password', async () => {
Expand All @@ -78,7 +78,7 @@ describe('LoginForm', () => {
await expect($form).toHaveText(
expect.stringContaining('Password is required')
)
expect(onLogin).toBeCalledTimes(0)
expect(onLogin).toHaveBeenCalledTimes(0)
})

it('should only show username validation error if login is attempted without entering username', async () => {
Expand All @@ -90,7 +90,7 @@ describe('LoginForm', () => {
await expect($form).not.toHaveText(
expect.stringContaining('Password is required')
)
expect(onLogin).toBeCalledTimes(0)
expect(onLogin).toHaveBeenCalledTimes(0)
})

it('should not show any validation errors before login is attempted', async () => {
Expand Down
Loading
Loading