rsnext/test/e2e/new-link-behavior/stitches.test.ts
Tim Neutkens 7d3bfac39f
Add stitches and material-ui tests for new link behavior + fix TypeScript types when imported (#36474)
Adds additional tests for material-ui and stitches based on questions in the Twitter thread.

Fixes TypeScript types when `LinkProps` is imported and used in combination with `<button>`, added a TODO to change this at a later point when the new behavior is the default instead of opt-in.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-26 11:46:09 +00:00

41 lines
1.2 KiB
TypeScript

import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import webdriver from 'next-webdriver'
import path from 'path'
const appDir = path.join(__dirname, 'stitches')
describe('New Link Behavior with stitches', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
pages: new FileRef(path.join(appDir, 'pages')),
components: new FileRef(path.join(appDir, 'components')),
'next.config.js': new FileRef(path.join(appDir, 'next.config.js')),
'stitches.config.js': new FileRef(
path.join(appDir, 'stitches.config.js')
),
},
dependencies: {
'@stitches/react': '^1.2.6',
next: 'latest',
react: 'latest',
'react-dom': 'latest',
},
})
})
afterAll(() => next.destroy())
it('should render <a>', async () => {
const browser = await webdriver(next.url, `/`)
const element = await browser.elementByCss('a[href="/about"]')
const color = await element.getComputedCss('color')
expect(color).toBe('rgb(78, 39, 231)')
const text = await element.text()
expect(text).toBe('Visit About')
})
})