Skip to content

Commit

Permalink
:cucumber fixes tests and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
josemigallas committed Oct 21, 2019
1 parent bc4bbd6 commit c95d4b8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 53 deletions.
10 changes: 0 additions & 10 deletions app/javascript/packs/apiap_wizard_backend_api.js
Expand Up @@ -16,13 +16,3 @@ document.addEventListener('DOMContentLoaded', () => {

window.analytics.trackLink(useExampleLink, 'Clicked Example API Link')
})

/* Left TODO:
var test_path = $('#proxy_config_test_path');
var backend = $('#proxy_config_backend').change(function updateTestPath() {
test_path.val(backend.val() == example_api ? '/some-path' : null);
});
backend.trigger('change');
*/
17 changes: 8 additions & 9 deletions features/provider/onboarding/wizard.feature
Expand Up @@ -21,14 +21,13 @@ Feature: Onboarding Wizard
Given a provider signs up and activates his account
And I have rolling updates "api_as_product" enabled
When user starts the onboarding wizard
And goes to Add a Backend page
And adds the echo Backend
And goes to Add a Product page
And adds the echo Product
# Will fail because of https://issues.jboss.org/browse/THREESCALE-3687
# And goes to Add a Backend page
# And adds the echo Backend
# And goes to Connect page
# And adds adds a path
# And goes to the request page
# And sends the test request
# And goes to what's next
# Then goes to API page
And goes to Connect page
And adds a path
And goes to the request page
And sends the test request
And goes to what's next
Then goes to API page
44 changes: 12 additions & 32 deletions features/step_definitions/onboarding/apiap_wizard_steps.rb
Expand Up @@ -13,52 +13,42 @@
end
end

And(/^adds adds a path$/) do
within backend_form do
And(/^adds a path$/) do
within connect_form do
fill_in 'Path', with: ''
end
end

And(/^goes to Add a Product page$/) do
And(/^goes to Add a Backend page$/) do
click_on 'Got it! Lets add my API'

page.should have_content 'Add a Product' # This works
page.should have_content 'Add your API(s)'
end

And(/^goes to Add a Backend page$/) do
within product_form do
click_on 'Add this Product' # This does not work
And(/^goes to Add a Product page$/) do
within backend_form do
click_on 'Add this Backend'
end

page.should have_content 'Add a Backend'
page.should have_content 'Design a Product'
end

And(/^goes to Connect page$/) do
within backend_form do
click_on 'Add this Backend'
within product_form do
click_on 'Add this Product'
end

page.should have_content 'Connect Backend and Product'
page.should have_content 'Use your Backend in your Product'
end

And(/^goes to the request page$/) do
within connect_form do
click_on 'Connect to this Path'
click_on 'Add the Backend to the Product'
end

page.should have_content 'Good. Next, make a test GET request'
end

# And(/^sends the test request$/) do
# stub_request(:get, %r{//test.proxy/deploy/}).to_return(status: 200)
# stub_request(:get, /staging.apicast.dev/).to_return(status: 200, body: response = 'Hey! successful request')

# click_on 'Send request'

# page.should have_content 'Congratulations, you are running on 3scale :-)'

# end

def product_form
find('#product_form')
end
Expand All @@ -70,13 +60,3 @@ def backend_form
def connect_form
find('#connect_form')
end

# And(/^goes to what's next$/) do
# click_on "Cool, what's next?"
# page.should have_content "What's next?"
# end

# Then(/^goes to API page$/) do
# click_on 'Got it! Take me to my API on 3scale'
# page.should have_content 'Configure APIcast'
# end
9 changes: 7 additions & 2 deletions features/step_definitions/onboarding/wizard_steps.rb.rb
Expand Up @@ -6,7 +6,7 @@
click_on 'Got it! Lets add my API'

within api_form do
fill_in 'Name', with: 'Echo API'
fill_in 'Name', with: api_name
fill_in 'Base URL', with: 'https://echo-api.3scale.net'

click_on 'Add this API'
Expand All @@ -27,12 +27,17 @@ def api_form
find('#api_form')
end

def api_name
'Echo API'
end

And(/^goes to what's next$/) do
click_on "Cool, what's next?"
page.should have_content "What's next?"
end

Then(/^goes to API page$/) do
click_on 'Got it! Take me to my API on 3scale'
page.should have_content 'Configure APIcast'
page.should have_content 'Overview'
page.should have_content api_name
end

0 comments on commit c95d4b8

Please sign in to comment.