Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typedoc-appium-plugin): implement cross-referencing of methods #17971

Merged
merged 4 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ package.json
**/generated/**
# generated
packages/types/lib/appium-config.ts
**/*.hbs
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"internalConsoleOptions": "openOnSessionStart",
"name": "Typedoc",
"program": "${workspaceFolder}/node_modules/.bin/typedoc",
"args": ["--logLevel", "Verbose"],
"request": "launch",
"skipFiles": [
"<node_internals>/**"
Expand Down
17 changes: 15 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
{
"type": "npm",
"script": "dev",
"group": {"kind": "build", "isDefault": true},
"problemMatcher": ["$tsc-watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$tsc-watch"
],
"label": "npm: dev",
"detail": "npm run dev",
"isBackground": true
},
{
"type": "npm",
"script": "typedoc",
"problemMatcher": [],
"label": "npm: typedoc",
"detail": "typedoc --logLevel Verbose",
"group": "build"
}
]
}
46 changes: 28 additions & 18 deletions .wallaby.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@
module.exports = (wallaby) => {
return {
compilers: {
'**/*.js': wallaby.compilers.babel(),
'**/*.js': wallaby.compilers.typeScript({
allowJs: true,
allowSyntheticDefaultImports: true,
resolveJsonModule: true,
isolatedModules: true,
}),
'**/*.ts?(x)': wallaby.compilers.typeScript(),
},
debug: true,
env: {
type: 'node',
},
files: [
'./packages/**/*.js',
'./packages/**/*.json',
'!./packages/**/build/**',
'!./packages/**/test/**/*-specs.js',
'!./packages/**/test/**/*.spec.js',
'!./packages/*/node_modules/**',
'!./packages/*/gulpfile.js',
'!./packages/*/scripts/**',
'./packages/*/test/**/fixtures/**/*',
'./babel.config.json',
// below this are fixtures
'./packages/*/build/**/*',
'./packages/*/lib/**/*.(j|t)s',
'./packages/*/test/**/*helper*.(j|t)s',
'./packages/*/test/**/*mock*.(j|t)s',
'./packages/*/package.json',
'./packages/*/tsconfig.json',
'./config/**/*.json',
'./packages/*/test/**/fixture?(s)/**/*',
{
instrument: false,
pattern: './packages/typedoc-plugin-appium/resources/**/*',
},
{
binary: true,
pattern: './packages/support/test/unit/assets/sample_binary.plist',
Expand All @@ -33,17 +40,17 @@ module.exports = (wallaby) => {
instrument: false,
pattern: './packages/base-driver/static/**/*',
},
'!./packages/*/test/**/*-specs.js',
'!./packages/*/test/**/*.e2e.spec.(j|t)s',
'!**/local_appium_home/**',
],
testFramework: 'mocha',
tests: ['./packages/*/test/unit/**/*.spec.js', '!**/local_appium_home/**'],
tests: ['./packages/*/test/unit/**/*.spec.(j|t)s', '!**/local_appium_home/**'],
workers: {
restart: true,
// restart: true,
},
setup() {
// This copied out of `./test/setup.js`, which uses `@babel/register`.
// Wallaby doesn't need `@babel/register` (and it probably makes Wallaby slow),
// but we need the other stuff, so here it is.
setup(wallaby) {
// copied out of `./test/setup.js`

const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
Expand All @@ -55,6 +62,9 @@ module.exports = (wallaby) => {

// `should()` is only necessary when working with some `null` or `undefined` values.
global.should = chai.should();

const mocha = wallaby.testFramework;
mocha.timeout(10000);
},
runMode: 'onsave',
};
Expand Down
20 changes: 18 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/appium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
},
"gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72",
"typedoc": {
"entryPoint": "./build/lib/main.js"
"entryPoint": "./lib/main.js"
}
}
1 change: 1 addition & 0 deletions packages/base-driver/lib/basedriver/commands/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function SessionMixin(Base) {
}

/**
* Returns capabilities for the session and event history (if applicable)
* @returns {Promise<SingularSessionData>}
*/
async getSession() {
Expand Down
2 changes: 1 addition & 1 deletion packages/base-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
},
"gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72",
"typedoc": {
"entryPoint": "./build/lib/index.js"
"entryPoint": "./lib/index.js"
}
}
24 changes: 12 additions & 12 deletions packages/base-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
"name": "@appium/base-plugin",
"version": "2.0.1",
"description": "The base plugin used to create Appium 2.0 plugins",
"keywords": [
"automation",
"javascript",
"selenium",
"webdriver",
"ios",
"android",
"firefoxos",
"testing"
],
"homepage": "https://appium.io",
"bugs": {
"url": "https://github.com/appium/appium/issues"
Expand Down Expand Up @@ -39,16 +49,6 @@
"appium"
],
"typedoc": {
"entryPoint": "./build/lib/plugin.js"
},
"keywords": [
"automation",
"javascript",
"selenium",
"webdriver",
"ios",
"android",
"firefoxos",
"testing"
]
"entryPoint": "./lib/plugin.js"
}
}
5 changes: 2 additions & 3 deletions packages/fake-driver/lib/commands/contexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export function ContextsMixin(Base) {
}
}

