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

Sucessfully running Behat scenarios for OAuth sign-in #2

Merged
merged 1 commit into from
Oct 29, 2013

Conversation

headrevision
Copy link

As mentioned in Sylius#354 (comment), the Behat scenarios for testing the OAuth sign-in are to complex/insecure so far. Thus I simply removed the critical ones. I kept only one scenario to test at least the reachability of the resource owner's login page from Sylius. You only need to specify an actual client ID + secret for Login with Amazon (configured with http://localhost/login/check-amazon as an allowed return URL) when installing via composer.

The use of Amazon serves as a PoC here. We should substitute it with another resource owner and include pre-configured credentials (client ID + secret) in parameters.yml.dist. Twitter configured with the Sylius Twitter account? Any other suggestions?

… successfully with pre-configured resource owner
selenium2:
browser: firefox
wd_host: your_saucelabs_username:your_saucelabs_apikey@ondemand.saucelabs.com/wd/hub
capabilities: { "platform": "Windows 8", "browser": "firefox", "version": "21"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I was about to try saucelabs again. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just not necessary for the OAuth testing when using Goutte, but of course using Selenium2/SauceLabs instead is feasible as well.

@pjedrzejewski
Copy link

@headrevision This might be a dumb question, but I'm not sure I get your comment, do we need to have a fake amazon account for tests here?

@headrevision
Copy link
Author

Yes, that is right. You need an Amazon account to setup the resource owner (Login with Amazon). The same with Twitter or any other resource owner.

@stloyd
Copy link
Owner

stloyd commented Oct 22, 2013

Hey, removal of testing the real pages is good idea, but instead of removing testing fully, I would vote to use html fixtures instead of real network calls.

  1. Go at Amazon page,
  2. Save the html,
  3. Put it into fixtures,
  4. Add step that parses that html not real page,
  5. ???
  6. Profit! =)

What do you think?

@headrevision
Copy link
Author

@stloyd You cannot mock/simulate the OAuth 2.0 login process via static pages. Even if you succeeded, you would simply mock your SUT.

@stloyd
Copy link
Owner

stloyd commented Oct 22, 2013

@headrevision I know I can't simulate whole process, I and don't want =) I'm just suggesting the faking it for testing purposes with assumptions we have working & failing connect results.

Here is quick description of steps I have in mind:

Given I'm logged in as "dummy"
  And I'm at connect page
 When I click "Connect with Amazon"
 Then I see some "Amazon Connect" form
 When I connect the account
 Then My account is marked as connected

Given I'm logged in as "dummy"
  And I'm at connect page
 When I click "Connect with Amazon"
 Then I see some "Amazon Connect" form
 When I decline the connection of account
 Then My account is not marked as connected

The part below is working on fake data as well as directly on security tokens etc.:

 Then I see some "Amazon Connect" form
 When I decline the connection of account
 Then My account is not marked as connected

@headrevision
Copy link
Author

@stloyd This way you fake all your When and Then steps (except of When I click "Connect with Amazon", which already works). Faking (instead of simulating) the user interaction that you describe with the steps makes the concept of BDD completely useless.

@stloyd stloyd merged this pull request into stloyd:feature/hwi_oauth Oct 29, 2013
stloyd pushed a commit that referenced this pull request Aug 19, 2014
… array" when there is no parameter with keys "criteria" and "sorting"
stloyd pushed a commit that referenced this pull request Aug 19, 2014
Fixed bug that caused an error: "array_merge(): Argument #2 is not an ar...
stloyd pushed a commit that referenced this pull request Sep 17, 2014
Fix code after feedback, add ability to disable guest orders
stloyd pushed a commit that referenced this pull request Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants