From 7bbeac54747c336af8212bab3504ef4732fe5ae4 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Thu, 4 Apr 2019 16:49:47 -0700 Subject: [PATCH] Move react test into local view --- lib/capybara/spec/views/react.erb | 45 +++++++++++++++++++++++++++++++ spec/shared_selenium_session.rb | 25 +++++++++-------- 2 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 lib/capybara/spec/views/react.erb diff --git a/lib/capybara/spec/views/react.erb b/lib/capybara/spec/views/react.erb new file mode 100644 index 00000000..78e00d18 --- /dev/null +++ b/lib/capybara/spec/views/react.erb @@ -0,0 +1,45 @@ + + + + + + + +
+ + + \ No newline at end of file diff --git a/spec/shared_selenium_session.rb b/spec/shared_selenium_session.rb index fe62886e..c50aedf2 100644 --- a/spec/shared_selenium_session.rb +++ b/spec/shared_selenium_session.rb @@ -472,18 +472,21 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode| describe 'with react' do context 'controlled components' do it 'can set and clear a text field' do - session.visit 'https://reactjs.org/docs/forms.html' - session.all(:css, 'h2#controlled-components ~ p a', text: 'Try it on CodePen')[0].click - session.within_frame(:css, 'iframe.result-iframe:not([src=""])', wait: 10) do - session.fill_in('Name:', with: 'abc') - session.accept_prompt 'A name was submitted: abc' do - session.click_button('Submit') - end - session.fill_in('Name:', with: '') - session.accept_prompt(/A name was submitted: $/) do - session.click_button('Submit') - end + # session.visit 'https://reactjs.org/docs/forms.html' + # session.all(:css, 'h2#controlled-components ~ p a', text: 'Try it on CodePen')[0].click + # copied into local view + session.visit 'react' + # Not necessary when accessed locally + # session.within_frame(:css, 'iframe.result-iframe:not([src=""])', wait: 10) do + session.fill_in('Name:', with: 'abc') + session.accept_prompt 'A name was submitted: abc' do + session.click_button('Submit') end + session.fill_in('Name:', with: '') + session.accept_prompt(/A name was submitted: $/) do + session.click_button('Submit') + end + # end end end end