Commit Graph

8 Commits

Author SHA1 Message Date
Dmitry Gozman
3d89506704
fix(fixtures): make undefined option mean "default value" (#16026)
In the following example, `locale` inside the `describe`
would be reverted to the default value:

```js
test.use({ locale: 'en-GB' });

test.decsribe(() => {
  test.use({ locale: undefined });
});
```
2022-07-28 12:57:05 -07:00
Dmitry Gozman
6009804e0e
Revert "fix(test runner): ignore undefined values in fixtures definit…ions (#15119)" (#15979)
Revert "fix(test runner): ignore undefined values in fixtures definitions (#15119)"

Revert commit d7b63fa0b4.
Add a test for the broken behavior.
2022-07-27 08:51:45 -07:00
Dmitry Gozman
d7b63fa0b4
fix(test runner): ignore undefined values in fixtures definitions (#15119)
These mean "I don't want to specify this fixture/option"
instead of "I want the value of undefined", aligned with how TypeScript works.
We already do similar things in the config.
2022-06-27 11:31:41 -07:00
Dmitry Gozman
f77c874e8a
feat(test runner): make _extendTest experimental (#11210)
Hidden from types and docs.
2022-01-05 15:54:00 -08:00
Dmitry Gozman
d9f849fb14
feat(test runner): replace declare/define with "options" (#10293)
1. Fixtures defined in test.extend() can now have `{ option: true }` configuration that makes them overridable in the config. Options support all other properties of fixtures - value/function, scope, auto.
```
const test = base.extend<MyOptions>({
  foo: ['default', { option: true }],
});
```

2. test.declare() and project.define are removed.

3. project.use applies overrides to default option values and nothing else. Any test.extend() and test.use() calls take priority over config options.

Required user changes: if someone used to define fixture options with test.extend(), overriding them in config will stop working. The solution is to add `{ option: true }`.

```
// Old code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: 123,
  myFixture: ({ myOption }, use) => use(2 * myOption),
});

// New code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: [123, { option: true }],
  myFixture: ({ myOption }, use) => use(2 * myOption),
});
```
2021-11-18 15:45:52 -08:00
Max Schmitt
0776cf76a2
feat(test-runner): do only allow unique spec titles per suite (#7300) 2021-06-28 22:13:35 +02:00
Dmitry Gozman
46a0213769
chore: remove internal uses of "folio" (#6931)
Replaced by "pwt" or "playwright test".
2021-06-06 22:07:07 -07:00
Dmitry Gozman
f745bf1fbc
chore: bring in folio source (#6923)
- Source now lives at `src/test`.
- Former folio tests live at `tests/playwright-test`.
- We use `src/test/internal.ts` that exposes base test without
  Playwright fixtures for most tests (to avoid modifications for now).
- Test types live in `types/testFoo.d.ts`.
- Stable test runner is installed to `tests/config/test-runner` during `npm install`.
- All deps including test-only are now listed in `package.json`.
  Non-test deps must also be listed in `build_package.js` to get included.
2021-06-06 17:09:53 -07:00