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

Feat: add browser check validations (frontend) #869

Merged
merged 6 commits into from
Jul 18, 2024

Conversation

VikaCep
Copy link
Contributor

@VikaCep VikaCep commented Jul 17, 2024

Using the acorn library, the script from both the browser and scripted checks is parsed to make sure that it contains the browser import (from k6/browser) for browser checks, and validate that it is not present in scripted checks.
It also validates the script exports the options configuration in browser checks.

Frontend part of #864

Browser:

Valid scripts
image
image

Not importing browser from k6/browser
image
image
image

Not exporting options
image

Scripted check:

Valid script:
image

Importing browser:
image

@VikaCep VikaCep self-assigned this Jul 17, 2024
@CLAassistant
Copy link

CLAassistant commented Jul 17, 2024

CLA assistant check
All committers have signed the CLA.

dependabot bot and others added 5 commits July 17, 2024 16:14
Bumps [fast-loops](https://github.com/robinweser/fast-loops) from 1.1.3 to 1.1.4.
- [Commits](https://github.com/robinweser/fast-loops/commits)

---
updated-dependencies:
- dependency-name: fast-loops
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@VikaCep VikaCep force-pushed the feat/browser-check-validations branch from 945efbf to ccb8d20 Compare July 17, 2024 19:14
@VikaCep VikaCep marked this pull request as ready for review July 17, 2024 19:28
@VikaCep VikaCep requested a review from a team as a code owner July 17, 2024 19:28
@VikaCep
Copy link
Contributor Author

VikaCep commented Jul 17, 2024

@ckbedwell regarding tests, I'd rather add them after porting your form refactor changes into this branch as you implemented a test framework that I think will facilitate writing them here. Let me know if you disagree though.

Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

Super minor comment but otherwise this is great work! I've tried to break it and haven't managed yet. 👏👏👏

Not for this PR but I did notice the validation gets triggered like four or five times on a single character press but it doesn't make any discernible UX impact.

Also not for this PR but I know acorn is relatively big so at some point in the future we can look at lazy loading it as it is only needed for a very specific part of the application.

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

🔥🔥🔥

@VikaCep VikaCep merged commit 7df485a into feat/browser-checks Jul 18, 2024
3 checks passed
@VikaCep VikaCep deleted the feat/browser-check-validations branch July 18, 2024 15:22
@ckbedwell ckbedwell mentioned this pull request Jul 23, 2024
VikaCep added a commit that referenced this pull request Jul 23, 2024
* feat: initial browser check setup

* Feat: add browser check validations (frontend) (#869)

* chore(deps): bump fast-loops from 1.1.3 to 1.1.4 (#858)

Bumps [fast-loops](https://github.com/robinweser/fast-loops) from 1.1.3 to 1.1.4.
- [Commits](https://github.com/robinweser/fast-loops/commits)

---
updated-dependencies:
- dependency-name: fast-loops
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: add acorn for script parsing

* feat: parse script and allow to extract options / import statements

* feat: add script validations to its own file

* feat: apply browser and script validations to form

* chore: fix acorn version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add hover/focus-visible interaction to form sidebar buttons (#871)

* fix: fix rendering of scripted checks (#872)

* feat: add support for browser checks with new form approach

* fix: fix rendering browser checks

* fix: display browser checks in its own group

* fix: include correct form elements in browser checks

* feat: add browser check tests

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Virginia Cepeda <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Virginia Cepeda <[email protected]>
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