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 integration test harness using Ferrum #266
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/view-components/HAhGADFp48jJaumzATDkUj5R2GwF |
@joelhawksley Does storybook and |
"@rails/actioncable": "^6.0.0", | ||
"@rails/ujs": "^6.0.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.
since we are here... do we need these packages?
Just checked locally, and both still work 👍🏻 |
Ferrum::Browser.new(process_timeout: 5) | ||
|
||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
driven_by :cuprite, using: :chrome, screen_size: [1400, 1400] |
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.
any reasoning behind 1400x1400?
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.
Nope, this was default from examples we saw.
def with_preview(preview_name) | ||
component_uri = self.class.name.split("Integration").first.underscore | ||
|
||
visit("/rails/view_components/#{component_uri}/#{preview_name}") |
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 also have the stories routes available here! wdyt of using them?
e.g: /rails/stories/primer/avatar_stack_component/avatar_stack
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.
Interesting. I could go either way. I think we'll want to define specific previews for specific integration tests, but I could also see us reusing the Storybook infrastructure. Ultimately they are similar concepts that should probably share more logic than they do in this PR.
Perhaps we can land what we have here and look into this further at a later time?
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 can talk more about previews vs storybook later 🚢
What
This PR introduces a proof-of-concept integration harness using Ferrum, leveraging ViewComponent previews to provide the example routes.
Why
In order to test javascript behaviors, we need to test our ViewComponents in integration, in a browser environment.
See #250 for more detail.