Skip to content

Commit cef27d6

Browse files
authored
chore: split playwright.fixtures into files (3) (#3984)
1 parent 76be954 commit cef27d6

38 files changed

+341
-211
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"devDependencies": {
5252
"@playwright/test": "^0.9.6",
53-
"@playwright/test-runner": "^0.9.14",
53+
"@playwright/test-runner": "^0.9.15",
5454
"@types/debug": "^4.1.5",
5555
"@types/extract-zip": "^1.6.2",
5656
"@types/mime": "^2.0.3",

test/browsercontext-basic.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { it, expect, verifyViewport } from './playwright.fixtures';
18+
import { it, expect } from './playwright.fixtures';
19+
import { verifyViewport } from './utils';
1920

2021
it('should create new context', async function({browser}) {
2122
expect(browser.contexts().length).toBe(0);

test/browsercontext-csp.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { it, expect, attachFrame } from './playwright.fixtures';
17+
import { it, expect } from './playwright.fixtures';
18+
import { attachFrame } from './utils';
1819

1920
it('should bypass CSP meta tag', async ({browser, server}) => {
2021
// Make sure CSP prohibits addScriptTag.

test/browsercontext-user-agent.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { it, expect, attachFrame } from './playwright.fixtures';
17+
import { it, expect } from './playwright.fixtures';
18+
import { attachFrame } from './utils';
1819

1920
it('should work', async ({browser, server}) => {
2021
{

test/browsercontext-viewport.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { it, expect, verifyViewport } from './playwright.fixtures';
17+
import { it, expect } from './playwright.fixtures';
18+
import { verifyViewport } from './utils';
1819

1920
it('should get the proper default viewport size', async ({page, server}) => {
2021
await verifyViewport(page, 1280, 720);

test/channels.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@
1616
*/
1717

1818
import domain from 'domain';
19-
import { it, expect, options, playwrightFixtures } from './playwright.fixtures';
19+
import { options, fixtures as baseFixtures } from './playwright.fixtures';
2020
import type { ChromiumBrowser } from '..';
2121

22-
playwrightFixtures.defineWorkerFixture('domain', async ({ }, test) => {
22+
type DomainFixtures = {
23+
domain: any;
24+
};
25+
26+
const fixtures = baseFixtures.declareWorkerFixtures<DomainFixtures>();
27+
fixtures.defineWorkerFixture('domain', async ({ }, test) => {
2328
const local = domain.create();
2429
local.run(() => { });
2530
let err;
@@ -29,6 +34,8 @@ playwrightFixtures.defineWorkerFixture('domain', async ({ }, test) => {
2934
throw err;
3035
});
3136

37+
const { it, expect } = fixtures;
38+
3239
it('should work', async ({browser}) => {
3340
expect(!!browser['_connection']).toBeTruthy();
3441
});

test/chromium/oopif.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { options, playwrightFixtures } from '../playwright.fixtures';
17+
import { options, fixtures as playwrightFixtures } from '../playwright.fixtures';
1818
const { it, expect, describe, overrideWorkerFixture } = playwrightFixtures;
1919

2020
overrideWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test) => {

test/chromium/tracing.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { options, playwrightFixtures } from '../playwright.fixtures';
17+
import { options, fixtures as playwrightFixtures } from '../playwright.fixtures';
1818
import fs from 'fs';
1919
import path from 'path';
2020
import type { ChromiumBrowser } from '../..';
@@ -25,7 +25,6 @@ type TestState = {
2525
const fixtures = playwrightFixtures.declareTestFixtures<TestState>();
2626
const { it, expect, describe, defineTestFixture } = fixtures;
2727

28-
2928
defineTestFixture('outputTraceFile', async ({testOutputDir}, test) => {
3029
await test(path.join(testOutputDir, `trace.json`));
3130
});

test/click.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { it, expect, options, attachFrame } from './playwright.fixtures';
18+
import { it, expect, options } from './playwright.fixtures';
19+
import { attachFrame } from './utils';
1920

2021
async function giveItAChanceToClick(page) {
2122
for (let i = 0; i < 5; i++)

0 commit comments

Comments
 (0)