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

Testing apps #13

Open
aalin opened this issue Sep 29, 2022 · 0 comments
Open

Testing apps #13

aalin opened this issue Sep 29, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@aalin
Copy link
Contributor

aalin commented Sep 29, 2022

Without testing there is no way to know if anything works.

I'm thinking there could be page tests, component tests and store tests...
I really like how Testing Library does queries by roles, it encourages accessibility, and their API is pretty nice so it's a good source of inspiration

Page tests could look like this:

# app/pages/my-page/page.test.rb

def test_my_page
  page = Blabla.new(setup_env)
  page.navigate "/my-page"
    
  page.click(page.get_by_text("Load Greeting"))
  page.find_by_role("heading")

  assert(page.get_by_role("heading").text_content == "hello there")
  assert(page.get_by_role("heading").button.disabled)
end
# app/components/MyComponent.test.rb

def test_my_component
  component = render("%MyComponent")
  # now what? suggestions welcome
end

It would maybe be possible to use Capybara by implemeting a driver. That could save some work.

aalin added a commit that referenced this issue Oct 31, 2022
This is quite messy and should be refactored
into something that is easy to use.

Related to #13
aalin added a commit that referenced this issue Oct 31, 2022
aalin added a commit that referenced this issue Oct 31, 2022
@aalin aalin added the enhancement New feature or request label Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant