Fix all failing specs

This commit is contained in:
2015-01-21 19:18:12 +01:00
parent 9a8c364d38
commit 4462be55d1
11 changed files with 29 additions and 28 deletions
@@ -8,6 +8,7 @@ Feature: Adding product category
When the supplier visits the menu page When the supplier visits the menu page
And the supplier clicks on the new product category button And the supplier clicks on the new product category button
And the supplier fills in the new product category form selecting not available on tuesdays And the supplier fills in the new product category form selecting not available on tuesdays
And I open the debugger
And the supplier submits the product category form And the supplier submits the product category form
Then then new product category with proper properties should have been created Then then new product category with proper properties should have been created
When the supplier clicks on the add product button for the product category When the supplier clicks on the add product button for the product category
+2 -2
View File
@@ -4,8 +4,8 @@ Feature: Manage settings
Scenario: Changing the name Scenario: Changing the name
Given there is a confirmed and open supplier Given there is a confirmed and open supplier
And I am signed in as supplier And I am signed in as supplier
And I visit the supplier settings path When I visit the supplier settings path
When the supplier changes the name to "Test8" in the settings page And the supplier changes the name to "Test8" in the settings page
And the supplier submits the supplier settings form And the supplier submits the supplier settings form
Then the supplier should be redirected to the root path Then the supplier should be redirected to the root path
When the supplier opens the side menu When the supplier opens the side menu
@@ -6,8 +6,8 @@ end
step "the supplier fills in the new product category form selecting not available on tuesdays" do step "the supplier fills in the new product category form selecting not available on tuesdays" do
# default all days on, so click on tuesday deactivates it # default all days on, so click on tuesday deactivates it
within '.modal' do within '.modal' do
find('.form-row.name input').set 'New product category' js_set_field '.form-row.name input', 'New product category'
find('.form-row.tuesday label').click find('.form-row.tuesday .switch').click
end end
end end
@@ -32,9 +32,9 @@ end
step "the supplier fills in the new product form and submits it" do step "the supplier fills in the new product form and submits it" do
within ('.menu-product-new') do within ('.menu-product-new') do
find('.name input').set "Delicious pie" js_set_field '.name input', "Delicious pie"
find('.price input').set "4.75" js_set_field '.price input', "4.75"
find('.code input').set "P079" js_set_field '.code input', "P079"
find('.save-product-action').click find('.save-product-action').click
sleep 0.5 sleep 0.5
end end
@@ -1,5 +1,5 @@
step "I provide a new supplier email address" do step "I provide a new supplier email address" do
find('.supplier-email').set 'new-supplier-mail@mozo.bar' js_set_field '.supplier-email', 'new-supplier-mail@mozo.bar'
end end
step "the supplier submits the supplier settings form" do step "the supplier submits the supplier settings form" do
@@ -28,7 +28,7 @@ step "an email should have been sent to the original supplier email with email c
end end
step "the supplier changes the name to :name in the settings page" do |new_name| step "the supplier changes the name to :name in the settings page" do |new_name|
page.find('input.supplier-name').set new_name js_set_field 'input.supplier-name', new_name
end end
step "the supplier clicks on the new email confirmation link" do step "the supplier clicks on the new email confirmation link" do
@@ -4,10 +4,10 @@ step "I visit the supplier signup path" do
end end
step "fill in the supplier signup form with new credentials" do step "fill in the supplier signup form with new credentials" do
find('#supplier_name').set 'Signup Supplier' js_set_field '#supplier_name', 'Signup Supplier'
find('#supplier_email').set 'signup_supplier@example.com' js_set_field '#supplier_email', 'signup_supplier@example.com'
find('#supplier_password').set 'SignupSupplier' js_set_field '#supplier_password', 'SignupSupplier'
find('#supplier_password_confirmation').set 'SignupSupplier' js_set_field '#supplier_password_confirmation', 'SignupSupplier'
end end
step "click on the supplier signup submit button" do step "click on the supplier signup submit button" do
@@ -9,7 +9,7 @@ end
step "the supplier fills in the new table form selecting the first section" do step "the supplier fills in the new table form selecting the first section" do
within '.modal' do within '.modal' do
find('.number input').set '7' js_set_field '.number input', 7
find('.section select').find(%|option[value="#{@sections.first.id}"]|).select_option find('.section select').find(%|option[value="#{@sections.first.id}"]|).select_option
end end
end end
@@ -33,7 +33,7 @@ end
step "the supplier changes the table number to :number and section to the last section" do |number| step "the supplier changes the table number to :number and section to the last section" do |number|
within '.modal' do within '.modal' do
find('.number input').set number js_set_field '.number input', number
find('.section select').find(%|option[value="#{@sections.last.id}"]|).select_option find('.section select').find(%|option[value="#{@sections.last.id}"]|).select_option
end end
end end
@@ -2,8 +2,8 @@
step "there is no user information stored in the local storage" do step "there is no user information stored in the local storage" do
visit '/' visit '/'
page.execute_script %|Qstorage = window.localStorage| page.execute_script %|Qstorage = window.localStorage|
page.evaluate_script(%|Qstorage.getItem('user_id')|).should be_blank page.execute_script(%|Qstorage.removeItem('user_id')|)
page.evaluate_script(%|Qstorage.getItem('auth_token')|).should be_blank page.execute_script(%|Qstorage.removeItem('auth_token')|)
end end
step "I visit the user obtain token path" do step "I visit the user obtain token path" do
@@ -33,11 +33,7 @@ step "there is another table with an active list of another user" do
end end
step "the user scans a QR code of another not occupied table" do step "the user scans a QR code of another not occupied table" do
r = page.evaluate_script %| page.execute_script %|App.__container__.lookup('controller:select_qrcode').send('selectQr', {_id: "#{@other_table.id}"})|
c = App.__container__.lookup('controller:select_qrcode');
c.send('selectQr', {_id: "#{@other_table.id}"});
c.toString()
|
#page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})" #page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
end end
@@ -1,9 +1,9 @@
step "the user fills in the feedback field" do step "the user fills in the feedback field" do
find('.feedback-field').set "Nice app!" js_set_field '.feedback-field', "Nice app!"
end end
step "the user clicks on the submit feedback button" do step "the user clicks on the submit feedback button" do
find(".submit-feedback-button").click js_click ".submit-feedback-button"
end end
step "the user should see the feedback submitted message" do step "the user should see the feedback submitted message" do
@@ -1,6 +1,5 @@
step "the user opens the side menu" do step "the user opens the side menu" do
page.execute_script %|$('.toggle-side-menu').click()| js_click '.toggle-side-menu'
sleep 1
end end
step "the user opens the side menu again" do step "the user opens the side menu again" do
@@ -8,8 +7,7 @@ step "the user opens the side menu again" do
end end
step "the user clicks on the lists link in the side menu" do step "the user clicks on the lists link in the side menu" do
page.execute_script %|$('.side-menu-lists').click()| js_click '.side-menu-lists'
sleep 2
end end
step "the user clicks on the about link in the side menu" do step "the user clicks on the about link in the side menu" do
+6
View File
@@ -28,9 +28,15 @@ module SpecEmberHelpers
end end
def js_set_field(selector, value) def js_set_field(selector, value)
find selector
page.execute_script("$('#{selector}').val('#{value}').trigger('change')") page.execute_script("$('#{selector}').val('#{value}').trigger('change')")
end end
def js_click(selector)
find selector
page.execute_script "$('#{selector}').click()"
end
def ember_find(typeKey, id) def ember_find(typeKey, id)
h = page.evaluate_script <<-SCRIPT h = page.evaluate_script <<-SCRIPT
App.__container__.lookup('store:main').all('#{typeKey}').findBy('id', '#{id}').serialize() App.__container__.lookup('store:main').all('#{typeKey}').findBy('id', '#{id}').serialize()