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

Behat Interactive Shell #94

Closed
grahamc opened this issue Feb 9, 2012 · 9 comments
Closed

Behat Interactive Shell #94

grahamc opened this issue Feb 9, 2012 · 9 comments

Comments

@grahamc
Copy link

grahamc commented Feb 9, 2012

Oftentimes while developing functional tests, I run into very minor errors. The ability to run the commands first in an interactive shell (using readline even?) where it is possible to go back and re-try tests would be wonderful. Being able to then save that out to a file would be even better.

I looked into the Gherkin source: https://github.com/Behat/Gherkin/blob/master/src/Behat/Gherkin/Loader/LoaderInterface.php

If this used Iterator it would be much easier, since the next could have a readline call in it. Otherwise, it looks like it would be pretty tricky.

So... yeah.

:trollface:

@dr-fozzy
Copy link

dr-fozzy commented Feb 9, 2012

I belive need to correct a mistakes, and not the symptoms... The syntax of Behat test is pretty easy. Otherwise, try http://www.phpsh.org/

@grahamc
Copy link
Author

grahamc commented Feb 9, 2012

Sure, the syntax is pretty easy, but minor things like a CSS selector being slightly wrong becomes tedious. All I'm saying is I think it would be a valuable feature to provide.

@dr-fozzy
Copy link

dr-fozzy commented Feb 9, 2012

In that context - I agree, such feature would be nice.

@alganet
Copy link

alganet commented Jun 22, 2012

This could be very useful for testing javascript-heavy apps running on Selenium. For now, my team have been using rspec with pry just for this specific feature. We're developing those single-page apps that change the page DOM a lot.

Selenium has its quirks. Sometimes it loses references to dynamically updated nodes and we need to come up with xpath/css selectors that avoid these problems. Having a console set up ready to test these assertions is very handy.

@dbollaer
Copy link

I have created part of the solution. Right now I still need to use methods, instead of gherkin language.
Some idea's on how to fix this would be nice.

Here is the first part of the code

https://gist.github.com/dbollaer/4985370

and here is an example on how to use it.

Given I am on the home page
When I execute
Then I should see "my result"

When the program enters execute, I type my commands(interactively)

Like:
followLink;my page
pressButton;submit

On the end; I type "."
And then it executes "Then I should see "my result"
This way I don't have to restart selenium, when I am writing my script.

wouterj pushed a commit to wouterj/Behat that referenced this issue Jul 1, 2014
Add possible option firefox binary
@lindsaymacvean
Copy link

How do I implement this into my feature context file, do I use a 'use' statement or should I change this into a class?

@lindsaymacvean
Copy link

lindsaymacvean commented May 11, 2016

I put this trait in another file called InteractiveShell.php
Then called it from my main FeatureContext.php file like so:

include 'InteractiveShell.php';   
class WebContext extends MinkExtension  
{  
  use DevelopmentDictionary;  
}  

@lindsaymacvean
Copy link

lindsaymacvean commented May 11, 2016

I am now confused how to use commands like the below from the interactive execute() shell:

$page = $this->getSession()->getPage();  
$this->visit('/admin/structure/taxonomy/organisational_unit/add');  
.

Essentially I want to pass the context of the parent class to the execute() method so that I can run mink extension commands.

@everzet
Copy link
Member

everzet commented Jul 24, 2016

I'm closing this issue as it is seems to be very old. Please reopen with updated stats if that's not the case!

@everzet everzet closed this as completed Jul 24, 2016
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

No branches or pull requests

6 participants