kreteshq / kretes

A Programming Environment for TypeScript & Deno
https://kretes.dev/
Other
675 stars 35 forks source link

Feature tests #82

Open emilos opened 4 years ago

emilos commented 4 years ago

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

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 commented 4 years ago

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