|
1 |
| -# percypress |
| 1 | +``` |
| 2 | + ________ ___ ___ ___ ___ _________ ___ ___ ___ _________ ___ _______ ________ |
| 3 | +|\ ___ \ |\ \ / /| |\ \|\ \|\___ ___\\ \|\ \ |\ \|\___ ___\\ \|\ ___ \ |\ ____\ |
| 4 | +\ \ \_|\ \ \ \ \/ / / \ \ \\\ \|___ \ \_\ \ \ \ \ \ \ \|___ \ \_\ \ \ \ \__/ | \ \___|_ |
| 5 | + \ \ \ \\ \ \ \ / / \ \ \\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_\ \ \_____ \ |
| 6 | + \ \ \_\\ \ / \/ \ \ \\\ \ \ \ \ \ \ \ \ \____\ \ \ \ \ \ \ \ \ \ \_/\ \|____|\ \ |
| 7 | + \ \_______\/ /\ \ \ \_______\ \ \__\ \ \__\ \_______\ \__\ \ \__\ \ \__\ \______\ ____\_\ \ |
| 8 | + \|_______/__/ /\ __\ \|_______| \|__| \|__|\|_______|\|__| \|__| \|__|\|_______|\_________\ |
| 9 | + |__|/ \|__| \|_________| |
| 10 | +``` |
| 11 | + |
| 12 | +[[_TOC_]] |
| 13 | + |
| 14 | +# 🧳 Introduction |
| 15 | + |
| 16 | +Insert description here. |
| 17 | + |
| 18 | +# 🛠 Installation |
| 19 | + |
| 20 | +## Current versions |
| 21 | + |
| 22 | +- **NVM:** _0.39.3_ |
| 23 | +- **Node:** _20.4.0_ |
| 24 | +- **NPM:** _9.7.2_ |
| 25 | + |
| 26 | +## Clone the repository |
| 27 | + |
| 28 | +```bash |
| 29 | + |
| 30 | +``` |
| 31 | + |
| 32 | +## Install Node Version Manager ([NVM](https://github.com/nvm-sh/nvm#about)) |
| 33 | + |
| 34 | +```bash |
| 35 | +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh |
| 36 | +``` |
| 37 | + |
| 38 | +- `nvm` allows the installation and use of different versions of Node, via the command line. |
| 39 | + |
| 40 | +## Install [Node](https://nodejs.org/en/about) |
| 41 | + |
| 42 | +First, navigate to the repo's root directory. |
| 43 | + |
| 44 | +```bash |
| 45 | +cd path/to/repo |
| 46 | +``` |
| 47 | + |
| 48 | +Then, install Node. |
| 49 | + |
| 50 | +```bash |
| 51 | +nvm install |
| 52 | +``` |
| 53 | + |
| 54 | +- Uses the version of Node that's specified in the `.nvmrc` file. |
| 55 | + |
| 56 | +## Install [dependencies](https://docs.npmjs.com/about-packages-and-modules) |
| 57 | + |
| 58 | +```bash |
| 59 | +npm ci |
| 60 | +``` |
| 61 | + |
| 62 | +- [`ci`](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable) stands for clean install, and is used to install exact versions of all dependencies from a `package-lock.json` file. |
| 63 | +- `npm i` (or `npm install`) is used to install all dependencies from a `package.json` file. |
| 64 | + |
| 65 | +# 👟 Commands |
| 66 | + |
| 67 | +## Run a project's tests |
| 68 | + |
| 69 | +```bash |
| 70 | +npm test -- project-name |
| 71 | +``` |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +- Insert description here. |
| 76 | + |
| 77 | +# 🗒 Notes |
| 78 | + |
| 79 | +## `.env` |
| 80 | + |
| 81 | +- A collection of environment variables that are used by Percy. |
| 82 | +- When setting up a new project of tests, add the associated Percy token to this file. |
| 83 | +- Ensure that the token name matches the project name, to avoid errors. |
| 84 | + - The difference between hyphens and underscores for spacing in the project name is handled dynamically. |
| 85 | + - Refer to the chart below, for proper naming. |
| 86 | + |
| 87 | +| | Project | Token | |
| 88 | +|-----------|----------------|----------------| |
| 89 | +| Correct | `project-name` | `PROJECT_NAME` | |
| 90 | +| Correct | `project_name` | `PROJECT_NAME` | |
| 91 | +| Correct | `projectname` | `PROJECTNAME` | |
| 92 | +| Correct | `pn` | `PN` | |
| 93 | +| Incorrect | `projectname` | `PROJECT_NAME` | |
| 94 | +| Incorrect | `projectname` | `PROJECT_NAME` | |
| 95 | +| Incorrect | `project` | `NAME` | |
| 96 | +| Incorrect | `pn` | `PROJECTNAME` | |
| 97 | + |
| 98 | + |
| 99 | +## `cypress.config.js` |
| 100 | + |
| 101 | +- The configuration file for Cypress that allows you to customize various settings and behaviors for your test suite. |
| 102 | +- For more information, refer to the [Cypress configuration documentation](https://docs.cypress.io/guides/references/configuration). |
| 103 | + |
| 104 | +## `cypress.js` |
| 105 | + |
| 106 | +- The file for Cypress that dynamically sets environment variables and executes tests based on the provided project name. |
| 107 | + |
| 108 | +# 🔗 Additional links |
| 109 | + |
| 110 | +1. [Run `nvm use` automatically every time there's a `.nvmrc` file in the directory](https://stackoverflow.com/questions/23556330/run-nvm-use-automatically-every-time-theres-a-nvmrc-file-on-the-directory) |
0 commit comments