🏡 index : quine-global/webdriverio.git

// @ts-expect-error resolved by vite
import { expect } from '@wdio/globals'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'

import * as matchers from '@testing-library/jest-dom/matchers'
expect.extend(matchers)

import App from './components/ReactComponent.jsx'

describe('React Component Testing', () => {
    it('Test theme button toggle', async () => {
        render(<App />)
        const buttonEl = screen.getByText(/Current theme/i)

        await userEvent.click(buttonEl)
        expect(buttonEl).toContainHTML('dark')
    })

    it('supports snapshot tests', async () => {
        const { container } = render(<App />)
        await expect(container).toMatchSnapshot()
        await expect(container).toMatchInlineSnapshot(`
"<div>
  <button>Current theme: light</button>
</div>"
`)
    })
})