Skip to content

Commit

Permalink
chore: remove internal uses of "folio" (#6931)
Browse files Browse the repository at this point in the history
Replaced by "pwt" or "playwright test".
  • Loading branch information
dgozman authored Jun 7, 2021
1 parent b556ee6 commit 46a0213
Show file tree
Hide file tree
Showing 37 changed files with 271 additions and 271 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ A barrier for introducing new installation dependencies is especially high:
- Tests should be *hermetic*. Tests should not depend on external services.
- Tests should work on all three platforms: Mac, Linux and Win. This is especially important for screenshot tests.

Playwright tests are located in [`tests`](https://github.com/microsoft/playwright/blob/master/tests) and use [Folio](https://github.com/microsoft/folio) test runner.
Playwright tests are located in [`tests`](https://github.com/microsoft/playwright/blob/master/tests) and use `@playwright/test` test runner.
These are integration tests, making sure public API methods and events work as expected.

- To run all tests:
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright-test/access-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { test, expect } from './playwright-test-fixtures';
test('should access error in fixture', async ({ runInlineTest }) => {
const result = await runInlineTest({
'test-error-visible-in-env.spec.ts': `
const test = folio.test.extend({
const test = pwt.test.extend({
foo: [async ({}, run, testInfo) => {
await run();
console.log('ERROR[[[' + JSON.stringify(testInfo.error, undefined, 2) + ']]]');
Expand All @@ -40,7 +40,7 @@ test('should access error in fixture', async ({ runInlineTest }) => {
test('should access annotations in fixture', async ({ runInlineTest }) => {
const { exitCode, report } = await runInlineTest({
'test-data-visible-in-env.spec.ts': `
const test = folio.test.extend({
const test = pwt.test.extend({
foo: [async ({}, run, testInfo) => {
await run();
testInfo.annotations.push({ type: 'myname', description: 'hello' });
Expand Down Expand Up @@ -74,7 +74,7 @@ test('should report projectName in result', async ({ runInlineTest }) => {
};
`,
'test-data-visible-in-env.spec.ts': `
folio.test('some test', async ({}, testInfo) => {
pwt.test('some test', async ({}, testInfo) => {
});
`
});
Expand Down
8 changes: 4 additions & 4 deletions tests/playwright-test/base-reporter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('handle long test names', async ({ runInlineTest }) => {
const title = 'title'.repeat(30);
const result = await runInlineTest({
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('${title}', async ({}) => {
expect(1).toBe(0);
});
Expand All @@ -33,7 +33,7 @@ test('handle long test names', async ({ runInlineTest }) => {
test('print the error name', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('foobar', async ({}) => {
const error = new Error('my-message');
error.name = 'FooBarError';
Expand All @@ -49,7 +49,7 @@ test('print the error name', async ({ runInlineTest }) => {
test('print should print the error name without a message', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('foobar', async ({}) => {
const error = new Error();
error.name = 'FooBarError';
Expand All @@ -75,7 +75,7 @@ test('print an error in a codeframe', async ({ runInlineTest }) => {
}
`,
'a.spec.ts': `
const { test } = folio;
const { test } = pwt;
import myLib from './my-lib';
test('foobar', async ({}) => {
const error = new Error('my-message');
Expand Down
20 changes: 10 additions & 10 deletions tests/playwright-test/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as path from 'path';
test('should fail', async ({ runInlineTest }) => {
const result = await runInlineTest({
'one-failure.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('fails', () => {
expect(1 + 1).toBe(7);
});
Expand All @@ -35,7 +35,7 @@ test('should fail', async ({ runInlineTest }) => {
test('should timeout', async ({ runInlineTest }) => {
const { exitCode, passed, failed, output } = await runInlineTest({
'one-timeout.spec.js': `
const { test } = folio;
const { test } = pwt;
test('timeout', async () => {
await new Promise(f => setTimeout(f, 10000));
});
Expand All @@ -50,7 +50,7 @@ test('should timeout', async ({ runInlineTest }) => {
test('should succeed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'one-success.spec.js': `
const { test } = folio;
const { test } = pwt;
test('succeeds', () => {
expect(1 + 1).toBe(2);
});
Expand All @@ -67,7 +67,7 @@ test('should report suite errors', async ({ runInlineTest }) => {
if (new Error().stack.includes('workerRunner'))
throw new Error('Suite error');
const { test } = folio;
const { test } = pwt;
test('passes',() => {
expect(1 + 1).toBe(2);
});
Expand All @@ -81,7 +81,7 @@ test('should report suite errors', async ({ runInlineTest }) => {
test('should respect nested skip', async ({ runInlineTest }) => {
const { exitCode, passed, failed, skipped } = await runInlineTest({
'nested-skip.spec.js': `
const { test } = folio;
const { test } = pwt;
test.describe('skipped', () => {
test.skip();
test('succeeds',() => {
Expand All @@ -99,7 +99,7 @@ test('should respect nested skip', async ({ runInlineTest }) => {
test('should respect excluded tests', async ({ runInlineTest }) => {
const { exitCode, passed } = await runInlineTest({
'excluded.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('included test', () => {
expect(1 + 1).toBe(2);
});
Expand Down Expand Up @@ -135,7 +135,7 @@ test('should respect excluded tests', async ({ runInlineTest }) => {
test('should respect focused tests', async ({ runInlineTest }) => {
const { exitCode, passed } = await runInlineTest({
'focused.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('included test', () => {
expect(1 + 1).toBe(3);
});
Expand Down Expand Up @@ -183,7 +183,7 @@ test('should respect focused tests', async ({ runInlineTest }) => {
test('skip should take priority over fail', async ({ runInlineTest }) => {
const { passed, skipped, failed } = await runInlineTest({
'test.spec.ts': `
const { test } = folio;
const { test } = pwt;
test.describe('failing suite', () => {
test.fail();
Expand Down Expand Up @@ -220,13 +220,13 @@ test('should focus test from one runTests', async ({ runInlineTest }) => {
] };
`,
'a/afile.spec.ts': `
const { test } = folio;
const { test } = pwt;
test('just a test', () => {
expect(1 + 1).toBe(3);
});
`,
'b/bfile.spec.ts': `
const { test } = folio;
const { test } = pwt;
test.only('focused test', () => {
expect(1 + 1).toBe(2);
});
Expand Down
42 changes: 21 additions & 21 deletions tests/playwright-test/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('should be able to define config', async ({ runInlineTest }) => {
module.exports = { timeout: 12345 };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
expect(testInfo.timeout).toBe(12345);
});
Expand All @@ -41,7 +41,7 @@ test('should prioritize project timeout', async ({ runInlineTest }) => {
module.exports = { timeout: 500, projects: [{ timeout: 10000}, {}] };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
await new Promise(f => setTimeout(f, 1500));
});
Expand All @@ -60,7 +60,7 @@ test('should prioritize command line timeout over project timeout', async ({ run
module.exports = { projects: [{ timeout: 10000}] };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
await new Promise(f => setTimeout(f, 1500));
});
Expand All @@ -81,12 +81,12 @@ test('should read config from --config, resolve relative testDir', async ({ runI
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('ignored', async ({}) => {
});
`,
'dir/b.test.ts': `
const { test } = folio;
const { test } = pwt;
test('run', async ({}) => {
});
`,
Expand All @@ -104,12 +104,12 @@ test('should default testDir to the config file', async ({ runInlineTest }) => {
module.exports = {};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('ignored', async ({}) => {
});
`,
'dir/b.test.ts': `
const { test } = folio;
const { test } = pwt;
test('run', async ({}) => {
});
`,
Expand All @@ -133,7 +133,7 @@ test('should be able to set reporters', async ({ runInlineTest }, testInfo) => {
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async () => {
});
`
Expand All @@ -154,12 +154,12 @@ test('should support different testDirs', async ({ runInlineTest }) => {
] };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('runs once', async ({}) => {
});
`,
'dir/b.test.ts': `
const { test } = folio;
const { test } = pwt;
test('runs twice', async ({}) => {
});
`,
Expand All @@ -181,7 +181,7 @@ test('should allow export default form the config file', async ({ runInlineTest
export default { timeout: 1000 };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('fails', async ({}, testInfo) => {
await new Promise(f => setTimeout(f, 2000));
});
Expand All @@ -203,13 +203,13 @@ test('should allow root testDir and use it for relative paths', async ({ runInli
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('fails', async ({}, testInfo) => {
expect(1 + 1).toBe(3);
});
`,
'dir/a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('fails', async ({}, testInfo) => {
expect(1 + 1).toBe(3);
});
Expand All @@ -226,11 +226,11 @@ test('should allow root testDir and use it for relative paths', async ({ runInli
test('should throw when test() is called in config file', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
folio.test('hey', () => {});
pwt.test('hey', () => {});
module.exports = {};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('test', async ({}) => {
});
`,
Expand All @@ -247,7 +247,7 @@ test('should filter by project, case-insensitive', async ({ runInlineTest }) =>
] };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
console.log(testInfo.project.name);
});
Expand All @@ -269,7 +269,7 @@ test('should print nice error when project is unknown', async ({ runInlineTest }
] };
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
console.log(testInfo.project.name);
});
Expand All @@ -285,7 +285,7 @@ test('should work without config file', async ({ runInlineTest }) => {
throw new Error('This file should not be required');
`,
'dir/a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}) => {
test.expect(1 + 1).toBe(2);
});
Expand All @@ -308,7 +308,7 @@ test('should inerhit use options in projects', async ({ runInlineTest }) => {
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({ foo, bar }, testInfo) => {
test.expect(foo).toBe('config');
test.expect(bar).toBe('project');
Expand All @@ -328,7 +328,7 @@ test('should work with undefined values and base', async ({ runInlineTest }) =>
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}, testInfo) => {
expect(testInfo.config.updateSnapshots).toBe('none');
});
Expand Down Expand Up @@ -381,7 +381,7 @@ test('should work with custom reporter', async ({ runInlineTest }) => {
};
`,
'a.test.ts': `
const { test } = folio;
const { test } = pwt;
test('pass', async ({}) => {
console.log('log');
console.error('error');
Expand Down
10 changes: 5 additions & 5 deletions tests/playwright-test/dot-reporter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { test, expect, stripAscii } from './playwright-test-fixtures';
test('render expected', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('one', async ({}) => {
expect(1).toBe(1);
});
Expand All @@ -33,7 +33,7 @@ test('render expected', async ({ runInlineTest }) => {
test('render unexpected', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('one', async ({}) => {
expect(1).toBe(0);
});
Expand All @@ -46,7 +46,7 @@ test('render unexpected', async ({ runInlineTest }) => {
test('render unexpected after retry', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('one', async ({}) => {
expect(1).toBe(0);
});
Expand All @@ -61,7 +61,7 @@ test('render unexpected after retry', async ({ runInlineTest }) => {
test('render flaky', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('one', async ({}, testInfo) => {
expect(testInfo.retry).toBe(3);
});
Expand All @@ -81,7 +81,7 @@ test('should work from config', async ({ runInlineTest }) => {
module.exports = { reporter: 'dot' };
`,
'a.test.js': `
const { test } = folio;
const { test } = pwt;
test('one', async ({}) => {
expect(1).toBe(1);
});
Expand Down
Loading

0 comments on commit 46a0213

Please sign in to comment.