Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add library for replaying Chrome DevTools recordings #132

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

allansson
Copy link
Contributor

Description

We're releasing a new Chrome extension that allows the DevTools Recorder to export a k6 Browser script. This PR adds a module containing the runner needed for the generated scripts.

NOTE: I added a published property to the page generator because because we don't want users to become dependent on this library unless they've used the browser extension. I also expect to be continuously updating v1.0.0 of the library while I'm testing the extension e2e, so it's a good idea to keep it hidden at least until the extension is released.

Please fill in this template.

  • Use a meaningful title for the Pull Request. Include the name of the jslib added/modified.
  • Fill the description section of the Pull Request.
  • Test the change in your code, and ensure the npm run test command succeeds.
  • Run yarn run generate-homepage locally and verify the new homepage /lib/index.html file looks legit.

Select one of these and delete the others:

If adding a new jslib:

  • The Pull Request creates a /lib/{jslib_name} folder.
  • The Pull Request creates a /lib/{jslib_name}/{desired_version} folder.
  • The /lib/{jslib_name}/{desired_version}/index.js file containing the jslib's code bundle exists.
  • The Pull Request updates the supported.json file to contain an entry for the newly added jslib and its {desired_version}, as in the following example:
{
  "{jslib_name}": {
    // Available package versions
    "versions": [
      "{desired_version}"
    ],

    // (optional) Documentation's or repository's URL
    "docs-url": "{documentation_or_repository_url}",

    // (optional) As a default, the homepage will point to
    // a package's bundle's index.js. If your package's main
    // bundle name is different; set it here (see the AWS
    // package for instance).
    "bundle-filename": "{index.js}"
}
  • Tests have been added to /tests/basic.js and /tests/testSuite.js to ensure that the added jslib is importable and runnable by k6. (Did not do because the runner code exports test options that are expected to be re-exported by the test script itself, and I can't re-export it easily in the test runner script).

@allansson allansson requested review from a team as code owners July 1, 2024 12:21
@allansson allansson requested review from mstoykov, joanlopez, w1kman and 2Steaks and removed request for a team July 1, 2024 12:21
Copy link
Contributor Author

@allansson allansson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review

@@ -7,6 +7,11 @@
"versions": ["0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.1.0"],
"docs-url": "https://github.com/grafana/k6-jslib-summary"
},
"k6-replay": {
"versions": ["1.0.0"],
"docs-url": "https://grafana.com/docs/k6/latest/using-k6-browser#todo",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There won't be docs until the extension has been released and if we keep the lib hidden, then we might not need them at all.

"k6-replay": {
"versions": ["1.0.0"],
"docs-url": "https://grafana.com/docs/k6/latest/using-k6-browser#todo",
"published": false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to keep the lib hidden from the homepage, but available on the "CDN".

@allansson
Copy link
Contributor Author

Tests seem to fail randomly in the crocFlow suite. Nothing in this PR could have caused that.

Copy link
Contributor

@w1kman w1kman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😗 👌🏻

Copy link
Contributor

@2Steaks 2Steaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@allansson allansson merged commit 96129dd into main Jul 3, 2024
5 checks passed
@allansson allansson deleted the feat/add-k6-replay-as-hidden-package branch July 3, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants