Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature tests #82

Open
3 tasks
emilos opened this issue Mar 19, 2020 · 1 comment
Open
3 tasks

Feature tests #82

emilos opened this issue Mar 19, 2020 · 1 comment

Comments

@emilos
Copy link

emilos commented Mar 19, 2020

Context

Big apps need specs. We should definitely have a built-in way to add specs so that the user doesn't need to set it up on his/her own.

Acceptance criteria

  • tests can be run in parallel
  • puppeteer?
  • start/stop server in every spec on a random port

e.g. maybe something like:

import { test, Server, Browser, expect } from 'huncwot/test'

test('user can see the home page', async() => {
  const server = new Server()
  const { url } = await server.start()
  const browser = new Browser()
  const page = await browser.open(url)
  const html = await page.content()
  expect(html).toContain("Hello, world!")
  await browser.close()
  await server.stop()
})

or

import { test, expect } from 'huncwot/test'
import { visit } from 'huncwot/test/feature'

test('user can see the home page', async () => {
  const { page } = await visit('/')
  expect(page).toContain('Hello, world')
  await page.close() // ?
})
@zaiste
Copy link
Collaborator

zaiste commented Mar 19, 2020

@emilos That's great idea. I wanted to use playwright for hits

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants