Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ember + Rails + Capybara = <3

Ember + Rails + Capybara = <3

Robert talks about full stack testing Ember.js and Rails using Capybara at the Ember.js Berlin Meetup on 2017-03-07 at Ahoy!

Robert Schäfer

March 09, 2017
Tweet

More Decks by Robert Schäfer

Other Decks in Programming

Transcript

  1. EmberJS Rails Acceptance *against Mirage Requests, API Capybara Full Stack

    Controllers Integration Components Unit Controllers, Helpers, Models, Routes Models, Mailers, Routing
  2. User story template @42 Feature: <github-issue> As a <role> I

    want to <action> In order to <benefit>
  3. Feature: Full stack testing with Ember and Rails As a

    developer who gives a talk I want to show a secret to registered users only In order to give a valid use case for full stack testing Background: Given the backend knows the answer And only registered users have access to it Scenario: Given I am logged in When I visit the landing page Then I can see a message: """ The answer is 42 """
  4. Set up Capybara features/support/env.rb 1. Start Ember and Rails servers

    2. Load the Rails environment 3. Tell capybara to watch localhost:4200 4. Rock’n Roll!
  5. Frontend Backend 1. Authentication 2. Encrypted JW T Token 3.

    Request (JWT in header) 5. Authorized response 4. Decrypt JWT token
  6. EmberJS Rails Acceptance *against Mirage Requests, API Capybara Full Stack

    Controllers Integration Components Unit Controllers, Helpers, Models, Routes Models, Mailers, Routing
  7. Truth EmberJS 3:30 min total Rails 2:42 min total Acceptance

    0 ember-only acceptance tests 62 examples 16 seconds 48 scenarios, 280 steps 4:30 min (+ 6 min setup) Full Stack 11 examples 1 second Integration 72 assertions 2 seconds Unit 142 assertions 2 seconds 69 examples 1 second
  8. Show your appreciation (=fees) for broadcasts through a web-app -

    and provide the data for a better TV/Radio rating