chore: split playwright.fixtures into files (4) (#3985)
This commit is contained in:
parent
cef27d620b
commit
0ee9050f1b
30
package-lock.json
generated
30
package-lock.json
generated
|
|
@ -2029,6 +2029,16 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"bindings": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"file-uri-to-path": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"bluebird": {
|
"bluebird": {
|
||||||
"version": "3.7.2",
|
"version": "3.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||||
|
|
@ -3718,6 +3728,13 @@
|
||||||
"flat-cache": "^2.0.1"
|
"flat-cache": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"file-uri-to-path": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"fill-range": {
|
"fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||||
|
|
@ -5371,6 +5388,13 @@
|
||||||
"readable-stream": "^2.0.5"
|
"readable-stream": "^2.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nan": {
|
||||||
|
"version": "2.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||||
|
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"nanomatch": {
|
"nanomatch": {
|
||||||
"version": "1.2.13",
|
"version": "1.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
||||||
|
|
@ -7785,7 +7809,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
||||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"nan": "^2.12.1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"glob-parent": {
|
"glob-parent": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page, isFirefox, isChromium }) => {
|
it('should work', async ({ page, isFirefox, isChromium }) => {
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should await navigation when clicking anchor', async ({page, server}) => {
|
it('should await navigation when clicking anchor', async ({page, server}) => {
|
||||||
const messages = [];
|
const messages = [];
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it } from './playwright.fixtures';
|
import { it } from './fixtures';
|
||||||
|
|
||||||
it('clicking on links which do not commit navigation', async ({page, server, httpsServer}) => {
|
it('clicking on links which do not commit navigation', async ({page, server, httpsServer}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should create new page', async function({browser}) {
|
it('should create new page', async function({browser}) {
|
||||||
const page1 = await browser.newPage();
|
const page1 = await browser.newPage();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({context, page, server}) => {
|
it('should work', async ({context, page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { verifyViewport } from './utils';
|
import { verifyViewport } from './utils';
|
||||||
|
|
||||||
it('should create new context', async function({browser}) {
|
it('should create new context', async function({browser}) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should clear cookies', async ({context, page, server}) => {
|
it('should clear cookies', async ({context, page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should return no cookies in pristine browser context', async ({context, page, server}) => {
|
it('should return no cookies in pristine browser context', async ({context, page, server}) => {
|
||||||
expect(await context.cookies()).toEqual([]);
|
expect(await context.cookies()).toEqual([]);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should fail without credentials', (test, parameters) => {
|
it('should fail without credentials', (test, parameters) => {
|
||||||
test.fail(options.CHROMIUM(parameters) && !options.HEADLESS);
|
test.fail(options.CHROMIUM(parameters) && !options.HEADLESS);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should bypass CSP meta tag', async ({browser, server}) => {
|
it('should bypass CSP meta tag', async ({browser, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
describe('device', (suite, parameters) => {
|
describe('device', (suite, parameters) => {
|
||||||
suite.skip(options.FIREFOX(parameters));
|
suite.skip(options.FIREFOX(parameters));
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('expose binding should work', async ({browser}) => {
|
it('expose binding should work', async ({browser}) => {
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should affect accept-language header', async ({browser, server}) => {
|
it('should affect accept-language header', async ({browser, server}) => {
|
||||||
const context = await browser.newContext({ locale: 'fr-CH' });
|
const context = await browser.newContext({ locale: 'fr-CH' });
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should have url', async ({browser, server}) => {
|
it('should have url', async ({browser, server}) => {
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should intercept', async ({browser, server}) => {
|
it('should intercept', async ({browser, server}) => {
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ browser }) => {
|
it('should work', async ({ browser }) => {
|
||||||
const func = () => new Date(1479579154987).toString();
|
const func = () => new Date(1479579154987).toString();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should work', async ({browser, server}) => {
|
it('should work', async ({browser, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
describe('mobile viewport', (suite, parameters) => {
|
describe('mobile viewport', (suite, parameters) => {
|
||||||
suite.skip(options.FIREFOX(parameters));
|
suite.skip(options.FIREFOX(parameters));
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { verifyViewport } from './utils';
|
import { verifyViewport } from './utils';
|
||||||
|
|
||||||
it('should get the proper default viewport size', async ({page, server}) => {
|
it('should get the proper default viewport size', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('browserType.executablePath should work', test => {
|
it('browserType.executablePath should work', test => {
|
||||||
test.skip(Boolean(process.env.CRPATH || process.env.FFPATH || process.env.WKPATH));
|
test.skip(Boolean(process.env.CRPATH || process.env.FFPATH || process.env.WKPATH));
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options } from './playwright.fixtures';
|
import { options } from './fixtures';
|
||||||
import { serverFixtures } from './remoteServer.fixture';
|
import { serverFixtures } from './remoteServer.fixture';
|
||||||
const { it, expect, describe } = serverFixtures;
|
const { it, expect, describe } = serverFixtures;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
describe('lauch server', suite => {
|
describe('lauch server', suite => {
|
||||||
suite.skip(options.WIRE);
|
suite.skip(options.WIRE);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should reject all promises when browser is closed', async ({browserType, defaultBrowserOptions}) => {
|
it('should reject all promises when browser is closed', async ({browserType, defaultBrowserOptions}) => {
|
||||||
const browser = await browserType.launch(defaultBrowserOptions);
|
const browser = await browserType.launch(defaultBrowserOptions);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('Web Assembly should work', (test, parameters) => {
|
it('Web Assembly should work', (test, parameters) => {
|
||||||
test.fail(options.WEBKIT(parameters) && options.WIN(parameters));
|
test.fail(options.WEBKIT(parameters) && options.WIN(parameters));
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import domain from 'domain';
|
import domain from 'domain';
|
||||||
import { options, fixtures as baseFixtures } from './playwright.fixtures';
|
import { options, fixtures as baseFixtures } from './fixtures';
|
||||||
import type { ChromiumBrowser } from '..';
|
import type { ChromiumBrowser } from '..';
|
||||||
|
|
||||||
type DomainFixtures = {
|
type DomainFixtures = {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should check the box', async ({page}) => {
|
it('should check the box', async ({page}) => {
|
||||||
await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
describe('oopif', (suite, parameters) => {
|
describe('oopif', (suite, parameters) => {
|
||||||
suite.skip(!options.CHROMIUM(parameters));
|
suite.skip(!options.CHROMIUM(parameters));
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
it('should be missing', (test, parameters) => {
|
it('should be missing', (test, parameters) => {
|
||||||
test.skip(options.CHROMIUM(parameters));
|
test.skip(options.CHROMIUM(parameters));
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect, describe, options } from '../playwright.fixtures';
|
import { it, expect, describe, options } from '../fixtures';
|
||||||
import type { ChromiumBrowserContext } from '../..';
|
import type { ChromiumBrowserContext } from '../..';
|
||||||
|
|
||||||
describe('chromium', (suite, parameters) => {
|
describe('chromium', (suite, parameters) => {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect, options } from '../playwright.fixtures';
|
import { it, expect, options } from '../fixtures';
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import type { ChromiumBrowser, ChromiumBrowserContext } from '../..';
|
import type { ChromiumBrowser, ChromiumBrowserContext } from '../..';
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options, fixtures as playwrightFixtures } from '../playwright.fixtures';
|
import { options, fixtures as playwrightFixtures } from '../fixtures';
|
||||||
const { it, expect, describe, overrideWorkerFixture } = playwrightFixtures;
|
const { it, expect, describe, overrideWorkerFixture } = playwrightFixtures;
|
||||||
|
|
||||||
overrideWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test) => {
|
overrideWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test) => {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect, describe, options } from '../playwright.fixtures';
|
import { it, expect, describe, options } from '../fixtures';
|
||||||
import type { ChromiumBrowserContext, ChromiumBrowser } from '../../types/types';
|
import type { ChromiumBrowserContext, ChromiumBrowser } from '../../types/types';
|
||||||
|
|
||||||
describe('session', (suite, parameters) => {
|
describe('session', (suite, parameters) => {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options, fixtures as playwrightFixtures } from '../playwright.fixtures';
|
import { options, fixtures as playwrightFixtures } from '../fixtures';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import type { ChromiumBrowser } from '../..';
|
import type { ChromiumBrowser } from '../..';
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
declare const renderComponent;
|
declare const renderComponent;
|
||||||
declare const e;
|
declare const e;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should avoid side effects after timeout', (test, parameters) => {
|
it('should avoid side effects after timeout', (test, parameters) => {
|
||||||
test.skip(options.WIRE);
|
test.skip(options.WIRE);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should timeout waiting for display:none to be gone', async ({page, server}) => {
|
it('should timeout waiting for display:none to be gone', async ({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should fail when element jumps during hit testing', (test, parameters) => {
|
it('should fail when element jumps during hit testing', (test, parameters) => {
|
||||||
test.skip(options.WIRE);
|
test.skip(options.WIRE);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should timeout waiting for stable position', async ({page, server}) => {
|
it('should timeout waiting for stable position', async ({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
async function giveItAChanceToClick(page) {
|
async function giveItAChanceToClick(page) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { verifyViewport } from './utils';
|
import { verifyViewport } from './utils';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
it('should support hasTouch option', async ({server, launchPersistent}) => {
|
it('should support hasTouch option', async ({server, launchPersistent}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should fire', async ({page, server}) => {
|
it('should fire', async ({page, server}) => {
|
||||||
page.on('dialog', dialog => {
|
page.on('dialog', dialog => {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should dispatch click event', async ({page, server}) => {
|
it('should dispatch click event', async ({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options } from './playwright.fixtures';
|
import { options } from './fixtures';
|
||||||
import { serverFixtures } from './remoteServer.fixture';
|
import { serverFixtures } from './remoteServer.fixture';
|
||||||
const { it, expect, beforeEach } = serverFixtures;
|
const { it, expect, beforeEach } = serverFixtures;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { fixtures as baseFixtures } from './playwright.fixtures';
|
import { fixtures as baseFixtures } from './fixtures';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import type { Browser, BrowserContext } from '..';
|
import type { Browser, BrowserContext } from '..';
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options } from '../playwright.fixtures';
|
import { options } from '../fixtures';
|
||||||
import { electronFixtures } from './electron.fixture';
|
import { electronFixtures } from './electron.fixture';
|
||||||
const { it, expect, describe } = electronFixtures;
|
const { it, expect, describe } = electronFixtures;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options } from '../playwright.fixtures';
|
import { options } from '../fixtures';
|
||||||
import { electronFixtures } from './electron.fixture';
|
import { electronFixtures } from './electron.fixture';
|
||||||
const { it, expect, describe } = electronFixtures;
|
const { it, expect, describe } = electronFixtures;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { fixtures as baseFixtures } from '../playwright.fixtures';
|
import { fixtures as baseFixtures } from '../fixtures';
|
||||||
import type {ElectronApplication, ElectronLauncher, ElectronPage} from '../../electron-types';
|
import type {ElectronApplication, ElectronLauncher, ElectronPage} from '../../electron-types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
|
|
||||||
it('should work', (test, parameters) => {
|
it('should work', (test, parameters) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should have a nice preview', async ({ page, server }) => {
|
it('should have a nice preview', async ({ page, server }) => {
|
||||||
await page.goto(`${server.PREFIX}/dom.html`);
|
await page.goto(`${server.PREFIX}/dom.html`);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page, server}) => {
|
it('should work', async ({page, server}) => {
|
||||||
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
|
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should hover', async ({ page, server }) => {
|
it('should hover', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page }) => {
|
it('should work', async ({ page }) => {
|
||||||
await page.setContent(`<input type='text' />`);
|
await page.setContent(`<input type='text' />`);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should query existing element', async ({page, server}) => {
|
it('should query existing element', async ({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/playground.html');
|
await page.goto(server.PREFIX + '/playground.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
import { verifyViewport } from './utils';
|
import { verifyViewport } from './utils';
|
||||||
|
|
||||||
import {PNG} from 'pngjs';
|
import {PNG} from 'pngjs';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should select textarea', async ({ page, server, isFirefox }) => {
|
it('should select textarea', async ({ page, server, isFirefox }) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page }) => {
|
it('should work', async ({ page }) => {
|
||||||
await page.setContent(`<input type='text' />`);
|
await page.setContent(`<input type='text' />`);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
async function giveItAChanceToResolve(page) {
|
async function giveItAChanceToResolve(page) {
|
||||||
for (let i = 0; i < 5; i++)
|
for (let i = 0; i < 5; i++)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should think that it is focused by default', async ({page}) => {
|
it('should think that it is focused by default', async ({page}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work with css selector', async ({page, server}) => {
|
it('should work with css selector', async ({page, server}) => {
|
||||||
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work with css selector', async ({page, server}) => {
|
it('should work with css selector', async ({page, server}) => {
|
||||||
await page.setContent('<section id="testAttribute">43543</section>');
|
await page.setContent('<section id="testAttribute">43543</section>');
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { it, expect, options } from '../playwright.fixtures';
|
import { it, expect, options } from '../fixtures';
|
||||||
|
|
||||||
it('should pass firefox user preferences', (test, parameters) => {
|
it('should pass firefox user preferences', (test, parameters) => {
|
||||||
test.skip(!options.FIREFOX(parameters));
|
test.skip(!options.FIREFOX(parameters));
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { options } from './playwright.fixtures';
|
import { options } from './fixtures';
|
||||||
import { serverFixtures } from './remoteServer.fixture';
|
import { serverFixtures } from './remoteServer.fixture';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
|
||||||
170
test/fixtures.ts
Normal file
170
test/fixtures.ts
Normal file
|
|
@ -0,0 +1,170 @@
|
||||||
|
/**
|
||||||
|
* Copyright Microsoft Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { config } from '@playwright/test-runner';
|
||||||
|
import assert from 'assert';
|
||||||
|
import childProcess from 'child_process';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import util from 'util';
|
||||||
|
import type { Browser, BrowserContext, BrowserType, Page } from '../index';
|
||||||
|
import { Connection } from '../lib/client/connection';
|
||||||
|
import { Transport } from '../lib/protocol/transport';
|
||||||
|
import { installCoverageHooks } from './coverage';
|
||||||
|
import { fixtures as httpFixtures } from './http.fixtures';
|
||||||
|
import { fixtures as implFixtures } from './impl.fixtures';
|
||||||
|
import { fixtures as platformFixtures, options as platformOptions } from './platform.fixtures';
|
||||||
|
import { fixtures as playwrightFixtures, options as playwrightOptions } from './playwright.fixtures';
|
||||||
|
export { expect } from '@playwright/test/out/matcher.fixtures';
|
||||||
|
export { config } from '@playwright/test-runner';
|
||||||
|
|
||||||
|
const removeFolderAsync = util.promisify(require('rimraf'));
|
||||||
|
|
||||||
|
type AllParameters = {
|
||||||
|
browserName: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type AllWorkerFixtures = {
|
||||||
|
golden: (path: string) => string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type AllTestFixtures = {
|
||||||
|
createUserDataDir: () => Promise<string>;
|
||||||
|
launchPersistent: (options?: Parameters<BrowserType<Browser>['launchPersistentContext']>[1]) => Promise<{context: BrowserContext, page: Page}>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fixtures = playwrightFixtures
|
||||||
|
.union(httpFixtures)
|
||||||
|
.union(platformFixtures)
|
||||||
|
.union(implFixtures)
|
||||||
|
.declareParameters<AllParameters>()
|
||||||
|
.declareWorkerFixtures<AllWorkerFixtures>()
|
||||||
|
.declareTestFixtures<AllTestFixtures>();
|
||||||
|
const { defineTestFixture, defineWorkerFixture, overrideWorkerFixture } = fixtures;
|
||||||
|
|
||||||
|
export const it = fixtures.it;
|
||||||
|
export const fit = fixtures.fit;
|
||||||
|
export const xit = fixtures.xit;
|
||||||
|
export const describe = fixtures.describe;
|
||||||
|
export const fdescribe = fixtures.fdescribe;
|
||||||
|
export const xdescribe = fixtures.xdescribe;
|
||||||
|
export const beforeEach = fixtures.beforeEach;
|
||||||
|
export const afterEach = fixtures.afterEach;
|
||||||
|
export const beforeAll = fixtures.beforeAll;
|
||||||
|
export const afterAll = fixtures.afterAll;
|
||||||
|
|
||||||
|
export const options = {
|
||||||
|
...platformOptions,
|
||||||
|
...playwrightOptions,
|
||||||
|
WIRE: !!process.env.PWWIRE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const getExecutablePath = browserName => {
|
||||||
|
if (browserName === 'chromium' && process.env.CRPATH)
|
||||||
|
return process.env.CRPATH;
|
||||||
|
if (browserName === 'firefox' && process.env.FFPATH)
|
||||||
|
return process.env.FFPATH;
|
||||||
|
if (browserName === 'webkit' && process.env.WKPATH)
|
||||||
|
return process.env.WKPATH;
|
||||||
|
};
|
||||||
|
|
||||||
|
overrideWorkerFixture('defaultBrowserOptions', async ({browserName}, runTest) => {
|
||||||
|
const executablePath = getExecutablePath(browserName);
|
||||||
|
if (executablePath)
|
||||||
|
console.error(`Using executable at ${executablePath}`);
|
||||||
|
await runTest({
|
||||||
|
handleSIGINT: false,
|
||||||
|
slowMo: options.SLOW_MO,
|
||||||
|
headless: options.HEADLESS,
|
||||||
|
executablePath,
|
||||||
|
artifactsPath: config.outputDir,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
overrideWorkerFixture('playwright', async ({browserName, testWorkerIndex, platform}, test) => {
|
||||||
|
assert(platform); // Depend on platform to generate all tests.
|
||||||
|
const {coverage, uninstall} = installCoverageHooks(browserName);
|
||||||
|
if (options.WIRE) {
|
||||||
|
require('../lib/utils/utils').setUnderTest();
|
||||||
|
const connection = new Connection();
|
||||||
|
const spawnedProcess = childProcess.fork(path.join(__dirname, '..', 'lib', 'server.js'), [], {
|
||||||
|
stdio: 'pipe',
|
||||||
|
detached: true,
|
||||||
|
});
|
||||||
|
spawnedProcess.unref();
|
||||||
|
const onExit = (exitCode, signal) => {
|
||||||
|
throw new Error(`Server closed with exitCode=${exitCode} signal=${signal}`);
|
||||||
|
};
|
||||||
|
spawnedProcess.on('exit', onExit);
|
||||||
|
const transport = new Transport(spawnedProcess.stdin, spawnedProcess.stdout);
|
||||||
|
connection.onmessage = message => transport.send(JSON.stringify(message));
|
||||||
|
transport.onmessage = message => connection.dispatch(JSON.parse(message));
|
||||||
|
const playwrightObject = await connection.waitForObjectWithKnownName('Playwright');
|
||||||
|
await test(playwrightObject);
|
||||||
|
spawnedProcess.removeListener('exit', onExit);
|
||||||
|
spawnedProcess.stdin.destroy();
|
||||||
|
spawnedProcess.stdout.destroy();
|
||||||
|
spawnedProcess.stderr.destroy();
|
||||||
|
await teardownCoverage();
|
||||||
|
} else {
|
||||||
|
const playwright = require('../index');
|
||||||
|
await test(playwright);
|
||||||
|
await teardownCoverage();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function teardownCoverage() {
|
||||||
|
uninstall();
|
||||||
|
const coveragePath = path.join(__dirname, 'coverage-report', testWorkerIndex + '.json');
|
||||||
|
const coverageJSON = [...coverage.keys()].filter(key => coverage.get(key));
|
||||||
|
await fs.promises.mkdir(path.dirname(coveragePath), { recursive: true });
|
||||||
|
await fs.promises.writeFile(coveragePath, JSON.stringify(coverageJSON, undefined, 2), 'utf8');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
defineWorkerFixture('golden', async ({browserName}, test) => {
|
||||||
|
await test(p => path.join(browserName, p));
|
||||||
|
});
|
||||||
|
|
||||||
|
defineTestFixture('createUserDataDir', async ({testOutputDir}, runTest) => {
|
||||||
|
let counter = 0;
|
||||||
|
const dirs: string[] = [];
|
||||||
|
async function createUserDataDir() {
|
||||||
|
const dir = path.join(testOutputDir, `user-data-dir-${counter++}`);
|
||||||
|
dirs.push(dir);
|
||||||
|
await fs.promises.mkdir(dir, { recursive: true });
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
await runTest(createUserDataDir);
|
||||||
|
// Remove user data dirs, because we cannot upload them as test result artifacts.
|
||||||
|
// - Firefox removes lock file later, repsumably from another watchdog process?
|
||||||
|
// - WebKit has circular symlinks that makes CI go crazy.
|
||||||
|
await Promise.all(dirs.map(dir => removeFolderAsync(dir).catch(e => {})));
|
||||||
|
});
|
||||||
|
|
||||||
|
defineTestFixture('launchPersistent', async ({createUserDataDir, defaultBrowserOptions, browserType}, test) => {
|
||||||
|
let context;
|
||||||
|
async function launchPersistent(options) {
|
||||||
|
if (context)
|
||||||
|
throw new Error('can only launch one persitent context');
|
||||||
|
const userDataDir = await createUserDataDir();
|
||||||
|
context = await browserType.launchPersistentContext(userDataDir, {...defaultBrowserOptions, ...options});
|
||||||
|
const page = context.pages()[0];
|
||||||
|
return {context, page};
|
||||||
|
}
|
||||||
|
await test(launchPersistent);
|
||||||
|
if (context)
|
||||||
|
await context.close();
|
||||||
|
});
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should work', (test, parameters) => {
|
it('should work', (test, parameters) => {
|
||||||
test.skip(options.FIREFOX(parameters));
|
test.skip(options.FIREFOX(parameters));
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame, detachFrame } from './utils';
|
import { attachFrame, detachFrame } from './utils';
|
||||||
|
|
||||||
import type { Frame } from '../src/client/frame';
|
import type { Frame } from '../src/client/frame';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should work', async ({page, server}) => {
|
it('should work', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should navigate subframes', async ({page, server}) => {
|
it('should navigate subframes', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame, detachFrame } from './utils';
|
import { attachFrame, detachFrame } from './utils';
|
||||||
import type { Frame } from '../index';
|
import type { Frame } from '../index';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page, server, context}) => {
|
it('should work', async ({page, server, context}) => {
|
||||||
await context.grantPermissions(['geolocation']);
|
await context.grantPermissions(['geolocation']);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should have default url when launching browser', async ({browserType, defaultBrowserOptions, createUserDataDir}) => {
|
it('should have default url when launching browser', async ({browserType, defaultBrowserOptions, createUserDataDir}) => {
|
||||||
const browserContext = await browserType.launchPersistentContext(await createUserDataDir(), {...defaultBrowserOptions, headless: false });
|
const browserContext = await browserType.launchPersistentContext(await createUserDataDir(), {...defaultBrowserOptions, headless: false });
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({browser, httpsServer}) => {
|
it('should work', async ({browser, httpsServer}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { fixtures as playwrightFixtures } from './upstream.fixtures';
|
import { fixtures as playwrightFixtures } from './playwright.fixtures';
|
||||||
|
|
||||||
type ImplWorkerFixtures = {
|
type ImplWorkerFixtures = {
|
||||||
toImpl: (rpcObject: any) => any;
|
toImpl: (rpcObject: any) => any;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
import { globToRegex } from '../lib/client/clientHelper';
|
import { globToRegex } from '../lib/client/clientHelper';
|
||||||
import vm from 'vm';
|
import vm from 'vm';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => document.body);
|
const aHandle = await page.evaluateHandle(() => document.body);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work with function', async ({page}) => {
|
it('should work with function', async ({page}) => {
|
||||||
const windowHandle = await page.evaluateHandle(() => {
|
const windowHandle = await page.evaluateHandle(() => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));
|
const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => ({
|
const aHandle = await page.evaluateHandle(() => ({
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work for primitives', async ({page}) => {
|
it('should work for primitives', async ({page}) => {
|
||||||
const numberHandle = await page.evaluateHandle(() => 2);
|
const numberHandle = await page.evaluateHandle(() => 2);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should type into a textarea', async ({page}) => {
|
it('should type into a textarea', async ({page}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should require top-level Errors', async ({}) => {
|
it('should require top-level Errors', async ({}) => {
|
||||||
const Errors = require('../lib/utils/errors.js');
|
const Errors = require('../lib/utils/errors.js');
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should log', async ({browserType, defaultBrowserOptions}) => {
|
it('should log', async ({browserType, defaultBrowserOptions}) => {
|
||||||
const log = [];
|
const log = [];
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, xdescribe, options } from './playwright.fixtures';
|
import { it, expect, xdescribe, options } from './fixtures';
|
||||||
|
|
||||||
function dimensions() {
|
function dimensions() {
|
||||||
const rect = document.querySelector('textarea').getBoundingClientRect();
|
const rect = document.querySelector('textarea').getBoundingClientRect();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it } from './playwright.fixtures';
|
import { it } from './fixtures';
|
||||||
|
|
||||||
it('should work with _blank target', async ({page, server}) => {
|
it('should work with _blank target', async ({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should work for main frame navigation request', async ({page, server}) => {
|
it('should work for main frame navigation request', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
it('should evaluate before anything else on the page', async ({ page, server }) => {
|
it('should evaluate before anything else on the page', async ({ page, server }) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
it('should throw an error if no options are provided', async ({page, server}) => {
|
it('should throw an error if no options are provided', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
it('should throw an error if no options are provided', async ({page, server}) => {
|
it('should throw an error if no options are provided', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should reject all promises when page is closed', async ({context}) => {
|
it('should reject all promises when page is closed', async ({context}) => {
|
||||||
const newPage = await context.newPage();
|
const newPage = await context.newPage();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from './utils';
|
||||||
|
|
||||||
it('should emulate type', async ({page, server}) => {
|
it('should emulate type', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({page, server}) => {
|
it('should work', async ({page, server}) => {
|
||||||
const windowHandle = await page.evaluateHandle(() => window);
|
const windowHandle = await page.evaluateHandle(() => window);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, options } from './playwright.fixtures';
|
import { it, expect, options } from './fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
const result = await page.evaluate(() => 7 * 3);
|
const result = await page.evaluate(() => 7 * 3);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './playwright.fixtures';
|
import { it, expect } from './fixtures';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
|
|
||||||
it('should work', async ({page, server}) => {
|
it('should work', async ({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe, options } from './playwright.fixtures';
|
import { it, expect, describe, options } from './fixtures';
|
||||||
|
|
||||||
function crash(page, toImpl, browserName) {
|
function crash(page, toImpl, browserName) {
|
||||||
if (browserName === 'chromium')
|
if (browserName === 'chromium')
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue