### Start Recording a Test Case (PC) Source: https://github.com/alibaba/uirecorder/blob/master/README.md Starts the recording process for a test case on a PC. Ensure the hosts file is edited if necessary. ```bash uirecorder sample/test.spec.js ``` -------------------------------- ### Start Macaca Server Source: https://github.com/alibaba/uirecorder/blob/master/README.md Starts the Macaca server on a specified port. This is required for mobile testing. ```bash macaca server --port 4444 ``` -------------------------------- ### Start Recording a Test Case (Mobile) Source: https://github.com/alibaba/uirecorder/blob/master/README.md Starts the recording process for a test case on a mobile device using UI Recorder with the --mobile flag. ```bash uirecorder --mobile sample/test.spec.js ``` -------------------------------- ### Install and Run Scripts for Jenkins Docking Source: https://github.com/alibaba/uirecorder/blob/master/README.md Execute these commands to install necessary components and run tests when integrating with Jenkins. ```bash source ./install.sh ``` ```bash source ./run.sh ``` -------------------------------- ### Install UI Recorder Source: https://github.com/alibaba/uirecorder/blob/master/README.md Installs UI Recorder and Mocha globally using npm. Requires Node.js version 7 or higher. ```bash npm install uirecorder mocha -g ``` -------------------------------- ### Run Selenium Standalone Server Source: https://github.com/alibaba/uirecorder/blob/master/README.md Use this command to start the Selenium standalone server. Ensure you have the necessary Node.js environment set up. ```bash npm run server ``` -------------------------------- ### Starting UIRecorder to Save Raw Commands Source: https://github.com/alibaba/uirecorder/blob/master/README.md Initiate UIRecorder with the '--raw' flag to capture all commands executed during the test session. This generates two files: a test script and a JSON file containing the raw commands. ```shell uirecorder start --raw ``` -------------------------------- ### Initialize UI Recorder Project Source: https://github.com/alibaba/uirecorder/blob/master/README.md Initializes a new UI Recorder test project. Use the --mobile flag for mobile projects. ```bash uirecorder init ``` ```bash uirecorder init --mobile ``` -------------------------------- ### Run Test Cases (PC) Source: https://github.com/alibaba/uirecorder/blob/master/README.md Executes UI Recorder test cases. Use 'source run.sh' for Linux/Mac or 'run.bat' for Windows. Specify a single file to run a specific case. ```bash source run.sh ``` ```bash run.bat ``` ```bash source run.sh sample/test.spec.js ``` ```bash run.bat sample/test.spec.js ``` -------------------------------- ### Record Common Test Case Source: https://github.com/alibaba/uirecorder/blob/master/README.md Follow these steps to record common test cases like login or general test scripts. Ensure you have the necessary shell scripts available. ```bash source run.sh ``` ```bash run.bat ``` -------------------------------- ### Exporting Devices for Mobile Testing Source: https://github.com/alibaba/uirecorder/blob/master/README.md Set the 'devices' environment variable to specify the UDIDs of mobile devices for testing. Use 'export' on Linux/Mac and 'set' on Windows. ```shell export devices=xxx1,xxx2 ``` ```shell set devices=xxx1,xxx2 ``` -------------------------------- ### Set WebDriver Host and Port Environment Variable Source: https://github.com/alibaba/uirecorder/blob/master/README.md Temporarily configure the WebDriver host and port using environment variables for local debugging. The port is optional. ```bash export webdriver=127.0.0.1:4444 ``` ```powershell set webdriver=127.0.0.1:4444 ``` ```bash export webdriver=127.0.0.1 ``` -------------------------------- ### Rebuild Image Diff Baseline Source: https://github.com/alibaba/uirecorder/blob/master/README.md Rebuild the baseline image for image difference testing. Use the appropriate command for your operating system. ```bash source run.sh sample/test.spec.js --rebuilddiff ``` ```bat run.bat sample/test.spec.js --rebuilddiff ``` -------------------------------- ### Configure Variables for UI Recorder Source: https://github.com/alibaba/uirecorder/blob/master/README.md Define and use variables within the UI Recorder configuration. Variables can be used in URLs and strings, and support JavaScript template literals for dynamic values. ```json { "recorder": { ... }, "webdriver": { ... }, "vars": { "productId": "123456", "productName": "mp3" } } ``` -------------------------------- ### Configure Unstable Path Filtering with Regex Source: https://github.com/alibaba/uirecorder/blob/master/README.md Filter unstable attributes by providing a regular expression blacklist during initialization. This is useful when attribute values are random or change frequently. ```bash uirecorder init ``` ```regex /attr_\d+/ ``` -------------------------------- ### CSS Glow Keyframes Animation Source: https://github.com/alibaba/uirecorder/blob/master/chrome-extension/start.html Defines a 'glow' animation with vendor prefixes for cross-browser compatibility. Use this for elements that require a pulsating glow effect. ```css @-moz-keyframes glow { 0% { border-color: #393; box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000; } 100% { border-color: #6f6; box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000; } } @-o-keyframes glow { 0% { border-color: #393; box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000; } 100% { border-color: #6f6; box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000; } } @-ms-keyframes glow { 0% { border-color: #393; box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000; } 100% { border-color: #6f6; box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000; } } @keyframes glow { 0% { border-color: #393; box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000; } 100% { border-color: #6f6; box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000; } } ``` -------------------------------- ### Styling for Copy Element Source: https://github.com/alibaba/uirecorder/blob/master/chrome-extension/start.html Sets the font family, color, and size for an element with the ID 'copy'. This styling is specific to the UI Recorder's display elements. ```css #copy{ font-family: Segoe UI,Helvetica Neue,Helvetica,Segoe UI; color: #666; font-size: 16px; } ``` -------------------------------- ### JavaScript Evaluation Expectation Source: https://github.com/alibaba/uirecorder/blob/master/README.md Configure expectations for JavaScript evaluation in the browser. Supports sync, function, and async modes. ```javascript return document.title ``` ```javascript function(){ var str = "aaa"; return str; } ``` ```javascript function(done){ setTimeout(function(){ done(123); }, 100); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.