microsoft / playwright-test

Build a cross-browser end-to-end test suite with Playwright.
https://playwright.dev
Apache License 2.0
777 stars 34 forks source link

Basic example tests seem to be broken #154

Closed jordangarside closed 4 years ago

jordangarside commented 4 years ago

I just updated from 0.9.6 to 0.9.16 and started getting this error when running any of my tests:

TypeError: Cannot read property 'it' of undefined

  3 | import { LoginPage } from '.'
  4 | 
> 5 | it(
    | ^
  6 |   'should render the login page without CORS errors',
  7 |   (test, params) => {

    at FolioImpl.it.args (/Users/jordan.garside/app/node_modules/folio/out/spec.js:32:28)
    at Object.<anonymous> (/Users/jordan.garside/app/test/index.test.ts:5:1)

L1: import { it, expect } from '@playwright/test'

It looks like folio was added as a dependency at some point.

arjunattam commented 4 years ago

Hey @jordangarside. We renamed microsoft/playwright-test-runner to microsoft/folio, which is also now published to NPM. Folio continues to be the foundation for this package, which is called @playwright/test.

We have been re-working the API for a preview release, which probably broke something here. The syntax for it seems correct to me but I suspect the command to run the test needs to be changed. I've updated the getting started section for the latest bits.

jordangarside commented 4 years ago

Gotcha, will take a look thanks!

jordangarside commented 4 years ago

Yeah seems to be working correctly with folio instead of @playwright/test-runner. 👍

andrewmclagan commented 3 years ago

I'm confused sorry. Having the import from:

const { it, expect } = require('@playwright/test');

Breaks with the error the op noted above.

rdrwoodall-s5 commented 3 years ago

I am seeing the same behavior as @andrewmclagan above when following the latest documentation from the readme. @jordangarside can you clarify how you were able to get this working please?

jordangarside commented 3 years ago

Follow the instructions here: https://github.com/microsoft/folio#with-fixtures

I just install @playwright/test, and then do this:

import { folio } from '@playwright/test'

const fixtures = folio.extend()

const { it, expect } = fixtures.build();