next.js/test/e2e/new-link-behavior/material-ui.test.ts
material-ui.test.ts36 lines1.1 KB
import { FileRef, nextTestSetup } from 'e2e-utils'
import webdriver from 'next-webdriver'
import path from 'path'

const appDir = path.join(__dirname, 'material-ui')

describe('New Link Behavior with material-ui', () => {
  const { next } = nextTestSetup({
    files: {
      pages: new FileRef(path.join(appDir, 'pages')),
      src: new FileRef(path.join(appDir, 'src')),
      'next.config.js': new FileRef(path.join(appDir, 'next.config.js')),
    },
    dependencies: {
      '@emotion/cache': 'latest',
      '@emotion/react': 'latest',
      '@emotion/server': 'latest',
      '@emotion/styled': 'latest',
      '@mui/icons-material': 'latest',
      '@mui/material': 'latest',
      'prop-types': 'latest',
    },
  })

  it('should render MuiLink with <a>', async () => {
    const browser = await webdriver(next.url, `/`)
    const element = browser.elementByCss('a[href="/about"]')

    const color = await element.getComputedCss('color')
    expect(color).toBe('rgb(25, 133, 123)')

    const text = await element.text()
    expect(text).toBe('Go to the about page')
  })
})
Quest for Codev2.0.0
/
SIGN IN