Giter Club home page Giter Club logo

synthetics-recorder's Introduction

Elastic Synthetics Recorder

Installation and Usage

Download and Install

We publish releases of the Script Recorder on its GitHub repo. You can find downloadable installers there for a variety of platforms.

Note that the Script Recorder is in a Tech Preview phase at the moment, and not supported.

Download and unpack the appropriate installer for your platform, and install it.

Usage

This section describes the basic usage of the Script Recorder. It explains how to start a journey and record steps, as well as testing and outputting a completed script.

After starting up the application, you may input a URL. This URL will be the starting point of the journey script Elastic Synthetics will create.

Once you start a journey, Elastic Synthetics will record actions based on your interaction with the browser window. This includes clicking on text, navigation, focusing on inputs like buttons and text fields, and more. As you complete your journey, you will see the actions you are generating populate in the Script Recorder's window.

You can also add assertions to your journey. Use these to make determinations about the state of the page you are testing. Assertions can include checks for things like the visibility of an element, or the contents of a text field.

The Script Recorder also includes a Pause feature. When you pause the recording session, you may click around the browser window without recording any actions. Un-pause the Recorder to continue recording journey actions.

At any point during or after the recording process concludes, you may test your script. When you click the Test button, Elastic Synthetics will run the journey you have defined. After the test concludes, the Recorder will display results on a per-step basis.

When you are satisfied with the script you have generated, you can save it to file using the Export script button. Additionally, you can display the generated JavaScript code using the Show script feature.

Develop

Note: the recorder is intended to be run against a specific version of node/npm. If you use nvm to manage your versions, you can simply run nvm use to switch to the appropriate version. If not, you can view the current supported version in the .nvmrc file. You can see potential error outputs as a result of using the incorrect version below in the troubleshooting section.

Install the dependencies

npm install

Run the recorder app in dev mode.

npm run dev

Managing Playwright dependency

When updating the version of @elastic/synthetics(called Synthetics agent hereafter), it is important to align the version of Playwright that the Synthetics agent uses and the forked Playwright that is installed by the recorder. Follow the steps below to update the Playwright fork.

  1. Go to @elastic/playwright, fetch upstream microsoft:main into main if needed. We keep our modifications in synthetics-recorder branch. It is supposed to have only one extra commit(84309bf)) compared to the main branch. If main branch has new commits, fetch the changes into synthetics-recorder branch by pulling it with rebase option

  2. Pull the remote changes to your machine. If necessary, set the remote as follows:

git remote add upstream https://github.com/microsoft/playwright.git
git remote add elastic https://github.com/elastic/playwright.git
git remote -v
// prints:
// upstream	https://github.com/microsoft/playwright.git (fetch)
// upstream	https://github.com/microsoft/playwright.git (push)
// elastic  https://github.com/elastic/playwright.git (fetch)
// elastic  https://github.com/elastic/playwright.git (push)
  1. Confirm the Playwright version from Synthetics agent's package.json:
// @elastic/synthetics's package.json
...
    "playwright-core": "=1.37.0",
...
  1. Fetch the tags from upstream, checkout to the version 1.37.0, and create a new branch:
git fetch upstream --tags
git checkout -b 1.37.0-recorder v1.37.0
  1. Cherry-pick the commit from synthetics-recorder branch, then run npm run build.Make sure you've uncommented packages/playwright-core/lib in .gitignore to include all the generated libs file. Check all the files under packages/playwright-core/lib are staged, then commit and push it to elastic remote:

NOTE: it is likely you will need to do some additional cleanup, as the cherry-pick described below does not always transfer the changes perfectly. You can reference the diff from this commit to the 1.37.0 version bump to see some of the additional changes.

git cherry-pick 84309bf
# solve conflicts if necessary
# uncomment `!packages/playwright-core/lib/` in .gitignore (L14)
npm run build
git add .
git commit -m "feat: generate libs"
git push  --set-upstream elastic 1.37.0-recorder
  1. Test new changes in the Recorder by updating Recorder's package.json. Update playwright dependency to the branch you pushed from above step:
// @elastic/synthetics-recorder's package.json
...
    "playwright": "https://gitpkg.now.sh/elastic/playwright/packages/playwright-core?1.37.0-recorder",
...

For now, we are doing it all manually, However, we should consider automating the process.

Javascript Codegen

We generate tailored javascript files for synthetics agent, and we keep that piece of code in the recorder(temporarily), so this can be outdated even though we've updated the Playwright fork. When we update Playwright, it is also advisable to review the JavascriptLanguageGenerator and update our codegen code inherited the class, especially generateAction function that we override.

Build

Build and Package the app for all platforms

npm run pack -- -mwl

synthetics-recorder's People

Contributors

justinkambic avatar vigneshshanmugam avatar kyungeunni avatar v1v avatar lucasfcosta avatar drewpost avatar dependabot[bot] avatar christopherrothwell avatar andrewvc avatar dominiqueclarke avatar elasticmachine avatar reakaleek avatar paulb-elastic avatar shahzad31 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.