2017-07-28 08:09:26 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2017 Google Inc. 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.
|
|
|
|
*/
|
|
|
|
|
2017-07-12 18:42:36 +00:00
|
|
|
const jsBuilder = require('./JSBuilder');
|
|
|
|
const mdBuilder = require('./MDBuilder');
|
|
|
|
const Documentation = require('./Documentation');
|
2017-07-31 04:49:04 +00:00
|
|
|
const Message = require('../Message');
|
2020-07-10 09:07:28 +00:00
|
|
|
const {
|
|
|
|
MODULES_TO_CHECK_FOR_COVERAGE,
|
|
|
|
} = require('../../../test/coverage-utils');
|
2017-07-12 18:42:36 +00:00
|
|
|
|
2018-08-09 23:51:12 +00:00
|
|
|
const EXCLUDE_PROPERTIES = new Set([
|
2017-10-18 02:14:57 +00:00
|
|
|
'Browser.create',
|
2017-07-12 18:42:36 +00:00
|
|
|
'Headers.fromPayload',
|
|
|
|
'Page.create',
|
2017-10-10 17:54:20 +00:00
|
|
|
'JSHandle.toString',
|
2018-08-09 23:51:12 +00:00
|
|
|
'TimeoutError.name',
|
2021-05-26 13:46:17 +00:00
|
|
|
/* These are not actual properties, but a TypeScript generic.
|
2020-07-02 09:09:34 +00:00
|
|
|
* DocLint incorrectly parses it as a property.
|
|
|
|
*/
|
|
|
|
'ElementHandle.ElementType',
|
2021-05-26 13:46:17 +00:00
|
|
|
'ElementHandle.HandleObjectType',
|
|
|
|
'JSHandle.HandleObjectType',
|
2017-07-12 18:42:36 +00:00
|
|
|
]);
|
|
|
|
|
2017-07-13 08:25:32 +00:00
|
|
|
/**
|
|
|
|
* @param {!Page} page
|
2017-07-31 04:49:04 +00:00
|
|
|
* @param {!Array<!Source>} mdSources
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {!Promise<!Array<!Message>>}
|
2017-07-13 08:25:32 +00:00
|
|
|
*/
|
2017-07-31 04:49:04 +00:00
|
|
|
module.exports = async function lint(page, mdSources, jsSources) {
|
2017-08-21 23:39:04 +00:00
|
|
|
const mdResult = await mdBuilder(page, mdSources);
|
|
|
|
const jsResult = await jsBuilder(jsSources);
|
2020-07-10 09:07:28 +00:00
|
|
|
const jsDocumentation = filterJSDocumentation(jsResult.documentation);
|
2017-08-21 23:39:04 +00:00
|
|
|
const mdDocumentation = mdResult.documentation;
|
2017-07-12 18:42:36 +00:00
|
|
|
|
2017-08-21 23:39:04 +00:00
|
|
|
const jsErrors = jsResult.errors;
|
2017-07-21 21:17:21 +00:00
|
|
|
jsErrors.push(...checkDuplicates(jsDocumentation));
|
2017-07-21 17:27:53 +00:00
|
|
|
|
2017-08-21 23:39:04 +00:00
|
|
|
const mdErrors = mdResult.errors;
|
2017-07-21 21:17:21 +00:00
|
|
|
mdErrors.push(...compareDocumentations(mdDocumentation, jsDocumentation));
|
|
|
|
mdErrors.push(...checkDuplicates(mdDocumentation));
|
|
|
|
mdErrors.push(...checkSorting(mdDocumentation));
|
2017-07-13 22:15:31 +00:00
|
|
|
|
|
|
|
// Push all errors with proper prefixes
|
2020-05-07 10:54:55 +00:00
|
|
|
const errors = jsErrors.map((error) => '[JavaScript] ' + error);
|
|
|
|
errors.push(...mdErrors.map((error) => '[MarkDown] ' + error));
|
|
|
|
return errors.map((error) => Message.error(error));
|
2017-07-21 21:17:21 +00:00
|
|
|
};
|
2017-07-13 22:15:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {!Documentation} doc
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {!Array<string>}
|
2017-07-13 22:15:31 +00:00
|
|
|
*/
|
2017-07-21 21:17:21 +00:00
|
|
|
function checkSorting(doc) {
|
2017-07-13 22:15:31 +00:00
|
|
|
const errors = [];
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const cls of doc.classesArray) {
|
|
|
|
const members = cls.membersArray;
|
2017-07-14 20:03:21 +00:00
|
|
|
|
|
|
|
// Events should go first.
|
|
|
|
let eventIndex = 0;
|
2020-05-07 10:54:55 +00:00
|
|
|
for (
|
|
|
|
;
|
|
|
|
eventIndex < members.length && members[eventIndex].kind === 'event';
|
|
|
|
++eventIndex
|
|
|
|
);
|
|
|
|
for (
|
|
|
|
;
|
|
|
|
eventIndex < members.length && members[eventIndex].kind !== 'event';
|
|
|
|
++eventIndex
|
|
|
|
);
|
2017-07-14 20:03:21 +00:00
|
|
|
if (eventIndex < members.length)
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Events should go first. Event '${members[eventIndex].name}' in class ${cls.name} breaks order`
|
|
|
|
);
|
2017-07-14 20:03:21 +00:00
|
|
|
|
|
|
|
// Constructor should be right after events and before all other members.
|
2020-05-07 10:54:55 +00:00
|
|
|
const constructorIndex = members.findIndex(
|
|
|
|
(member) => member.kind === 'method' && member.name === 'constructor'
|
|
|
|
);
|
2018-11-21 22:49:08 +00:00
|
|
|
if (constructorIndex > 0 && members[constructorIndex - 1].kind !== 'event')
|
2017-07-14 20:03:21 +00:00
|
|
|
errors.push(`Constructor of ${cls.name} should go before other methods`);
|
|
|
|
|
|
|
|
// Events should be sorted alphabetically.
|
|
|
|
for (let i = 0; i < members.length - 1; ++i) {
|
2017-08-21 23:39:04 +00:00
|
|
|
const member1 = cls.membersArray[i];
|
|
|
|
const member2 = cls.membersArray[i + 1];
|
2020-05-07 10:54:55 +00:00
|
|
|
if (member1.kind !== 'event' || member2.kind !== 'event') continue;
|
2017-07-14 20:03:21 +00:00
|
|
|
if (member1.name > member2.name)
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Event '${member1.name}' in class ${cls.name} breaks alphabetic ordering of events`
|
|
|
|
);
|
2017-07-14 20:03:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// All other members should be sorted alphabetically.
|
|
|
|
for (let i = 0; i < members.length - 1; ++i) {
|
2017-08-21 23:39:04 +00:00
|
|
|
const member1 = cls.membersArray[i];
|
|
|
|
const member2 = cls.membersArray[i + 1];
|
2020-05-07 10:54:55 +00:00
|
|
|
if (member1.kind === 'event' || member2.kind === 'event') continue;
|
|
|
|
if (member1.kind === 'method' && member1.name === 'constructor') continue;
|
2017-07-14 05:52:02 +00:00
|
|
|
if (member1.name > member2.name) {
|
2017-07-21 19:41:49 +00:00
|
|
|
let memberName1 = `${cls.name}.${member1.name}`;
|
2020-05-07 10:54:55 +00:00
|
|
|
if (member1.kind === 'method') memberName1 += '()';
|
2017-07-21 19:41:49 +00:00
|
|
|
let memberName2 = `${cls.name}.${member2.name}`;
|
2020-05-07 10:54:55 +00:00
|
|
|
if (member2.kind === 'method') memberName2 += '()';
|
|
|
|
errors.push(
|
|
|
|
`Bad alphabetic ordering of ${cls.name} members: ${memberName1} should go after ${memberName2}`
|
|
|
|
);
|
2017-07-14 05:52:02 +00:00
|
|
|
}
|
2017-07-13 08:25:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return errors;
|
2017-07-12 18:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {!Documentation} jsDocumentation
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {!Documentation}
|
2017-07-12 18:42:36 +00:00
|
|
|
*/
|
2020-07-10 09:07:28 +00:00
|
|
|
function filterJSDocumentation(jsDocumentation) {
|
|
|
|
const includedClasses = new Set(Object.keys(MODULES_TO_CHECK_FOR_COVERAGE));
|
2019-01-26 04:21:14 +00:00
|
|
|
// Filter private classes and methods.
|
2017-08-21 23:39:04 +00:00
|
|
|
const classes = [];
|
|
|
|
for (const cls of jsDocumentation.classesArray) {
|
2020-05-07 10:54:55 +00:00
|
|
|
if (includedClasses && !includedClasses.has(cls.name)) continue;
|
|
|
|
const members = cls.membersArray.filter(
|
|
|
|
(member) => !EXCLUDE_PROPERTIES.has(`${cls.name}.${member.name}`)
|
|
|
|
);
|
2017-07-14 05:52:02 +00:00
|
|
|
classes.push(new Documentation.Class(cls.name, members));
|
2017-07-12 18:42:36 +00:00
|
|
|
}
|
|
|
|
return new Documentation(classes);
|
|
|
|
}
|
2017-07-13 08:25:32 +00:00
|
|
|
|
2017-07-21 21:17:21 +00:00
|
|
|
/**
|
|
|
|
* @param {!Documentation} doc
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {!Array<string>}
|
2017-07-21 21:17:21 +00:00
|
|
|
*/
|
|
|
|
function checkDuplicates(doc) {
|
|
|
|
const errors = [];
|
2017-08-21 23:39:04 +00:00
|
|
|
const classes = new Set();
|
2017-07-21 21:17:21 +00:00
|
|
|
// Report duplicates.
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const cls of doc.classesArray) {
|
2017-07-21 21:17:21 +00:00
|
|
|
if (classes.has(cls.name))
|
|
|
|
errors.push(`Duplicate declaration of class ${cls.name}`);
|
|
|
|
classes.add(cls.name);
|
2017-08-21 23:39:04 +00:00
|
|
|
const members = new Set();
|
|
|
|
for (const member of cls.membersArray) {
|
2018-11-21 22:49:08 +00:00
|
|
|
if (members.has(member.kind + ' ' + member.name))
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Duplicate declaration of ${member.kind} ${cls.name}.${member.name}()`
|
|
|
|
);
|
2018-11-21 22:49:08 +00:00
|
|
|
members.add(member.kind + ' ' + member.name);
|
2017-08-21 23:39:04 +00:00
|
|
|
const args = new Set();
|
|
|
|
for (const arg of member.argsArray) {
|
2017-07-21 21:17:21 +00:00
|
|
|
if (args.has(arg.name))
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Duplicate declaration of argument ${cls.name}.${member.name} "${arg.name}"`
|
|
|
|
);
|
2017-07-21 21:17:21 +00:00
|
|
|
args.add(arg.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return errors;
|
|
|
|
}
|
|
|
|
|
2020-06-15 10:52:19 +00:00
|
|
|
// All the methods from our EventEmitter that we don't document for each subclass.
|
|
|
|
const EVENT_LISTENER_METHODS = new Set([
|
|
|
|
'emit',
|
|
|
|
'listenerCount',
|
|
|
|
'off',
|
|
|
|
'on',
|
|
|
|
'once',
|
|
|
|
'removeListener',
|
|
|
|
'addListener',
|
|
|
|
'removeAllListeners',
|
|
|
|
]);
|
|
|
|
|
|
|
|
/* Methods that are defined in code but are not documented */
|
|
|
|
const expectedNotFoundMethods = new Map([
|
|
|
|
['Browser', EVENT_LISTENER_METHODS],
|
|
|
|
['BrowserContext', EVENT_LISTENER_METHODS],
|
|
|
|
['CDPSession', EVENT_LISTENER_METHODS],
|
|
|
|
['Page', EVENT_LISTENER_METHODS],
|
|
|
|
['WebWorker', EVENT_LISTENER_METHODS],
|
|
|
|
]);
|
|
|
|
|
2017-07-21 21:17:21 +00:00
|
|
|
/**
|
|
|
|
* @param {!Documentation} actual
|
|
|
|
* @param {!Documentation} expected
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {!Array<string>}
|
2017-07-21 21:17:21 +00:00
|
|
|
*/
|
|
|
|
function compareDocumentations(actual, expected) {
|
|
|
|
const errors = [];
|
|
|
|
|
|
|
|
const actualClasses = Array.from(actual.classes.keys()).sort();
|
|
|
|
const expectedClasses = Array.from(expected.classes.keys()).sort();
|
2017-08-21 23:39:04 +00:00
|
|
|
const classesDiff = diff(actualClasses, expectedClasses);
|
2020-04-06 10:36:28 +00:00
|
|
|
|
2020-10-13 15:19:26 +00:00
|
|
|
/* These have been moved onto PuppeteerNode but we want to document them under
|
|
|
|
* Puppeteer. See https://github.com/puppeteer/puppeteer/pull/6504 for details.
|
|
|
|
*/
|
|
|
|
const expectedPuppeteerClassMissingMethods = new Set([
|
|
|
|
'createBrowserFetcher',
|
|
|
|
'defaultArgs',
|
|
|
|
'executablePath',
|
|
|
|
'launch',
|
|
|
|
]);
|
|
|
|
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const className of classesDiff.extra)
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Non-existing class found: ${className}`);
|
2020-10-13 15:19:26 +00:00
|
|
|
|
|
|
|
for (const className of classesDiff.missing) {
|
|
|
|
if (className === 'PuppeteerNode') {
|
|
|
|
continue;
|
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Class not found: ${className}`);
|
2020-10-13 15:19:26 +00:00
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const className of classesDiff.equal) {
|
2017-07-21 21:17:21 +00:00
|
|
|
const actualClass = actual.classes.get(className);
|
|
|
|
const expectedClass = expected.classes.get(className);
|
|
|
|
const actualMethods = Array.from(actualClass.methods.keys()).sort();
|
|
|
|
const expectedMethods = Array.from(expectedClass.methods.keys()).sort();
|
|
|
|
const methodDiff = diff(actualMethods, expectedMethods);
|
2020-04-06 10:36:28 +00:00
|
|
|
|
2020-04-06 08:38:05 +00:00
|
|
|
for (const methodName of methodDiff.extra) {
|
2020-10-13 15:19:26 +00:00
|
|
|
if (
|
|
|
|
expectedPuppeteerClassMissingMethods.has(methodName) &&
|
|
|
|
actualClass.name === 'Puppeteer'
|
|
|
|
) {
|
|
|
|
continue;
|
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Non-existing method found: ${className}.${methodName}()`);
|
2020-04-06 08:38:05 +00:00
|
|
|
}
|
2020-06-15 10:52:19 +00:00
|
|
|
|
|
|
|
for (const methodName of methodDiff.missing) {
|
|
|
|
const missingMethodsForClass = expectedNotFoundMethods.get(className);
|
|
|
|
if (missingMethodsForClass && missingMethodsForClass.has(methodName))
|
|
|
|
continue;
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Method not found: ${className}.${methodName}()`);
|
2020-06-15 10:52:19 +00:00
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const methodName of methodDiff.equal) {
|
2017-07-21 21:17:21 +00:00
|
|
|
const actualMethod = actualClass.methods.get(methodName);
|
|
|
|
const expectedMethod = expectedClass.methods.get(methodName);
|
2018-11-21 22:49:08 +00:00
|
|
|
if (!actualMethod.type !== !expectedMethod.type) {
|
|
|
|
if (actualMethod.type)
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Method ${className}.${methodName} has unneeded description of return type`
|
|
|
|
);
|
2017-07-21 21:17:21 +00:00
|
|
|
else
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Method ${className}.${methodName} is missing return type description`
|
|
|
|
);
|
2018-11-21 22:49:08 +00:00
|
|
|
} else if (actualMethod.hasReturn) {
|
2020-05-07 10:54:55 +00:00
|
|
|
checkType(
|
|
|
|
`Method ${className}.${methodName} has the wrong return type: `,
|
|
|
|
actualMethod.type,
|
|
|
|
expectedMethod.type
|
|
|
|
);
|
2017-07-21 21:17:21 +00:00
|
|
|
}
|
|
|
|
const actualArgs = Array.from(actualMethod.args.keys());
|
|
|
|
const expectedArgs = Array.from(expectedMethod.args.keys());
|
2018-11-21 22:49:08 +00:00
|
|
|
const argsDiff = diff(actualArgs, expectedArgs);
|
2020-07-10 10:51:52 +00:00
|
|
|
|
2018-11-21 22:49:08 +00:00
|
|
|
if (argsDiff.extra.length || argsDiff.missing.length) {
|
2020-07-10 10:51:52 +00:00
|
|
|
/* Doclint cannot handle the parameter type of the CDPSession send method.
|
|
|
|
* so we just ignore it.
|
|
|
|
*/
|
|
|
|
const isCdpSessionSend =
|
|
|
|
className === 'CDPSession' && methodName === 'send';
|
|
|
|
if (!isCdpSessionSend) {
|
|
|
|
const text = [
|
|
|
|
`Method ${className}.${methodName}() fails to describe its parameters:`,
|
|
|
|
];
|
|
|
|
for (const arg of argsDiff.missing)
|
|
|
|
text.push(`- Argument not found: ${arg}`);
|
|
|
|
for (const arg of argsDiff.extra)
|
|
|
|
text.push(`- Non-existing argument found: ${arg}`);
|
|
|
|
errors.push(text.join('\n'));
|
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
}
|
2018-11-21 22:49:08 +00:00
|
|
|
|
|
|
|
for (const arg of argsDiff.equal)
|
2020-05-07 10:54:55 +00:00
|
|
|
checkProperty(
|
|
|
|
`Method ${className}.${methodName}()`,
|
|
|
|
actualMethod.args.get(arg),
|
|
|
|
expectedMethod.args.get(arg)
|
|
|
|
);
|
2017-07-21 21:17:21 +00:00
|
|
|
}
|
|
|
|
const actualProperties = Array.from(actualClass.properties.keys()).sort();
|
2020-05-07 10:54:55 +00:00
|
|
|
const expectedProperties = Array.from(
|
|
|
|
expectedClass.properties.keys()
|
|
|
|
).sort();
|
2017-07-21 21:17:21 +00:00
|
|
|
const propertyDiff = diff(actualProperties, expectedProperties);
|
2020-10-13 15:19:26 +00:00
|
|
|
for (const propertyName of propertyDiff.extra) {
|
|
|
|
if (className === 'Puppeteer' && propertyName === 'product') {
|
|
|
|
continue;
|
|
|
|
}
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Non-existing property found: ${className}.${propertyName}`);
|
2020-10-13 15:19:26 +00:00
|
|
|
}
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const propertyName of propertyDiff.missing)
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Property not found: ${className}.${propertyName}`);
|
|
|
|
|
|
|
|
const actualEvents = Array.from(actualClass.events.keys()).sort();
|
|
|
|
const expectedEvents = Array.from(expectedClass.events.keys()).sort();
|
|
|
|
const eventsDiff = diff(actualEvents, expectedEvents);
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const eventName of eventsDiff.extra)
|
2020-05-07 10:54:55 +00:00
|
|
|
errors.push(
|
|
|
|
`Non-existing event found in class ${className}: '${eventName}'`
|
|
|
|
);
|
2017-08-21 23:39:04 +00:00
|
|
|
for (const eventName of eventsDiff.missing)
|
2017-07-21 21:17:21 +00:00
|
|
|
errors.push(`Event not found in class ${className}: '${eventName}'`);
|
|
|
|
}
|
2018-11-21 22:49:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} source
|
|
|
|
* @param {!Documentation.Member} actual
|
|
|
|
* @param {!Documentation.Member} expected
|
|
|
|
*/
|
|
|
|
function checkProperty(source, actual, expected) {
|
|
|
|
checkType(source + ' ' + actual.name, actual.type, expected.type);
|
|
|
|
}
|
|
|
|
|
2020-04-21 08:20:25 +00:00
|
|
|
/**
|
|
|
|
* @param {string} source
|
|
|
|
* @param {!string} actualName
|
|
|
|
* @param {!string} expectedName
|
|
|
|
*/
|
|
|
|
function namingMisMatchInTypeIsExpected(source, actualName, expectedName) {
|
|
|
|
/* The DocLint tooling doesn't deal well with generics in TypeScript
|
2020-05-07 10:54:55 +00:00
|
|
|
* source files. We could fix this but the longterm plan is to
|
|
|
|
* auto-generate documentation from TS. So instead we document here
|
|
|
|
* the methods that use generics that DocLint trips up on and if it
|
|
|
|
* finds a mismatch that matches one of the cases below it doesn't
|
|
|
|
* error. This still means we're protected from accidental changes, as
|
|
|
|
* if the mismatch doesn't exactly match what's described below
|
|
|
|
* DocLint will fail.
|
|
|
|
*/
|
2020-04-21 08:20:25 +00:00
|
|
|
const expectedNamingMismatches = new Map([
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method CDPSession.send() method',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'T',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method CDPSession.send() params',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'CommandParameters[T]',
|
|
|
|
},
|
|
|
|
],
|
2020-06-22 15:21:57 +00:00
|
|
|
[
|
|
|
|
'Method ElementHandle.click() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ClickOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ElementHandle.press() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'PressOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method ElementHandle.press() key',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'KeyInput',
|
|
|
|
},
|
|
|
|
],
|
2021-06-04 10:25:36 +00:00
|
|
|
[
|
|
|
|
'Method ElementHandle.drag() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ElementHandle.dragAndDrop() target',
|
|
|
|
{
|
|
|
|
actualName: 'ElementHandle',
|
|
|
|
expectedName: 'ElementHandle<Element>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ElementHandle.dragEnter() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ElementHandle.dragOver() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ElementHandle.drop() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method Keyboard.down() key',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'KeyInput',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Keyboard.press() key',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'KeyInput',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Keyboard.up() key',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'KeyInput',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.down() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'MouseOptions',
|
|
|
|
},
|
|
|
|
],
|
2021-06-04 10:25:36 +00:00
|
|
|
[
|
|
|
|
'Method Mouse.drag() start',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.drag() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragAndDrop() start',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragAndDrop() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragAndDrop() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragEnter() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragEnter() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragOver() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.dragOver() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.drop() target',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Point',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Mouse.drop() data',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'DragData',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method Mouse.up() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'MouseOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-07-06 07:27:17 +00:00
|
|
|
[
|
|
|
|
'Method Mouse.wheel() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'MouseWheelOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method Tracing.start() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'TracingOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.waitForSelector() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForSelectorOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.waitForXPath() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForSelectorOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
2020-05-29 08:38:40 +00:00
|
|
|
'Method HTTPRequest.abort() errorCode',
|
2020-05-07 10:54:55 +00:00
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'ErrorCode',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.goto() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.waitForNavigation() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.setContent() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Puppeteer.defaultArgs() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ChromeArgOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.goBack() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.goForward() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.goto() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.reload() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.setContent() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.waitForNavigation() options.waitUntil',
|
|
|
|
{
|
|
|
|
actualName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array',
|
|
|
|
expectedName:
|
|
|
|
'"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|Array<PuppeteerLifeCycleEvent>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method BrowserContext.overridePermissions() permissions',
|
|
|
|
{
|
|
|
|
actualName: 'Array<string>',
|
|
|
|
expectedName: 'Array<PermissionType>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Puppeteer.createBrowserFetcher() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'BrowserFetcherOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.authenticate() credentials',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Credentials',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.emulateMediaFeatures() features',
|
|
|
|
{
|
|
|
|
actualName: 'Array<Object>',
|
|
|
|
expectedName: 'Array<MediaFeature>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.emulate() options.viewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
2021-01-21 09:00:57 +00:00
|
|
|
[
|
|
|
|
'Method Page.emulateNetworkConditions() networkConditions',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'NetworkConditions',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method Page.setViewport() options.viewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.setViewport() viewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.connect() options.defaultViewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Puppeteer.connect() options.defaultViewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Puppeteer.launch() options.defaultViewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.launch() options.defaultViewport',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'Viewport',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.goBack() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.goForward() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.reload() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.waitForNavigation() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.pdf() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'PDFOptions',
|
|
|
|
},
|
|
|
|
],
|
2021-06-23 12:51:38 +00:00
|
|
|
[
|
|
|
|
'Method Page.createPDFStream() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'PDFOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Method Page.screenshot() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ScreenshotOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.setContent() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.setCookie() ...cookies',
|
|
|
|
{
|
|
|
|
actualName: '...Object',
|
|
|
|
expectedName: '...CookieParam',
|
|
|
|
},
|
|
|
|
],
|
2020-05-26 15:14:20 +00:00
|
|
|
[
|
|
|
|
'Method Page.emulateVisionDeficiency() type',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
2021-05-12 16:43:05 +00:00
|
|
|
expectedName:
|
|
|
|
'"none"|"achromatopsia"|"blurredVision"|"deuteranopia"|"protanopia"|"tritanopia"',
|
2020-05-26 15:14:20 +00:00
|
|
|
},
|
|
|
|
],
|
2020-06-05 14:20:11 +00:00
|
|
|
[
|
|
|
|
'Method Accessibility.snapshot() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'SnapshotOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-06-23 05:19:15 +00:00
|
|
|
[
|
|
|
|
'Method Browser.waitForTarget() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'WaitForTargetOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-06-15 10:52:19 +00:00
|
|
|
[
|
|
|
|
'Method EventEmitter.emit() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.listenerCount() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.off() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.on() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.once() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.removeListener() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.addListener() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method EventEmitter.removeAllListeners() event',
|
|
|
|
{
|
|
|
|
actualName: 'string|symbol',
|
2020-07-14 15:57:29 +00:00
|
|
|
expectedName: 'EventType',
|
2020-06-15 10:52:19 +00:00
|
|
|
},
|
|
|
|
],
|
2020-06-29 08:53:28 +00:00
|
|
|
[
|
|
|
|
'Method Coverage.startCSSCoverage() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'CSSCoverageOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Coverage.startJSCoverage() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'JSCoverageOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-07-02 11:15:39 +00:00
|
|
|
[
|
|
|
|
'Method Mouse.click() options.button',
|
|
|
|
{
|
|
|
|
actualName: '"left"|"right"|"middle"',
|
|
|
|
expectedName: 'MouseButton',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.click() options.button',
|
|
|
|
{
|
|
|
|
actualName: '"left"|"right"|"middle"',
|
|
|
|
expectedName: 'MouseButton',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Page.click() options.button',
|
|
|
|
{
|
|
|
|
actualName: '"left"|"right"|"middle"',
|
|
|
|
expectedName: 'MouseButton',
|
|
|
|
},
|
|
|
|
],
|
2020-07-03 13:28:45 +00:00
|
|
|
[
|
|
|
|
'Method HTTPRequest.continue() overrides',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ContinueRequestOverrides',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method HTTPRequest.respond() response',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ResponseForRequest',
|
|
|
|
},
|
|
|
|
],
|
2020-07-09 13:22:58 +00:00
|
|
|
[
|
|
|
|
'Method Frame.addScriptTag() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'FrameAddScriptTagOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.addStyleTag() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'FrameAddStyleTagOptions',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method Frame.waitForFunction() options',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'FrameWaitForFunctionOptions',
|
|
|
|
},
|
|
|
|
],
|
2020-07-10 10:51:52 +00:00
|
|
|
[
|
|
|
|
'Method BrowserContext.overridePermissions() permissions',
|
|
|
|
{
|
|
|
|
actualName: 'Array<string>',
|
|
|
|
expectedName: 'Array<Object>',
|
|
|
|
},
|
|
|
|
],
|
2020-10-12 09:08:57 +00:00
|
|
|
[
|
2020-10-13 15:19:26 +00:00
|
|
|
'Method Puppeteer.connect() options',
|
2020-10-12 09:08:57 +00:00
|
|
|
{
|
2020-10-13 15:19:26 +00:00
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'ConnectOptions',
|
2020-10-12 09:08:57 +00:00
|
|
|
},
|
|
|
|
],
|
2021-02-09 11:52:35 +00:00
|
|
|
[
|
|
|
|
'Method Page.deleteCookie() ...cookies',
|
|
|
|
{
|
|
|
|
actualName: '...Object',
|
|
|
|
expectedName: '...DeleteCookiesRequest',
|
|
|
|
},
|
|
|
|
],
|
2021-02-11 15:44:56 +00:00
|
|
|
[
|
|
|
|
'Method BrowserContext.overridePermissions() permissions',
|
|
|
|
{
|
|
|
|
actualName: 'Array<string>',
|
|
|
|
expectedName: 'Array<Permission>',
|
|
|
|
},
|
|
|
|
],
|
2021-03-25 11:26:35 +00:00
|
|
|
[
|
|
|
|
'Method HTTPRequest.respond() response.body',
|
|
|
|
{
|
|
|
|
actualName: 'string|Buffer',
|
|
|
|
expectedName: 'Object',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method HTTPRequest.respond() response.contentType',
|
|
|
|
{
|
|
|
|
actualName: 'string',
|
|
|
|
expectedName: 'Object',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method HTTPRequest.respond() response.status',
|
|
|
|
{
|
|
|
|
actualName: 'number',
|
|
|
|
expectedName: 'Object',
|
|
|
|
},
|
|
|
|
],
|
2021-05-12 16:43:05 +00:00
|
|
|
[
|
|
|
|
'Method EventEmitter.emit() eventData',
|
|
|
|
{
|
|
|
|
actualName: 'Object',
|
|
|
|
expectedName: 'unknown',
|
|
|
|
},
|
|
|
|
],
|
2021-05-26 13:46:17 +00:00
|
|
|
[
|
|
|
|
'Method Page.queryObjects() prototypeHandle',
|
|
|
|
{
|
|
|
|
actualName: 'JSHandle',
|
|
|
|
expectedName: 'JSHandle<unknown>',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Method ExecutionContext.queryObjects() prototypeHandle',
|
|
|
|
{
|
|
|
|
actualName: 'JSHandle',
|
|
|
|
expectedName: 'JSHandle<unknown>',
|
|
|
|
},
|
|
|
|
],
|
2020-04-21 08:20:25 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
const expectedForSource = expectedNamingMismatches.get(source);
|
|
|
|
if (!expectedForSource) return false;
|
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
const namingMismatchIsExpected =
|
|
|
|
expectedForSource.actualName === actualName &&
|
|
|
|
expectedForSource.expectedName === expectedName;
|
2020-04-21 08:20:25 +00:00
|
|
|
|
|
|
|
return namingMismatchIsExpected;
|
|
|
|
}
|
|
|
|
|
2018-11-21 22:49:08 +00:00
|
|
|
/**
|
|
|
|
* @param {string} source
|
|
|
|
* @param {!Documentation.Type} actual
|
|
|
|
* @param {!Documentation.Type} expected
|
|
|
|
*/
|
|
|
|
function checkType(source, actual, expected) {
|
|
|
|
// TODO(@JoelEinbinder): check functions and Serializable
|
|
|
|
if (actual.name.includes('unction') || actual.name.includes('Serializable'))
|
|
|
|
return;
|
|
|
|
// We don't have nullchecks on for TypeScript
|
|
|
|
const actualName = actual.name.replace(/[\? ]/g, '');
|
|
|
|
// TypeScript likes to add some spaces
|
|
|
|
const expectedName = expected.name.replace(/\ /g, '');
|
2020-05-07 10:54:55 +00:00
|
|
|
const namingMismatchIsExpected = namingMisMatchInTypeIsExpected(
|
|
|
|
source,
|
|
|
|
actualName,
|
|
|
|
expectedName
|
|
|
|
);
|
2020-04-22 14:44:04 +00:00
|
|
|
if (expectedName !== actualName && !namingMismatchIsExpected)
|
|
|
|
errors.push(`${source} ${actualName} != ${expectedName}`);
|
2020-04-21 08:20:25 +00:00
|
|
|
|
2020-04-22 14:44:04 +00:00
|
|
|
/* If we got a naming mismatch and it was expected, don't check the properties
|
|
|
|
* as they will likely be considered "wrong" by DocLint too.
|
|
|
|
*/
|
|
|
|
if (namingMismatchIsExpected) return;
|
2020-07-10 10:51:52 +00:00
|
|
|
|
|
|
|
/* Some methods cause errors in the property checks for an unknown reason
|
|
|
|
* so we support a list of methods whose parameters are not checked.
|
|
|
|
*/
|
|
|
|
const skipPropertyChecksOnMethods = new Set([
|
|
|
|
'Method Page.deleteCookie() ...cookies',
|
|
|
|
'Method Page.setCookie() ...cookies',
|
2020-10-13 15:19:26 +00:00
|
|
|
'Method Puppeteer.connect() options',
|
2020-07-10 10:51:52 +00:00
|
|
|
]);
|
|
|
|
if (skipPropertyChecksOnMethods.has(source)) return;
|
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
const actualPropertiesMap = new Map(
|
|
|
|
actual.properties.map((property) => [property.name, property.type])
|
|
|
|
);
|
|
|
|
const expectedPropertiesMap = new Map(
|
|
|
|
expected.properties.map((property) => [property.name, property.type])
|
|
|
|
);
|
|
|
|
const propertiesDiff = diff(
|
|
|
|
Array.from(actualPropertiesMap.keys()).sort(),
|
|
|
|
Array.from(expectedPropertiesMap.keys()).sort()
|
|
|
|
);
|
2018-11-21 22:49:08 +00:00
|
|
|
for (const propertyName of propertiesDiff.extra)
|
|
|
|
errors.push(`${source} has unexpected property ${propertyName}`);
|
|
|
|
for (const propertyName of propertiesDiff.missing)
|
|
|
|
errors.push(`${source} is missing property ${propertyName}`);
|
|
|
|
for (const propertyName of propertiesDiff.equal)
|
2020-05-07 10:54:55 +00:00
|
|
|
checkType(
|
|
|
|
source + '.' + propertyName,
|
|
|
|
actualPropertiesMap.get(propertyName),
|
|
|
|
expectedPropertiesMap.get(propertyName)
|
|
|
|
);
|
2018-11-21 22:49:08 +00:00
|
|
|
}
|
|
|
|
|
2017-07-21 21:17:21 +00:00
|
|
|
return errors;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {!Array<string>} actual
|
|
|
|
* @param {!Array<string>} expected
|
2020-06-12 10:38:24 +00:00
|
|
|
* @returns {{extra: !Array<string>, missing: !Array<string>, equal: !Array<string>}}
|
2017-07-21 21:17:21 +00:00
|
|
|
*/
|
|
|
|
function diff(actual, expected) {
|
|
|
|
const N = actual.length;
|
|
|
|
const M = expected.length;
|
2020-05-07 10:54:55 +00:00
|
|
|
if (N === 0 && M === 0) return { extra: [], missing: [], equal: [] };
|
|
|
|
if (N === 0) return { extra: [], missing: expected.slice(), equal: [] };
|
|
|
|
if (M === 0) return { extra: actual.slice(), missing: [], equal: [] };
|
2017-08-21 23:39:04 +00:00
|
|
|
const d = new Array(N);
|
|
|
|
const bt = new Array(N);
|
2017-07-21 21:17:21 +00:00
|
|
|
for (let i = 0; i < N; ++i) {
|
|
|
|
d[i] = new Array(M);
|
|
|
|
bt[i] = new Array(M);
|
|
|
|
for (let j = 0; j < M; ++j) {
|
|
|
|
const top = val(i - 1, j);
|
|
|
|
const left = val(i, j - 1);
|
|
|
|
if (top > left) {
|
|
|
|
d[i][j] = top;
|
|
|
|
bt[i][j] = 'extra';
|
|
|
|
} else {
|
|
|
|
d[i][j] = left;
|
|
|
|
bt[i][j] = 'missing';
|
|
|
|
}
|
2017-08-21 23:39:04 +00:00
|
|
|
const diag = val(i - 1, j - 1);
|
2017-07-21 21:17:21 +00:00
|
|
|
if (actual[i] === expected[j] && d[i][j] < diag + 1) {
|
|
|
|
d[i][j] = diag + 1;
|
|
|
|
bt[i][j] = 'eq';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Backtrack results.
|
|
|
|
let i = N - 1;
|
|
|
|
let j = M - 1;
|
2017-08-21 23:39:04 +00:00
|
|
|
const missing = [];
|
|
|
|
const extra = [];
|
|
|
|
const equal = [];
|
2017-07-21 21:17:21 +00:00
|
|
|
while (i >= 0 && j >= 0) {
|
|
|
|
switch (bt[i][j]) {
|
|
|
|
case 'extra':
|
|
|
|
extra.push(actual[i]);
|
|
|
|
i -= 1;
|
|
|
|
break;
|
|
|
|
case 'missing':
|
|
|
|
missing.push(expected[j]);
|
|
|
|
j -= 1;
|
|
|
|
break;
|
|
|
|
case 'eq':
|
|
|
|
equal.push(actual[i]);
|
|
|
|
i -= 1;
|
|
|
|
j -= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-05-07 10:54:55 +00:00
|
|
|
while (i >= 0) extra.push(actual[i--]);
|
|
|
|
while (j >= 0) missing.push(expected[j--]);
|
2017-07-21 21:17:21 +00:00
|
|
|
extra.reverse();
|
|
|
|
missing.reverse();
|
|
|
|
equal.reverse();
|
2020-05-07 10:54:55 +00:00
|
|
|
return { extra, missing, equal };
|
2017-07-21 21:17:21 +00:00
|
|
|
|
|
|
|
function val(i, j) {
|
|
|
|
return i < 0 || j < 0 ? 0 : d[i][j];
|
|
|
|
}
|
|
|
|
}
|