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: Integration tests (Cypress? Something from Rails? etc.) #48

Closed
jaredcwhite opened this issue May 14, 2020 · 7 comments
Closed

feat: Integration tests (Cypress? Something from Rails? etc.) #48

jaredcwhite opened this issue May 14, 2020 · 7 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@jaredcwhite
Copy link
Member

We should integrate and demonstrate how to write integration tests that can be run in CI or during development to verify various aspects of site output, routes, components, etc. The field is wide open as far as I'm concerned as to the best way to do that. If we can stick to something simple and Ruby-based, that's cool. But I'm also willing to go for something heavy-duty like Cypress if that will better serve the ecosystem in the long run.

@jaredcwhite jaredcwhite added enhancement New feature or request question Further information is requested labels May 14, 2020
@jaredcwhite jaredcwhite added this to the v0.15.0 "Overlook" milestone Jun 3, 2020
@jaredcwhite
Copy link
Member Author

The 0.15 release is pretty loaded, but as a stretch goal I think at least some foundational element of this could be included, perhaps as a blank folder in the site template or a suggested approach in the documentation.

@KonnorRogers
Copy link
Member

Ugh. Testing terminology.

When I hear Integration Test I think something that parses everything under the hood and doesn't use a browser.

IE:

DOM Testing Library

Enzyme

Then there's End to End testing which would be something like:

Cypress

It seems like Capybara weirdly hits both aspects based on my limited knowledge.

It can hook into Minitest or RSpec and work as integration testing. But it can also work as a Selenium driver (end to end testing) if I'm reading the docs correctly.

Most of the Rails / Ruby community would probably prefer Capybara due to familiarity.

But most of the front end world uses something like Enzyme / React-Testing-Library for integration tests and Cypress for end to end testing.

Sorry, just thinking out loud here. I'd be happy to see if I could throw something together with either Cypress and Dom-testing-Library or Capybara.

Theoretically they're both framework agnostic and shouldn't require anything special to get working.

@jaredcwhite
Copy link
Member Author

I started to go down a path of using Minitest + Nokogiri via a Bridgetown hook to test the literal HTML at the point it's been statically generated, and so far I'm liking that approach as one possibility. (see #69)

If you want to give Cypress a spin for E2E testing, I think that'd be awesome. I've used Cypress a bit and it's pretty nifty, but I think it's mostly relevant only for parts of the site that are interactive and require JavaScript.

@KonnorRogers
Copy link
Member

I just remembered Rails has a DOM testing library. It uses Minitest / Nokogiri under the hood.

Rails DOM Testing Library

I wonder if there would be any way to leverage those assertions.

@jaredcwhite
Copy link
Member Author

Oooo, those look very interesting. Thanks for the link!!

@jaredcwhite
Copy link
Member Author

The rails-dom-testing stuff is pretty cool…using it now. I think #69 is in good shape now as an example. Since everything's done with just a local plugin and nothing changed in the core gems, I'll just plan to release an automation and document it if people want to add tests to their own sites. Thoughts @ParamagicDev?

@KonnorRogers
Copy link
Member

Sounds perfect to me. I see no issues with this. Let people decide if / how they want to test their site.

Providing examples and an easy way to add them is definitely the way to do it as it prevents people feeling locked into any 1 specific suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants