chore: remove main index.js from playwright-core (#2178)
This commit is contained in:
parent
d487a315b9
commit
c5b0baacd1
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"browsers": [
|
|
||||||
{
|
|
||||||
"name": "chromium",
|
|
||||||
"revision": "764964"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "firefox",
|
|
||||||
"revision": "1093"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "webkit",
|
|
||||||
"revision": "1224"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -15,5 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { Playwright } = require('./lib/server/playwright');
|
const { Playwright } = require('./lib/server/playwright');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = new Playwright(__dirname, require('./browsers.json')['browsers']);
|
const playwrightRoot = path.join(__dirname, 'packages', 'playwright');
|
||||||
|
module.exports = new Playwright(playwrightRoot, require(path.join(playwrightRoot, 'browsers.json'))['browsers']);
|
||||||
|
|
@ -64,9 +64,10 @@ async function downloadAllBrowsersAndGenerateProtocolTypes() {
|
||||||
const { installBrowsersWithProgressBar } = require('./lib/install/installer');
|
const { installBrowsersWithProgressBar } = require('./lib/install/installer');
|
||||||
const protocolGenerator = require('./utils/protocol-types-generator');
|
const protocolGenerator = require('./utils/protocol-types-generator');
|
||||||
const browserPaths = require('./lib/install/browserPaths');
|
const browserPaths = require('./lib/install/browserPaths');
|
||||||
const browsersPath = browserPaths.browsersPath(__dirname);
|
const playwrightRoot = path.join(__dirname, 'packages', 'playwright');
|
||||||
const browsers = require('./browsers.json')['browsers'];
|
const browsersPath = browserPaths.browsersPath(playwrightRoot);
|
||||||
await installBrowsersWithProgressBar(__dirname);
|
const browsers = require(path.join(playwrightRoot, 'browsers.json'))['browsers'];
|
||||||
|
await installBrowsersWithProgressBar(playwrightRoot);
|
||||||
for (const browser of browsers) {
|
for (const browser of browsers) {
|
||||||
const browserPath = browserPaths.browserDirectory(browsersPath, browser);
|
const browserPath = browserPaths.browserDirectory(browsersPath, browser);
|
||||||
await protocolGenerator.generateProtocol(browser.name, browserPaths.executablePath(browserPath, browser)).catch(console.warn);
|
await protocolGenerator.generateProtocol(browser.name, browserPaths.executablePath(browserPath, browser)).catch(console.warn);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.15.0"
|
"node": ">=10.15.0"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
|
"ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
|
||||||
"ftest": "cross-env BROWSER=firefox node --unhandled-rejections=strict test/test.js",
|
"ftest": "cross-env BROWSER=firefox node --unhandled-rejections=strict test/test.js",
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ async function testSignal(state, action, exitOnClose) {
|
||||||
handleSIGHUP: true,
|
handleSIGHUP: true,
|
||||||
executablePath: state.browserType.executablePath(),
|
executablePath: state.browserType.executablePath(),
|
||||||
});
|
});
|
||||||
const res = spawn('node', [path.join(__dirname, 'fixtures', 'closeme.js'), state.playwrightPath, state.browserType.name(), JSON.stringify(options), exitOnClose ? 'true' : '']);
|
const res = spawn('node', [path.join(__dirname, 'fixtures', 'closeme.js'), path.join(state.playwrightPath, 'index-for-dev'), state.browserType.name(), JSON.stringify(options), exitOnClose ? 'true' : '']);
|
||||||
let wsEndPointCallback;
|
let wsEndPointCallback;
|
||||||
const wsEndPointPromise = new Promise(x => wsEndPointCallback = x);
|
const wsEndPointPromise = new Promise(x => wsEndPointCallback = x);
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
|
||||||
4
test/fixtures/closeme.js
vendored
4
test/fixtures/closeme.js
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
(async() => {
|
(async() => {
|
||||||
const [, , playwrightRoot, browserType, options, exitOnClose] = process.argv;
|
const [, , playwrightIndex, browserType, options, exitOnClose] = process.argv;
|
||||||
const browserServer = await require(playwrightRoot)[browserType].launchServer(JSON.parse(options));
|
const browserServer = await require(playwrightIndex)[browserType].launchServer(JSON.parse(options));
|
||||||
browserServer.on('close', (exitCode, signal) => {
|
browserServer.on('close', (exitCode, signal) => {
|
||||||
console.log(`browserClose:${exitCode}:${signal}:browserClose`);
|
console.log(`browserClose:${exitCode}:${signal}:browserClose`);
|
||||||
if (exitOnClose)
|
if (exitOnClose)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const TestRunner = require('../utils/testrunner/');
|
const TestRunner = require('../utils/testrunner/');
|
||||||
const {Environment} = require('../utils/testrunner/Test');
|
const {Environment} = require('../utils/testrunner/Test');
|
||||||
|
|
||||||
|
|
@ -72,7 +73,7 @@ function collect(browserNames) {
|
||||||
|
|
||||||
// TODO: this should be a preinstalled playwright by default.
|
// TODO: this should be a preinstalled playwright by default.
|
||||||
const playwrightPath = config.playwrightPath;
|
const playwrightPath = config.playwrightPath;
|
||||||
const playwright = require(playwrightPath);
|
const playwright = require(path.join(playwrightPath, 'index-for-dev'));
|
||||||
const { setUnderTest } = require(require('path').join(playwrightPath, 'lib/helper.js'));
|
const { setUnderTest } = require(require('path').join(playwrightPath, 'lib/helper.js'));
|
||||||
setUnderTest();
|
setUnderTest();
|
||||||
|
|
||||||
|
|
|
||||||
14
test/types.d.ts
vendored
14
test/types.d.ts
vendored
|
|
@ -48,8 +48,8 @@ interface TestSetup<STATE> {
|
||||||
MAC: boolean;
|
MAC: boolean;
|
||||||
LINUX: boolean;
|
LINUX: boolean;
|
||||||
WIN: boolean;
|
WIN: boolean;
|
||||||
playwright: typeof import('../index');
|
playwright: typeof import('../index-for-dev');
|
||||||
browserType: import('../index').BrowserType<import('../index').Browser>;
|
browserType: import('../index-for-dev').BrowserType<import('../index-for-dev').Browser>;
|
||||||
selectors: import('../src/selectors').Selectors;
|
selectors: import('../src/selectors').Selectors;
|
||||||
expect<T>(value: T): Expect<T>;
|
expect<T>(value: T): Expect<T>;
|
||||||
defaultBrowserOptions: import('../src/server/browserType').LaunchOptions;
|
defaultBrowserOptions: import('../src/server/browserType').LaunchOptions;
|
||||||
|
|
@ -65,16 +65,16 @@ type TestState = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type BrowserState = TestState & {
|
type BrowserState = TestState & {
|
||||||
browser: import('../index').Browser;
|
browser: import('../index-for-dev').Browser;
|
||||||
browserServer: import('../index').BrowserServer;
|
browserServer: import('../index-for-dev').BrowserServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PageState = BrowserState & {
|
type PageState = BrowserState & {
|
||||||
context: import('../index').BrowserContext;
|
context: import('../index-for-dev').BrowserContext;
|
||||||
page: import('../index').Page;
|
page: import('../index-for-dev').Page;
|
||||||
};
|
};
|
||||||
type ChromiumPageState = PageState & {
|
type ChromiumPageState = PageState & {
|
||||||
browser: import('../index').ChromiumBrowser;
|
browser: import('../index-for-dev').ChromiumBrowser;
|
||||||
};
|
};
|
||||||
type TestSuite = (setup: TestSetup<TestState>) => void;
|
type TestSuite = (setup: TestSetup<TestState>) => void;
|
||||||
type BrowserTestSuite = (setup: TestSetup<BrowserState>) => void;
|
type BrowserTestSuite = (setup: TestSetup<BrowserState>) => void;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const playwright = require('../../../..');
|
const playwright = require('../../../../index-for-dev');
|
||||||
const checkPublicAPI = require('..');
|
const checkPublicAPI = require('..');
|
||||||
const Source = require('../../Source');
|
const Source = require('../../Source');
|
||||||
const mdBuilder = require('../MDBuilder');
|
const mdBuilder = require('../MDBuilder');
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const playwright = require('../../index.js');
|
const playwright = require('../../index-for-dev');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Source = require('./Source');
|
const Source = require('./Source');
|
||||||
const Message = require('./Message');
|
const Message = require('./Message');
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
//@ts-check
|
//@ts-check
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Source = require('../doclint/Source');
|
const Source = require('../doclint/Source');
|
||||||
const {chromium} = require('../../index');
|
const {chromium} = require('../../index-for-dev');
|
||||||
const Documentation = require('../doclint/check_public_api/Documentation');
|
const Documentation = require('../doclint/check_public_api/Documentation');
|
||||||
const PROJECT_DIR = path.join(__dirname, '..', '..');
|
const PROJECT_DIR = path.join(__dirname, '..', '..');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from '../../../index';
|
import * as playwright from '../../../index';
|
||||||
|
|
||||||
type AssertType<T, S> = S extends T ? AssertNotAny<S> : false;
|
type AssertType<T, S> = S extends T ? AssertNotAny<S> : false;
|
||||||
type AssertNotAny<S> = {notRealProperty: number} extends S ? false : true;
|
type AssertNotAny<S> = {notRealProperty: number} extends S ? false : true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ async function generateProtocol(name, executablePath) {
|
||||||
|
|
||||||
async function generateChromiumProtocol(executablePath) {
|
async function generateChromiumProtocol(executablePath) {
|
||||||
const outputPath = path.join(__dirname, '..', '..', 'src', 'chromium', 'protocol.ts');
|
const outputPath = path.join(__dirname, '..', '..', 'src', 'chromium', 'protocol.ts');
|
||||||
const playwright = await require('../../index').chromium;
|
const playwright = await require('../../index-for-dev').chromium;
|
||||||
const defaultArgs = playwright._defaultArgs.bind(playwright);
|
const defaultArgs = playwright._defaultArgs.bind(playwright);
|
||||||
playwright._defaultArgs = (...args) => {
|
playwright._defaultArgs = (...args) => {
|
||||||
const result = defaultArgs(...args);
|
const result = defaultArgs(...args);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue