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

Potentially create abstraction for testingOutput sender arguments #101

Open
gazayas opened this issue Jul 10, 2023 · 1 comment
Open

Potentially create abstraction for testingOutput sender arguments #101

gazayas opened this issue Jul 10, 2023 · 1 comment

Comments

@gazayas
Copy link

gazayas commented Jul 10, 2023

var action = ""
var target = ""
var options = ""

I'm seeing these three values grouped together often like this:

testingOutput.push({action: action, target: target, options: options });

Curious if we should make an abstraction of this object and give it a name.

@gazayas
Copy link
Author

gazayas commented Jul 10, 2023

Maybe we could do something like this.

function buildCapybaraAction(action, data = nil) {
  switch(action) {
    case 'fill_in':
      // ...
    case 'click_on':
      // ...
  }

  return {action: action, target: target, options: options}
}

Here data represents whatever information is necessary to build the arguments and options for the action we want to build.

I still haven't sifted through the code enough to know if this is a viable option, but I think it will make the intention of the code clearer to first-time readers, and we can perhaps simplify the current code.

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

No branches or pull requests

1 participant