# Using a Plug-in

Concordia Compiler uses plug-ins for:

1. setting the testing environment up;
2. generating and executing test scripts;
3. converting and reporting test results.

Every plug-in can generate test scripts for a different testing framework or programming language.

## **Plug-ins**

| Name (concordialang-...)                                                                   | Target platform       | Needs Java?    | RTS\* |
| ------------------------------------------------------------------------------------------ | --------------------- | -------------- | ----- |
| [codeceptjs-testcafe](https://github.com/thiagodp/concordialang-codeceptjs-testcafe)       | web                   | No             | No    |
| [codeceptjs-playwright](https://github.com/thiagodp/concordialang-codeceptjs-playwright)   | web                   | No             | No    |
| [codeceptjs-webdriverio](https://github.com/thiagodp/concordialang-codeceptjs-webdriverio) | web                   | Yes, Java 8+   | Yes   |
| [codeceptjs-appium](https://github.com/thiagodp/concordialang-codeceptjs-appium)           | Android, iOS, Windows | It depends\*\* | Yes   |

**Notes**:

* (\*) RTS means "Requires a [Testing Server](#starting-a-testing-server)", that is, if it requires a testing server to run the test scripts (e.g., Selenium Standalone).
* (\*\*) Appium requires Java for testing web-based mobile applications or using  the Android SDK.
* `codeceptjs-testcafe` uses the frameworks [CodeceptJS](http://codecept.io) and [TestCafé](https://devexpress.github.io/testcafe), and works with probably any browser.
* `codeceptjs-playwright` uses the frameworks [CodeceptJS](http://codecept.io) and [Playwright](https://github.com/microsoft/playwright),&#x20;

  requires Node 10.14 or above, and works with Chromium, Firefox, and Safari.
* `codeceptjs-webdriverio` uses the frameworks [CodeceptJS](http://codecept.io) and [WebDriverIO](http://webdriver.io), and works with Chrome, Firefox, IE, and Edge.
* `codeceptjs-appium` uses the frameworks [CodeceptJS](http://codecept.io) and [Appium](http://appium.io), and requires some [additional configuration](https://github.com/thiagodp/concordialang-codeceptjs-appium#environment-setup) to work.
* `codeceptjs-testcafe` and `codeceptjs-playwright` are only available for Concordia Compiler 2 or above.

## Installation

Use `--plugin-install` plus the plug-in name. Example:

```bash
npx concordia --plugin-install codeceptjs-testcafe
```

{% hint style="info" %}
You can also use NPM for installing a plug-in. In this case, you **must** prefix the plug-in name wit&#x68;**`concordialang-`** . Example: `npm install -D concordialang-codeceptjs-testcafe`.
{% endhint %}

## Upgrade

Just uninstall the plug-in and then install it again. Example:

```bash
npx concordia --plugin-uninstall codeceptjs-playwright
npx concordia --plugin-install codeceptjs-playwright 
```

## How to use a plug-in

Concordia has the following plug-in commands:

* `plugin-install` to install a plug-in
* `plugin-uninstall`to uninstall a plug-in
* `plugin-serve` to start a testing server using the plug-in
* `plugin` to use a plug-in
* `plugin-info` to show information about a plug-in
* `plugin-list` to list installed plug-ins

All but the latter command (`plugin-list`) require a plug-in name.

👉 Whether you have a [configuration file](https://concordialang.gitbook.io/concordialang/introduction/configuration) with the property `plugin` defined, you can omit the plugin name from a command. Example:

{% tabs %}
{% tab title=".concordiarc" %}

```bash
{
  "plugin": "codeceptjs-playwright"
}

```

{% endtab %}
{% endtabs %}

## Commonly used commands

{% hint style="success" %}
You can omit the argument `<plugin>` if you have a configuration file with the property `"plugin"` defined.
{% endhint %}

### Starting a testing server

Some plug-ins (WebDriverIO, Appium) require a testing server to execute test scripts. A testing server controls a browser or an emulator during tests.

We recommend to open a new terminal/console and then start the testing server:

```
npx concordia --plugin-serve <plugin>
```

{% hint style="info" %}
Naturally, you must replace `<plugin>` with the plugin name.&#x20;
{% endhint %}

The testing server will remain open. To stop it **later**, type `Ctrl` + `C`.

### Generating and executing test scripts

{% hint style="info" %}
Whether your plug-in needs a testing server, start it beforehand.
{% endhint %}

```
npx concordia --plugin <plugin>
```

### Generating test scripts without executing them

You can use `--no-run` to *avoid running test scripts* and use `--no-result` to *avoid reading the last report with test results*. Test scripts will be generated but not executed.

```bash
npx concordia --plugin <plugin> --no-run --no-result
```

### Executing existing test scripts (without generating them)

You can use `--no-script` to *avoid generating test scripts*. Only existing test scripts will be executed.

```bash
npx concordia --plugin <plugin> --no-script
```

## See also

* [Configuration file](https://concordialang.gitbook.io/concordialang/introduction/configuration)
* [Commands for plug-ins](https://concordialang.gitbook.io/concordialang/cli#plug-in)
* [Creating a plug-in](https://concordialang.gitbook.io/concordialang/development/creating-a-plug-in)
