chore: remove experimental types (#14560)
This commit is contained in:
parent
9ea89d585c
commit
dbcf039717
|
|
@ -29,7 +29,7 @@ import { ProgressController } from './progress';
|
|||
import type { SelectorInfo } from './selectors';
|
||||
import type * as types from './types';
|
||||
import type { TimeoutOptions } from '../common/types';
|
||||
import { experimentalFeaturesEnabled, isUnderTest } from '../utils';
|
||||
import { isUnderTest } from '../utils';
|
||||
|
||||
type SetInputFilesFiles = channels.ElementHandleSetInputFilesParams['files'];
|
||||
export type InputFilesItems = { files?: SetInputFilesFiles, localPaths?: string[] };
|
||||
|
|
@ -106,7 +106,6 @@ export class FrameExecutionContext extends js.ExecutionContext {
|
|||
${isUnderTest()},
|
||||
${this.frame._page._delegate.rafCountForStablePosition()},
|
||||
"${this.frame._page._browserContext._browser.options.name}",
|
||||
${experimentalFeaturesEnabled()},
|
||||
[${custom.join(',\n')}]
|
||||
);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export class InjectedScript {
|
|||
private _highlight: Highlight | undefined;
|
||||
readonly isUnderTest: boolean;
|
||||
|
||||
constructor(isUnderTest: boolean, stableRafCount: number, browserName: string, experimentalFeaturesEnabled: boolean, customEngines: { name: string, engine: SelectorEngine}[]) {
|
||||
constructor(isUnderTest: boolean, stableRafCount: number, browserName: string, customEngines: { name: string, engine: SelectorEngine}[]) {
|
||||
this.isUnderTest = isUnderTest;
|
||||
this._evaluator = new SelectorEvaluatorImpl(new Map());
|
||||
|
||||
|
|
|
|||
|
|
@ -107,10 +107,6 @@ export function isUnderTest(): boolean {
|
|||
return _isUnderTest;
|
||||
}
|
||||
|
||||
export function experimentalFeaturesEnabled() {
|
||||
return isUnderTest() || !!process.env.PLAYWRIGHT_EXPERIMENTAL_FEATURES;
|
||||
}
|
||||
|
||||
export function getFromENV(name: string): string | undefined {
|
||||
let value = process.env[name];
|
||||
value = value === undefined ? process.env[`npm_config_${name.toLowerCase()}`] : value;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line spaced-comment
|
||||
/// <reference path="./experimental.d.ts" />
|
||||
|
||||
import type { Fixtures } from '@playwright/test';
|
||||
import type { ChildProcess } from 'child_process';
|
||||
import { execSync, spawn } from 'child_process';
|
||||
|
|
|
|||
21127
tests/config/experimental.d.ts
vendored
21127
tests/config/experimental.d.ts
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -30,7 +30,6 @@ export class DriverTestMode implements TestMode {
|
|||
async setup() {
|
||||
this._impl = await start({
|
||||
NODE_OPTIONS: undefined, // Hide driver process while debugging.
|
||||
PLAYWRIGHT_EXPERIMENTAL_FEATURES: '1',
|
||||
});
|
||||
return this._impl.playwright;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ if (mode === 'service') {
|
|||
reuseExistingServer: true,
|
||||
env: {
|
||||
PWTEST_UNSAFE_GRID_VERSION: '1',
|
||||
PLAYWRIGHT_EXPERIMENTAL_FEATURES: '1',
|
||||
},
|
||||
};
|
||||
config.use.connectOptions = {
|
||||
|
|
@ -96,9 +95,6 @@ if (mode === 'service2') {
|
|||
command: 'npx playwright run-server --port=3333',
|
||||
port: 3333,
|
||||
reuseExistingServer: true,
|
||||
env: {
|
||||
PLAYWRIGHT_EXPERIMENTAL_FEATURES: '1',
|
||||
},
|
||||
};
|
||||
config.use.connectOptions = {
|
||||
wsEndpoint: 'ws://localhost:3333/',
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ test('should include multiple image diffs', async ({ runInlineTest, page, showRe
|
|||
await expect.soft(page).toHaveScreenshot({ timeout: 1000 });
|
||||
});
|
||||
`,
|
||||
}, { reporter: 'dot,html' }, { PW_TEST_HTML_REPORT_OPEN: 'never', PLAYWRIGHT_EXPERIMENTAL_FEATURES: '1' });
|
||||
}, { reporter: 'dot,html' }, { PW_TEST_HTML_REPORT_OPEN: 'never' });
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ test('should include image diff when screenshot failed to generate due to animat
|
|||
await expect.soft(page).toHaveScreenshot({ timeout: 1000 });
|
||||
});
|
||||
`,
|
||||
}, { 'reporter': 'dot,html', 'update-snapshots': true }, { PW_TEST_HTML_REPORT_OPEN: 'never', PLAYWRIGHT_EXPERIMENTAL_FEATURES: '1' });
|
||||
}, { 'reporter': 'dot,html', 'update-snapshots': true }, { PW_TEST_HTML_REPORT_OPEN: 'never' });
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -414,11 +414,9 @@ test('should generate default name', async ({ runInlineTest }, testInfo) => {
|
|||
});
|
||||
|
||||
test('should compile with different option combinations', async ({ runTSC }) => {
|
||||
const experimentalPath = path.resolve(__dirname, '..', 'config', 'experimental.d.ts');
|
||||
const result = await runTSC({
|
||||
'playwright.config.ts': `
|
||||
//@no-header
|
||||
/// <reference path=${JSON.stringify(experimentalPath)} />
|
||||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
const config: PlaywrightTestConfig = {
|
||||
expect: {
|
||||
|
|
|
|||
|
|
@ -606,28 +606,6 @@ class TypesGenerator {
|
|||
return await generator.generateTypes(path.join(__dirname, 'overrides-testReporter.d.ts'));
|
||||
}
|
||||
|
||||
async function generateExperimentalTypes() {
|
||||
const core = await generateCoreTypes(true);
|
||||
const test = await generateTestTypes(true);
|
||||
const reporter = await generateReporterTypes(true);
|
||||
const lines = [
|
||||
`// This file is generated by ${__filename.substring(path.join(__dirname, '..', '..').length).split(path.sep).join(path.posix.sep)}`,
|
||||
`declare module 'playwright-core' {`,
|
||||
...core.split('\n'),
|
||||
`}`,
|
||||
`declare module '@playwright/test' {`,
|
||||
...test.split('\n'),
|
||||
`}`,
|
||||
`declare module '@playwright/test/reporter' {`,
|
||||
...reporter.split('\n'),
|
||||
`}`,
|
||||
];
|
||||
const cutFrom = lines.findIndex(line => line.includes('BEGINGLOBAL'));
|
||||
const cutTo = lines.findIndex(line => line.includes('ENDGLOBAL'));
|
||||
lines.splice(cutFrom, cutTo - cutFrom + 1);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} filePath
|
||||
* @param {string} content
|
||||
|
|
@ -658,7 +636,6 @@ class TypesGenerator {
|
|||
writeFile(path.join(coreTypesDir, 'types.d.ts'), await generateCoreTypes(false), true);
|
||||
writeFile(path.join(testTypesDir, 'test.d.ts'), await generateTestTypes(false), true);
|
||||
writeFile(path.join(testTypesDir, 'testReporter.d.ts'), await generateReporterTypes(false), true);
|
||||
writeFile(path.join(__dirname, '..', '..', 'tests', 'config', 'experimental.d.ts'), await generateExperimentalTypes(), true);
|
||||
process.exit(hadChanges && process.argv.includes('--check-clean') ? 1 : 0);
|
||||
})().catch(e => {
|
||||
console.error(e);
|
||||
|
|
|
|||
Loading…
Reference in a new issue