/**
* Get the current appium context
*
// do not add a description to this method's docstring
/*
* @returns {Promise<string>}
*/
async getCurrentContext() {
Expand Down
4 changes: 4 additions & 0 deletions packages/fake-driver/lib/commands/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export function ElementMixin(Base) {
await this.setValue('', elementId);
}

/**
* This comment should be displayed instead of the one from ExternalDriver
* @param {string} elementId
*/
async click(elementId) {
this.assertNoAlert();
let el = this.getElement(elementId);
Expand Down
5 changes: 5 additions & 0 deletions packages/fake-driver/lib/commands/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export function FindMixin(Base) {
return /** @type {Mult extends true ? Element[] : Element} */ (retval);
}

/**
* This should override whatever's in ExternalDriver
* @param {string} strategy Strategy
* @param {string} selector Selector
*/
async findElement(strategy, selector) {
return this.findElOrEls(strategy, selector, false);
}
Expand Down
1 change: 0 additions & 1 deletion packages/fake-driver/lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {GeneralMixin} from './general';
/**
*
* @param {import('@appium/types').Class<import('../driver').FakeDriverCore>} Base
* @returns
*/
export function FakeDriverMixin(Base) {
return GeneralMixin(FindMixin(ElementMixin(AlertMixin(ContextsMixin(Base)))));
Expand Down
31 changes: 16 additions & 15 deletions packages/fake-driver/lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,26 @@ export class FakeDriverCore extends BaseDriver {
}

/**
*
* @param {W3CFakeDriverCaps} jsonwpDesiredCapabilities
* @param {W3CFakeDriverCaps} [jsonwpRequiredCaps]
* @param {W3CFakeDriverCaps} [w3cCapabilities]
* @param {import('@appium/types').DriverData[]} [otherSessionData]
* @returns {Promise<[string,FakeDriverCaps]>}
* Comment for `createSession` in `FakeDriver`
* @param {W3CFakeDriverCaps} w3cCapabilities1 W3C Capabilities
* @param {W3CFakeDriverCaps} [w3cCapabilities2] W3C Capabilities
* @param {W3CFakeDriverCaps} [w3cCapabilities3] W3C Capabilities
* @param {import('@appium/types').DriverData[]} [driverData] Other session data
* @override
* @returns {Promise<[string,FakeDriverCaps]>} Session ID and normalized capabilities
*/
async createSession(
jsonwpDesiredCapabilities,
jsonwpRequiredCaps,
w3cCapabilities,
otherSessionData = []
w3cCapabilities1,
w3cCapabilities2,
w3cCapabilities3,
driverData = []
) {
// TODO add validation on caps.app that we will get for free from
// BaseDriver

// check to see if any other sessions have set uniqueApp. If so, emulate
// not being able to start a session because of system resources
for (let d of otherSessionData) {
for (let d of driverData) {
if (d.isUnique) {
throw new errors.SessionNotCreatedError(
'Cannot start session; another ' +
Expand All @@ -94,10 +95,10 @@ export class FakeDriverCore extends BaseDriver {

let [sessionId, caps] = /** @type {[string, FakeDriverCaps]} */ (
await super.createSession(
jsonwpDesiredCapabilities,
jsonwpRequiredCaps,
w3cCapabilities,
otherSessionData
w3cCapabilities1,
w3cCapabilities2,
w3cCapabilities3,
driverData
)
);
this.caps = caps;
Expand Down
5 changes: 5 additions & 0 deletions packages/fake-driver/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ async function main() {
}

export {FakeDriver, startServer, main};

/**
* @typedef {import('./types').W3CFakeDriverCaps} W3CFakeDriverCaps
* @typedef {import('./types').FakeDriverCaps} FakeDriverCaps
*/
2 changes: 1 addition & 1 deletion packages/fake-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
},
"typedoc": {
"entryPoint": "./build/lib/index.js"
"entryPoint": "./lib/index.js"
},
"types": "./build/lib/index.d.ts",
"gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72"
Expand Down
24 changes: 13 additions & 11 deletions packages/fake-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
"name": "@appium/fake-plugin",
"version": "3.0.1",
"description": "A fake Appium 2.0 plugin",
"keywords": [
"automation",
"javascript",
"selenium",
"webdriver",
"ios",
"android",
"firefoxos",
"testing"
],
"homepage": "https://appium.io",
"bugs": {
"url": "https://github.com/appium/appium/issues"
Expand All @@ -13,7 +23,6 @@
},
"license": "Apache-2.0",
"author": "https://github.com/appium",
"main": "./build/index.js",
"directories": {
"lib": "./lib"
},
Expand Down Expand Up @@ -54,14 +63,7 @@
"tags": [
"appium"
],
"keywords": [
"automation",
"javascript",
"selenium",
"webdriver",
"ios",
"android",
"firefoxos",
"testing"
]
"typedoc": {
"entryPoint": "./lib/plugin.js"
}
}
2 changes: 1 addition & 1 deletion packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"access": "public"
},
"typedoc": {
"entryPoint": "./build/index.js"
"entryPoint": "./lib/index.js"
},
"gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72"
}
2 changes: 1 addition & 1 deletion packages/support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
"gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72",
"typedoc": {
"entryPoint": "./build/lib/index.js"
"entryPoint": "./lib/index.js"
},
"overrides": {
"jpeg-js": "0.4.4"
Expand Down