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

Update Action wrappers to make sure they can represent any interactor #144

Open
3 tasks
cowboyd opened this issue Nov 19, 2021 · 8 comments
Open
3 tasks

Comments

@cowboyd
Copy link
Member

cowboyd commented Nov 19, 2021

In order to integrate with the storybook debugger, we need to be able to represent interactors in code form and not just in text description form. Currently, an interactor sequence such as

async function play() {
  await TextField('Username').fillIn('cowboyd');
  await TextField('Password').fillIn('secure-password');
}

will be rendered in storybook as:

  1. fill in "cowboyd" into the textfield "Username"
  2. fill in "secure-password" into the textfield "Password"

That's because the current facilities to generate a textual representation of interactors is optimized for rendering user-readable errors inside the test failure output. However, we want to be able to render the interaction as close to code as possible, so that the storybook output looks like:

  1. TextField('Username').fillIn('cowboyd');
  2. TextField('Password').fillIn('secure-password');

This issue is set up to track that we have the pieces in place to do this:

  • print the interactor constructor, the locator and filters, and action name along with arguments.
  • represent hiearchies of interactors
  • print matchers as code instead of descriptions
@cowboyd
Copy link
Member Author

cowboyd commented Nov 19, 2021

Also, I think we'll need to be able to remove a wrapper too right?

@wKich
Copy link
Member

wKich commented Nov 22, 2021

@cowboyd What wrapper do you mean?

@cowboyd
Copy link
Member Author

cowboyd commented Nov 22, 2021

@wKich I'm referring to the action wrapper and that it receives enough information to render the storybook step.

@wKich
Copy link
Member

wKich commented Nov 24, 2021

But why do we need to be able to remote it?

@cowboyd
Copy link
Member Author

cowboyd commented Nov 24, 2021

I'm not sure what you mean by remote it?

@wKich
Copy link
Member

wKich commented Nov 24, 2021

I mean that you said Also, I think we'll need to be able to remove a wrapper too right? Why do we need to remote it?

@cowboyd
Copy link
Member Author

cowboyd commented Nov 24, 2021

Ah yes, remove, not "remote".

The answer is flexibility and embeddability. If we don't have the ability to remove it, then we cannot safely use it at any other scope other than the global scope. For example, it lets us scope the action wrapper to the context of the storybook interaction.

onPlay((step, signal) => {
  let remove = addActionWrapper(createWrapper(step));
  signal.addEventListener('abort', remove);
})

@wKich
Copy link
Member

wKich commented Nov 26, 2021

Oh, sorry. I didn't notice, that I did a typo :)

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

2 participants