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