|
| 1 | +--- |
| 2 | +page_type: sample |
| 3 | +languages: |
| 4 | + - javascript |
| 5 | +products: |
| 6 | + - azure |
| 7 | + - azure-communication-services |
| 8 | +--- |
| 9 | + |
| 10 | +# Automation Scripts |
| 11 | + |
| 12 | +This folder contains scripts to automate various tasks for samples, including updating dependencies, setting variable values, and running end-to-end tests using Playwright. [Please see the recommended steps to run the Quickstarts below](#recommended-usage-of-the-scripts-for-testing-web-ui-library-quickstarts). |
| 13 | + |
| 14 | +## Scripts |
| 15 | + |
| 16 | +### 1. Update Chat Sample Dependencies |
| 17 | + |
| 18 | +Script to automate chat UI library sample updates. This will run through the arrays of projects and update chat, calling, and react libraries to the latest beta or stable versions. |
| 19 | + |
| 20 | +**Usage**: |
| 21 | + |
| 22 | +1. Change to the scripts directory. |
| 23 | +1. Run `node update-chat-sample-deps.mjs`. |
| 24 | + |
| 25 | +### 2. Set Variables Values for Chat UI library |
| 26 | + |
| 27 | +Script to automate updating variables in various UI library sample files. This script prompts the user for input values and updates specified variables in the listed files. It handles both single-line and multi-line strings, ensuring that multi-line strings are updated correctly by removing the next line if needed. |
| 28 | + |
| 29 | +**Usage**: |
| 30 | + |
| 31 | +1. Change to the scripts directory. |
| 32 | +1. Run `node ui-library-set-variables-values.mjs`. |
| 33 | +1. Optionally, use `--restore` to restore default values. |
| 34 | + |
| 35 | +### 3. Run Playwright Tests |
| 36 | + |
| 37 | +Script to automate testing for various chat UI library samples. This script prompts the user to select a project and optionally installs dependencies before running end-to-end tests using Playwright. The test will open a browser window and run the initial steps for the samples. The user can continue testing in the same window. The session is set to be closed after **10 minutes**. Please make sure to **CLOSE the browser tab or window after the test is complete**. Otherwise, the process will continue running and you might need to kill it manually. |
| 38 | + |
| 39 | +**Usage**: |
| 40 | + |
| 41 | +1. Change to the scripts directory. |
| 42 | +1. Run `npm install` to install dependencies for the script. |
| 43 | +1. Run `node ui-library-run-playwright-tests.mjs [--install]`. Optionally, use `--install` to install all needed the dependencies before running the tests. |
| 44 | +1. Do any additional testing in the window that was opened by Playwright. Please note that some tests like Teams sample or file sharing need manual testing from the user (allow the user to the Teams meeting, send files). |
| 45 | +1. **CLOSE the browser tab or window after the test is complete**. Otherwise, the process will continue running and you might need to kill it manually. |
| 46 | + |
| 47 | +## Recommended usage of the scripts for testing Web UI library Quickstarts |
| 48 | + |
| 49 | +1. Change to the scripts directory. |
| 50 | +1. Run `npm install` in Terminal to install dependencies for the scripts. |
| 51 | +1. (if the dependencies needs to be updated) Run `node update-chat-sample-deps.mjs`. |
| 52 | +1. Run `node ui-library-set-variables-values.mjs` to update variables for samples. |
| 53 | +1. Run `node ui-library-run-playwright-tests.mjs` or `node ui-library-run-playwright-tests.mjs --install` to select a sample, install dependencies if needed and start it. |
| 54 | +1. Do any additional testing in the window that was opened by Playwright. Please note that some tests like Teams sample or file sharing need manual testing (allow the user to the Teams meeting, send files) as they need to be done outside of the Web apps or have dependency on file manager of a user. |
| 55 | +1. **CLOSE the browser tab or window after the test is complete**. Otherwise, the process will continue running and you might need to kill it manually. |
| 56 | +1. Repeat steps 5-7 to test all needed samples. |
| 57 | +1. Run `node ui-library-set-variables-values.mjs --restore` to restore default values. |
| 58 | +1. Commit and push the changes, and create a PR for them. |
0 commit comments