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

Auto docs test #29

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ npm-debug.log*
*storybook.log
storybook-static
tmp
.testplane
!exports
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@ nvm use
npm ci
```

### Generate testplane API specification

#### Clone testplane repo
```shell
npm run clone-testplane
```
Env variables:
- `USE_LOCAL` - `true` means copy local testplane repo, `false` - clone remote, default: `false`
- `LOCAL_REPO_DIR` - path to local repo (used when `USE_LOCAL` is `true`)
- `REPO_PATH` - remote repo url (used when `USE_LOCAL` is `false`)

This command clones testplane to .testplane

#### Generate Russian localization template
```shell
npm run docs:generate:template
```

It will generate a Russian localization template at `./exports` that can be edited. There is a problem that it does not seem to accept config args, it looks like it is not gonna work with docusaurus plugin. Now the only way seems to be this:
```shell
npm run docs:generate:ru
```
English Docs are autogenerated using [`docusaurus-plugin-typedoc`](https://typedoc-plugin-markdown.org/plugins/docusaurus).

#### About API specification generator

API specification docs are generated using [TypeDoc](https://typedoc.org/) with 3 plugins:
- [`typedoc-plugin-rename-defaults`](https://github.com/felipecrs/typedoc-plugin-rename-defaults) renames default exports back to their original names
- [`typedoc-plugin-localization`](https://github.com/IgniteUI/typedoc-plugin-localization) adds Russian localization
- [`typedoc-plugin-markdown`](https://typedoc-plugin-markdown.org/docs) enables markdown generation

Notes:
- The docs are generated for all types, classes and interfaces exported from `testplane/src/index.ts`
- To remove type/class/interface from docs, write @internal in the description like this:
```ts
/**
* @internal
*/
export type SomeInternalType = {
id: number
}
```

### Run local dev server

```shell
Expand Down
30 changes: 30 additions & 0 deletions clone-testplane.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');

const LOCAL = process.env.USE_LOCAL ?? false;
const LOCAL_REPO_DIR = process.env.LOCAL_REPO_DIR;
const REPO_PATH = process.env.REPO_PATH ?? "https://github.com/gemini-testing/testplane";

const tempDir = path.join(__dirname, '.testplane');

if (fs.existsSync(tempDir)) {
fs.rmSync(tempDir, { recursive: true });
}

if (LOCAL) {
// Create a symlink to the local repo
execSync(`cp -r ${LOCAL_REPO_DIR}/. ${tempDir}`);
console.log(`Copied local testplane repo from ${LOCAL_REPO_DIR} to ${tempDir}`);
} else {
fs.mkdirSync(tempDir);

// Clone repo to temp
execSync(`git clone ${REPO_PATH} ${tempDir}`);
process.chdir(tempDir);

// Run npm ci to install dependencies
execSync('npm ci', { stdio: 'inherit' });

console.log(`Cloned remote testplane repo to ${tempDir}`);
}
45 changes: 45 additions & 0 deletions docs/api/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# testplane

## Классы

- [Config](classes/Config.mdx)
- [Suite](classes/Suite.mdx)
- [Test](classes/Test.mdx)
- [TestCollection](classes/TestCollection.mdx)
- [Testplane](classes/Testplane.mdx)

## Интерфейсы

- [AssertViewOpts](interfaces/AssertViewOpts.mdx)
- [AssertViewOptsConfig](interfaces/AssertViewOptsConfig.mdx)
- [BrowserHistory](interfaces/BrowserHistory.mdx)
- [BrowserInfo](interfaces/BrowserInfo.mdx)
- [BuildDiffOptsConfig](interfaces/BuildDiffOptsConfig.mdx)
- [CommonConfig](interfaces/CommonConfig.mdx)
- [CompareOptsConfig](interfaces/CompareOptsConfig.mdx)
- [ExpectOptsConfig](interfaces/ExpectOptsConfig.mdx)
- [GlobalHelper](interfaces/GlobalHelper.mdx)
- [HermioneCtx](interfaces/HermioneCtx.mdx)
- [ImageInfo](interfaces/ImageInfo.mdx)
- [ImageSize](interfaces/ImageSize.mdx)
- [InterceptData](interfaces/InterceptData.mdx)
- [MochaOpts](interfaces/MochaOpts.mdx)
- [ReadTestsOpts](interfaces/ReadTestsOpts.mdx)
- [RefImageInfo](interfaces/RefImageInfo.mdx)
- [RunOpts](interfaces/RunOpts.mdx)
- [RuntimeConfig](interfaces/RuntimeConfig.mdx)
- [SetsConfig](interfaces/SetsConfig.mdx)
- [SetsConfigParsed](interfaces/SetsConfigParsed.mdx)
- [SystemConfig](interfaces/SystemConfig.mdx)
- [TestError](interfaces/TestError.mdx)
- [TestFunctionCtx](interfaces/TestFunctionCtx.mdx)
- [TestResult](interfaces/TestResult.mdx)
- [TestplaneCtx](interfaces/TestplaneCtx.mdx)

## Type Aliases

- [AssertViewResult](type-aliases/AssertViewResult.mdx)
- [AsyncSessionEventCallback](type-aliases/AsyncSessionEventCallback.mdx)
- [ConfigInput](type-aliases/ConfigInput.mdx)
- [InterceptHandler](type-aliases/InterceptHandler.mdx)
- [InterceptedEvent](type-aliases/InterceptedEvent.mdx)
293 changes: 293 additions & 0 deletions docs/api/classes/Config.mdx

Large diffs are not rendered by default.

Loading
Loading