|
1 | | -[](https://github.com/ddev/ddev-addon-template/actions/workflows/tests.yml)  |
| 1 | +[](https://github.com/discoverygarden/ddev-dgi-playwright/actions/workflows/tests.yml)  |
2 | 2 |
|
3 | | -# DDEV add-on template <!-- omit in toc --> |
| 3 | +# DGI-PLAYWRIGHT |
4 | 4 |
|
5 | | -* [What is DDEV add-on template?](#what-is-ddev-add-on-template) |
6 | | -* [Components of the repository](#components-of-the-repository) |
7 | | -* [Getting started](#getting-started) |
8 | | -* [How to debug in Github Actions](./README_DEBUG.md) |
| 5 | +Playwright integration for DGI projects, adapted from and using [Lullabot/ddev-playwright](https://github.com/Lullabot/ddev-playwright). |
9 | 6 |
|
10 | | -## What is DDEV add-on template? |
| 7 | +## Enable |
11 | 8 |
|
12 | | -This repository is a template for providing [DDEV](https://ddev.readthedocs.io) add-ons and services. |
| 9 | +Setup process should be straight forward. Download add-on, run install script, and tests will be immediately accessible to run: |
13 | 10 |
|
14 | | -In DDEV, add-ons can be installed from the command line using the `ddev add-on get` command, for example, `ddev add-on get ddev/ddev-redis` or `ddev add-on get ddev/ddev-solr`. |
| 11 | +``` |
| 12 | +# Installs the add-on |
| 13 | +ddev add-on get discoverygarden/ddev-dgi-playwright |
15 | 14 |
|
16 | | -This repository is a quick way to get started. You can create a new repo from this one by clicking the template button in the top right corner of the page. |
| 15 | +# Installs playwright with dgi additions |
| 16 | +ddev install-dgi-playwright |
| 17 | +``` |
17 | 18 |
|
18 | | - |
| 19 | +## Use playwright |
19 | 20 |
|
20 | | -## Components of the repository |
| 21 | +``` |
| 22 | +# Runs playwright using playwrights `test` command. |
| 23 | +ddev playwright test |
21 | 24 |
|
22 | | -* The fundamental contents of the add-on service or other component. For example, in this template there is a [docker-compose.addon-template.yaml](docker-compose.addon-template.yaml) file. |
23 | | -* An [install.yaml](install.yaml) file that describes how to install the service or other component. |
24 | | -* A test suite in [test.bats](tests/test.bats) that makes sure the service continues to work as expected. |
25 | | -* [Github actions setup](.github/workflows/tests.yml) so that the tests run automatically when you push to the repository. |
| 25 | +# Runs playwright with access to the UI accessible at <siteuri>:9324 |
| 26 | +ddev playwright-ui |
26 | 27 |
|
27 | | -## Getting started |
| 28 | +## Runs playwright in codegen mode |
| 29 | +ddev playwright codegen |
| 30 | +``` |
28 | 31 |
|
29 | | -1. Choose a good descriptive name for your add-on. It should probably start with "ddev-" and include the basic service or functionality. If it's particular to a specific CMS, perhaps `ddev-<CMS>-servicename`. |
30 | | -2. Create the new template repository by using the template button. |
31 | | -3. Globally replace "addon-template" with the name of your add-on. |
32 | | -4. Add the files that need to be added to a DDEV project to the repository. For example, you might replace `docker-compose.addon-template.yaml` with the `docker-compose.*.yaml` for your recipe. |
33 | | -5. Update the `install.yaml` to give the necessary instructions for installing the add-on: |
| 32 | +## Composer Package Type Details |
34 | 33 |
|
35 | | - * The fundamental line is the `project_files` directive, a list of files to be copied from this repo into the project `.ddev` directory. |
36 | | - * You can optionally add files to the `global_files` directive as well, which will cause files to be placed in the global `.ddev` directory, `~/.ddev`. |
37 | | - * Finally, `pre_install_commands` and `post_install_commands` are supported. These can use the host-side environment variables documented [in DDEV docs](https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/#environment-variables-provided). |
| 34 | +We define and make use of two "types" of composer project: |
| 35 | +* `dgi-playwright-core`: Defining the core Playwright config, including `playwright.config.ts` and including `package.json`/`package-lock.json` indicating the Node.js packages needed; and, |
| 36 | +* `dgi-playwright-tests`: Defining a set of tests to run. |
38 | 37 |
|
39 | | -6. Update `tests/test.bats` to provide a reasonable test for your repository. Tests will run automatically on every push to the repository, and periodically each night. Please make sure to address test failures when they happen. Others will be depending on you. Bats is a testing framework that just uses Bash. To run a Bats test locally, you have to install [bats-core](https://bats-core.readthedocs.io/en/stable/installation.html) and its [libraries](https://github.com/ztombol/bats-docs) first. Then you download your add-on, and finally run `bats ./tests/test.bats` within the root of the uncompressed directory. To learn more about Bats see the [documentation](https://bats-core.readthedocs.io/en/stable/). |
40 | | -7. When everything is working, including the tests, you can push the repository to GitHub. |
41 | | -8. Create a [release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) on GitHub. |
42 | | -9. Test manually with `ddev add-on get <owner/repo>`. |
43 | | -10. You can test PRs with `ddev add-on get https://github.com/<user>/<repo>/tarball/<branch>`. |
44 | | -11. You can test add-ons locally without GitHub by downloading them, making changes and running `ddev add-on get /path/to/add-on-directory`. |
45 | | -12. Update the `README.md` header, adding the machine name of the add-on, for example `# ddev-redis`, not `# DDEV Redis`. |
46 | | -13. Update the `README.md` to describe the add-on, how to use it, and how to contribute. If there are any manual actions that have to be taken, please explain them. If it requires special configuration of the using project, please explain how to do those. Examples in [ddev/ddev-solr](https://github.com/ddev/ddev-solr), [ddev/ddev-memcached](https://github.com/ddev/ddev-memcached), and (advanced) [ddev-platformsh](https://github.com/ddev/ddev-platformsh). |
47 | | -14. Add a good short description to your repo, and add the [topic](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics) "ddev-get". It will immediately be added to the list provided by `ddev add-on list --all`. |
48 | | -15. When it has matured you will hopefully want to have it become an "official" maintained add-on. Open an issue in the [DDEV queue](https://github.com/ddev/ddev/issues) for that. |
| 38 | +We expect only one `dgi-playwright-core` package to be installed in a project (into `test/playwright`), and any number of `dgi-playwright-tests` packages (which should get installed into `test/playwright-tests/{$name}`, where `{$name}` is the name of the package without its namespace, as per [`composer/installers`](https://github.com/composer/installers)). |
49 | 39 |
|
50 | | -Add-ons were covered in [DDEV Add-ons: Creating, maintaining, testing](https://www.youtube.com/watch?v=TmXqQe48iqE) (part of the [DDEV Contributor Live Training](https://ddev.com/blog/contributor-training)). |
| 40 | +## Additional Resources |
51 | 41 |
|
52 | | -Note that more advanced techniques are discussed in [Advanced Add-On Techniques](https://ddev.com/blog/advanced-add-on-contributor-training/) and [DDEV docs](https://ddev.readthedocs.io/en/stable/users/extend/additional-services/). |
53 | | - |
54 | | -**Contributed and maintained by `@CONTRIBUTOR`** |
| 42 | +* [Playwright basic usage docs](https://playwright.dev/docs/intro) |
| 43 | +* [Lullabot/ddev-playwright](https://github.com/Lullabot/ddev-playwright) |
0 commit comments