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

chore: hermione -> testplane #32

Merged
merged 2 commits into from
Apr 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 gemini-testing
Copyright (c) 2022 YANDEX LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# create-hermione-app
# create-testplane

Use the `create-hermione-app` tool to automatically create configured [hermione](https://github.com/gemini-testing/hermione) app.
Use the `create-testplane` tool to automatically create configured [Testplane](https://github.com/gemini-testing/testplane) app.

See full documentation in various languages here:
* [English](./docs/en/create-hermione-app.md)
* [Русский](./docs/ru/create-hermione-app.md)
* [English](./docs/en/create-testplane.md)
* [Русский](./docs/ru/create-testplane.md)
2 changes: 1 addition & 1 deletion __fixtures/config/jsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
sets: {
desktop: {
files: [
'hermione-tests/**/*.hermione.(t|j)s'
'testplane-tests/**/*.testplane.(t|j)s'
],
browsers: [
'chrome'
Expand Down
2 changes: 1 addition & 1 deletion __fixtures/config/withComments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
// other comment
array: [
// array comment
'some stirng',
'some string',
// another comment
]
};
4 changes: 2 additions & 2 deletions __fixtures/config/withEverything.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
sets: {
desktop: {
files: [
"hermione-tests/**/*.hermione.(t|j)s"
"testplane-tests/**/*.testplane.(t|j)s"
],
browsers: [
"chrome"
Expand All @@ -30,7 +30,7 @@ export default {
}
},
plugins: {
"hermione-oauth": {
"@testplane/oauth": {
// some info
enabled: isCi,
token: path.join(os.homedir(), ".config", "tokens", "token")
Expand Down
104 changes: 52 additions & 52 deletions docs/en/create-hermione-app.md → docs/en/create-testplane.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# create-hermione-app
# create-testplane

Use `create-hermione-app` to set up [hermione](https://github.com/gemini-testing/hermione) quickly and conveniently both in a new and in an existing project.
Use `create-testplane` to set up [testplane](https://github.com/gemini-testing/testplane) quickly and conveniently both in a new and in an existing project.

## Usage

```bash
npm init hermione-app my-app
npm init testplane my-app
```

<img src="../assets/usage.gif"/>
Expand All @@ -19,54 +19,54 @@ If you already have a project at given path, the tool will try to guess used pac
You can add `-y` or `--yes` argument to launch a tool in *no-questions* mode:

```bash
npm init hermione-app my-app -- -y
npm init testplane my-app -- -y
```

In this mode you won't be asked questions about desired plugins and packet manager.

Default packet manager, used with `--yes` argument: `npm`

Default plugins, installed with `--yes` argument:
Default plugins, installed with `--yes` argument:
- [html-reporter](https://github.com/gemini-testing/html-reporter)

### Lang

By default, create-hermione-app sets up project with typescript tests support.
By default, create-testplane sets up project with typescript tests support.

You can opt-out of typescript by adding `--lang js` argument:

```bash
npm init hermione-app my-app -- --lang js
npm init testplane my-app -- --lang js
```

## List of proposed plugins

- [Global Hook](https://github.com/gemini-testing/hermione-global-hook) - To add global 'beforeEach' and 'afterEach' functions
- [Plugins Profiler](https://github.com/gemini-testing/hermione-plugins-profiler) - To profile plugins performance
- [Retry Progressive](https://github.com/gemini-testing/hermione-retry-progressive) - To add extra retry if test fails due to infrastructure reasons
- [Test Filter](https://github.com/gemini-testing/hermione-test-filter) - To run only specified tests in provided browsers
- [Retry Limiter](https://github.com/gemini-testing/retry-limiter) - To limit retries and duration threshold
- [Headless Chrome](https://github.com/gemini-testing/hermione-headless-chrome) - To add and install headless chrome browser
- [Profiler](https://github.com/gemini-testing/hermione-profiler) - To generate report about executed commands and their performance
- [Safari Commands](https://github.com/gemini-testing/hermione-safari-commands) - To add compatibility for safari mobile
- [Test Repeater](https://github.com/gemini-testing/hermione-test-repeater) - To repeat tests the specified number of times regardless of the result
- [Url Decorator](https://github.com/gemini-testing/url-decorator) - To add/replace url query params
- [Storybook](https://github.com/gemini-testing/hermione-storybook) - To add ability to write hermione tests on storybook component and speed up their execution
- [Global Hook](https://github.com/gemini-testing/testplane-global-hook) - To add global 'beforeEach' and 'afterEach' functions
- [Plugins Profiler](https://github.com/gemini-testing/testplane-plugins-profiler) - To profile plugins performance
- [Retry Progressive](https://github.com/gemini-testing/testplane-retry-progressive) - To add extra retry if test fails due to infrastructure reasons
- [Test Filter](https://github.com/gemini-testing/testplane-test-filter) - To run only specified tests in provided browsers
- [Retry Limiter](https://github.com/gemini-testing/testplane-retry-limiter) - To limit retries and duration threshold
- [Headless Chrome](https://github.com/gemini-testing/testplane-headless-chrome) - To add and install headless chrome browser
- [Profiler](https://github.com/gemini-testing/testplane-profiler) - To generate report about executed commands and their performance
- [Safari Commands](https://github.com/gemini-testing/testplane-safari-commands) - To add compatibility for safari mobile
- [Test Repeater](https://github.com/gemini-testing/testplane-test-repeater) - To repeat tests the specified number of times regardless of the result
- [Url Decorator](https://github.com/gemini-testing/testplane-url-decorator) - To add/replace url query params
- [Storybook](https://github.com/gemini-testing/testplane-storybook) - To add ability to write testplane tests on storybook component and speed up their execution
- [Html Reporter](https://github.com/gemini-testing/html-reporter) - To generate html-reports for showing passed/failed tests, screenshot diffs, error messages, stacktraces, meta-info and so on
- [Oauth](https://github.com/gemini-testing/hermione-oauth) - To set authorization header with OAuth token
- [Retry Command](https://github.com/gemini-testing/hermione-retry-command) - To retry assertView on comparison fail
- [Tabs Closer](https://github.com/gemini-testing/hermione-tabs-closer) - To close opened tabs from previous tests so the browser coudn't degrade
- [Oauth](https://github.com/gemini-testing/testplane-oauth) - To set authorization header with OAuth token
- [Retry Command](https://github.com/gemini-testing/testplane-retry-command) - To retry assertView on comparison fail
- [Tabs Closer](https://github.com/gemini-testing/testplane-tabs-closer) - To close opened tabs from previous tests so the browser coudn't degrade

## Customizing the tool

You can create your own node-js script based on `create-hermione-app` to deploy the configuration.
You can create your own Node.js script based on `create-testplane` to deploy the configuration.

This may be necessary, for example, if you have internal hermione plugins distributed for projects within the company.
This may be necessary, for example, if you have internal testplane plugins distributed for projects within the company.

```ts
import createHermioneApp from "create-hermione-app";
import createTestplane from "create-testplane";

createHermioneApp.run({
createTestplane.run({
createOpts,
createBaseConfig,
generalPrompts,
Expand All @@ -78,7 +78,7 @@ createHermioneApp.run({
});
```

*Note: you are only allowed to put serializable data to hermioneConfig*.
*Note: you are only allowed to put serializable data to testplaneConfig*.

### Parameters

Expand All @@ -89,7 +89,7 @@ createHermioneApp.run({
Default tool's CLI handles given path and `--yes` argument. In this callback you need to at least specify `path` and `noQuestions` values:

```ts
import type { DefaultOpts } from "create-hermione-app";
import type { DefaultOpts } from "create-testplane";

const argvOpts = {
path: ".",
Expand All @@ -107,12 +107,12 @@ You can also change `defaultOpts`. Currently it has `pluginGroups` key to define

#### createBaseConfig

The tool creates a base hermione config, and then mutates it. You can change this base config:
The tool creates a base testplane config, and then mutates it. You can change this base config:

```ts
import type { HermioneConfig, CreateBaseConfigOpts } from "create-hermione-app";
import type { testplaneConfig, CreateBaseConfigOpts } from "create-testplane";

const createBaseConfig = (baseConfig: HermioneConfig, opts: CreateBaseConfigOpts) => {
const createBaseConfig = (baseConfig: TestplaneConfig, opts: CreateBaseConfigOpts) => {
baseConfig.takeScreenshotOnFails = {
testFail: true,
assertViewFail: false
Expand All @@ -124,10 +124,10 @@ const createBaseConfig = (baseConfig: HermioneConfig, opts: CreateBaseConfigOpts

#### generalPrompts

You can remove, add custom questions, handle user answers to mutate `hermioneConfig`
You can remove, add custom questions, handle user answers to mutate `testplaneConfig`

```ts
import type { GeneralPrompt, HandleGeneralPromptsCallback, baseGeneralPrompts } from "create-hermione-app";
import type { GeneralPrompt, HandleGeneralPromptsCallback, baseGeneralPrompts } from "create-testplane";

const promptRetries: GeneralPrompt = {
type: "number",
Expand All @@ -145,33 +145,33 @@ const promptIgnoreFiles: GeneralPrompt = {

const generalPrompts = [...baseGeneralPrompts, promptRetries, promptIgnoreFiles];

const generalPromptsHandler: HandleGeneralPromptsCallback = (hermioneConfig, answers) => {
const generalPromptsHandler: HandleGeneralPromptsCallback = (testplaneConfig, answers) => {
answers.retry = answers.retryCount;

if (answers.ignoreFiles) {
const sets = Object.values(hermioneConfig.sets || {});
const sets = Object.values(testplaneConfig.sets || {});
for (const testSet of sets) {
testSet.ignoreFiles = testSet.ignoreFiles || [];
testSet.ignoreFiles.push(answers.ignoreFiles);
}
}

return hermioneConfig;
return testplaneConfig;
};
```

If `GeneralPrompt` does not have `default` value, the question will be asked even with `noQuestions: true`

#### createPluginsConfig

You can also change how enabling plugins affects the `.hermione.conf.js` file
You can also change how enabling plugins affects the `.testplane.conf.js` file

```ts
import type { CreatePluginsConfigCallback } from "create-hermione-app";
import type { CreatePluginsConfigCallback } from "create-testplane";

const createPluginsConfig: CreatePluginsConfigCallback = (pluginsConfig) => {
pluginsConfig["hermione-retry-progressive"] = (hermioneConfig) => {
hermioneConfig.plugins!["hermione-retry-progressive"] = {
pluginsConfig["testplane-retry-progressive"] = (testplaneConfig) => {
testplaneConfig.plugins!["testplane-retry-progressive"] = {
enabled: true,
extraRetry: 7,
errorPatterns: [
Expand All @@ -193,19 +193,19 @@ const createPluginsConfig: CreatePluginsConfigCallback = (pluginsConfig) => {
You can also define registry, which will be used to install packages

```ts
import createHermioneApp from "create-hermione-app";
import createTestplane from "create-testplane";

createHermioneApp.run({
createTestplane.run({
registry: "https://registry.npmjs.org", // default value
});
```

#### getExtraPackagesToInstall

You can also pass extra packages, which will be installed with `hermione` unconditionally
You can also pass extra packages, which will be installed with `testplane` unconditionally

```ts
import type { GetExtraPackagesToInstallCallback } from "create-hermione-app";
import type { GetExtraPackagesToInstallCallback } from "create-testplane";

const getExtraPackagesToInstall: GetExtraPackagesToInstallCallback = () => ({
names: ["chai"],
Expand All @@ -222,19 +222,19 @@ import type {
DefaultOpts,
GeneralPrompt,
PluginPrompt
} from "create-hermione-app";
} from "create-testplane";

const createOpts = (defaultOpts: DefaultOpts) => {
const customPluginPrompt: PluginPrompt = {
// Plugin name. The tool will try to download this with picked package manager
// Suffixes "/plugin" and "/hermione" will be removed on downloading
// Suffixes "/plugin" and "/testplane" will be removed on downloading
plugin: "my-custom-plugin-name",
// Plugin description
description: "Adds some custom feature",
// Should it be installed in "no question" mode
default: false,
// If the plugin requires additional configuration. Optional
configNote: "Specify something in hermione config"
configNote: "Specify something in testplane config"
};

defaultOpts.pluginGroups.push({
Expand All @@ -250,19 +250,19 @@ const createOpts = (defaultOpts: DefaultOpts) => {
};
```

Then you need to define, how including your plugin will affect the `.hermione.conf.js` file
Then you need to define, how including your plugin will affect the `.testplane.conf.js` file

```ts
import type { CreatePluginsConfigCallback } from "create-hermione-app";
import type { CreatePluginsConfigCallback } from "create-testplane";

const createPluginsConfig: CreatePluginsConfigCallback = (pluginsConfig) => {
pluginsConfig["my-custom-plugin-name"] = (hermioneConfig) => {
pluginsConfig["my-custom-plugin-name"] = (testplaneConfig) => {
// Usualy you would want to describe your plugin's default config
hermioneConfig.plugins!["my-custom-plugin-name"] = {
testplaneConfig.plugins!["my-custom-plugin-name"] = {
enabled: true,
};
// But you can also do anything else with hermioneConfig
hermioneConfig.browsers["my-custom-browser"] = {
// But you can also do anything else with testplaneConfig
testplaneConfig.browsers["my-custom-browser"] = {
desiredCapabilities: {
browserName: "browserName"
}
Expand Down
Loading
Loading