-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Moved Element options and Frame options (partially) to mapping layer #5329
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
base: master
Are you sure you want to change the base?
Moved Element options and Frame options (partially) to mapping layer #5329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. Thanks a lot ❤️
We should also fix the linter and test errors. You can fix these locally using make. Please also remove the merge commit and squash it. Please split your changes into different commits if possible.
52bf2b8 to
df02a1d
Compare
6679d1d to
16cab73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes 🙇 It's currently difficult to review this PR, and we might miss something without knowing it. Please split the current large commit into separate commits for each option (as long as they don't depend on each other). We should also resolve conflicts and make sure tests pass.
| } | ||
|
|
||
| // parseElementHandleBaseOptions parses ElementHandleBaseOptions from opts | ||
| //nolint:unparam // keeping error for consistency with other parse functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove error returns from all functions that don't return errors, as we don't need them now. We can add errors later if needed. We don't need to be consistent here.
| optionModifiers = "modifiers" | ||
| ) | ||
|
|
||
| const noWaitAfterOption = "noWaitAfter" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this into the same const block and prefix it with option:
| optionModifiers = "modifiers" | |
| ) | |
| const noWaitAfterOption = "noWaitAfter" | |
| optionModifiers = "modifiers" | |
| optionNoWaitAfter = "noWaitAfter" | |
| ) |
| var imageFormatToID = map[string]common.ImageFormat{ //nolint:gochecknoglobals | ||
| "jpeg": common.ImageFormatJPEG, | ||
| "png": common.ImageFormatPNG, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove nolint and move this to parseElementHandleScreenshotOptions, as it's only used there.
| "selectText": func(opts sobek.Value) (*sobek.Promise, error) { | ||
| popts := common.NewElementHandleBaseOptions(eh.DefaultTimeout()) | ||
| if err := popts.Parse(vu.Context(), opts); err != nil { | ||
| popts, err := parseElementHandleBaseOptions(vu.Context(), opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take a timeout as a parameter, as before. Please apply this logic to other parse functions as well.
We don't want to change any existing behavior.
| parsed := &common.ElementHandleBaseOptions{ | ||
| Force: false, | ||
| NoWaitAfter: false, | ||
| Timeout: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get Timeout from an input. Applies to other functions as well.
|
@anupriyakkumari We'll release k6 1.4.0 in two weeks. Please continue working on this PR if you want it merged into k6 1.4.0. Otherwise, we'll have to postpone merging your PR until k6 1.5.0. I might work on some of the parts of #5305 even if you can't continue working on it. |
Hi @inancgumus. Sorry for the delay, I am caught up in some work till 30th but I will trying my best to at least finish work on this PR. |
What?
Worked on #5305
This PR partially moves Sobek option parsing to the mapping layer, removing parsing logic from the business logic layers.
Specifically, this PR includes moving the following option parsers:
ElementHandle{...}OptionsFrameoptions dependent on element optionsThis has resulted in changes across multiple mapping layers in the browser package.
Why?
Related
This change is part of the ongoing effort outlined in the epic issue:
Move Sobek entirely out of the business logic #4219
Checklist
make check) and all pass.