Coder Social home page Coder Social logo

behaving's People

Contributors

andheiberg avatar anti1869 avatar antych avatar baekholt avatar ciprian-balauroiu avatar day-me-an avatar demetris-manikas avatar dependabot[bot] avatar erlendfh avatar fgimian avatar ggozad avatar guoqiao avatar harry-nguyen22 avatar julianpistorius avatar kageurufu avatar lampmantech avatar lrowe avatar mceike avatar metajiji avatar oyvinev avatar rosselliott avatar tsnowlan avatar wichert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

behaving's Issues

"I fill in" step cannot be used with text containing double quotes

behaving/web/steps/forms.py does not provide a way to fill in text containing double quotes. This is particularly relevant for text areas.

It might be beneficial to provide a variant I fill in "{name}" with step that relies on context.text, similar to behaving/personas/steps.py I set "{key}" to.

phantomjs parameters?

Is there an option to pass parameters (--ignore-ssl-errors=true) to phantomjs ?

tried it with a script, but phantomjs will not shutdown after completing the steps.

!/bin/bash

/opt/phantomjs/phantomjs $@ --ignore-ssl-errors=true

Some improvements

We are starting to use behaving a lot and have a few changes to the built in steps that would be worthwhile making.

  1. Add @persona_vars to as many steps as possible, for example 'I should see ...' would work far better if you could pass in a persona key such as 'I should see "$j-random-name"'
  2. Change 'Given "persona" as the persona' to only create a new browser connection if one doesn't exist already. This causes problems when using saucelabs for instance as when we switch personas in a scenario a new connection will open and then we lose track of the results.
  3. Where there are steps that use xpath create duplicates that use css selectors, it seems that this is where some people want to go (I actually prefer xpath)

We have had to implement our own steps to do the above but it would be nice to use the standard steps instead.

Scenario Outline and Example Tables

How do I use 'behaving' with behave's scenario outline and example tables? Right now any Given, When, Then statements with '<>' are skipped and not processed by 'behaving'. I get an error steps are not implemented.

Given I should see <heading_on_page>
When I search for <query_in_search_field>
And I should see <text_in_search_result> within 15 seconds
And I click the link with text that contains <title>
Then I should see <text_in_document> within 10 seconds

If I copy the relevant steps from behaving into my own step file and remove the double quotes around the variable in the decoration, my outline passes.

@given(u'I should see {text}')
# @step(u'I should see "{text}"')
# @persona_vars
def should_see(context, text):
    assert context.browser.is_text_present(text), u'Text not found'

Project `Behave` badge?

Tools such as Black and Pre-commit have repository badges. I haven't been able to find one for Behave, does one exist?

Provide a mechanism to override predefined steps

I am using steps from a 3rd party library (behave_http)

Now I need to modify the behaviour of these steps specifically for my project

So in my steps I need a way to override the steps defined in the library.

Currently it errors out with an exception about duplicate step definition

Can not clear text in input box

I am using behaving for auto-testing. I need to clear the text in a input box so I can check the error message. I did this:

When I fill in "field-name" with ""

However I got this error:

You can implement step definitions for undefined steps with these snippets:

@when(u'I fill in "field-name" with ""')
def impl(context):
assert False

Set input box to empty is useful, hope this can be allowed.

Screenshot filename format should start with the datetime

Hello!

I was wondering if you think it'd be better if the format of the screenshot's filename start with the datetime. This might be a nitpick, but in my opinion, failing tests' screenshots would be easier to find if the files are sorted by name on explorer/finder. I'll be happy to make a PR if you think this is a good idea.

Thoughts? 😄

Personas is giving weird error

This is my traceback:

  Traceback (most recent call last):
    File "/Users/galuszkak/Projects/virtuals/evmgmt/lib/python2.7/site-packages/behave/model.py", line 1173, in run
      match.run(runner.context)
    File "/Users/galuszkak/Projects/virtuals/evmgmt/lib/python2.7/site-packages/behave/model.py", line 1589, in run
      self.func(context, *args, **kwargs)
    File "/Users/galuszkak/Projects/virtuals/evmgmt/lib/python2.7/site-packages/behaving/personas/persona.py", line 53, in replace
      value = context.persona.get_value(var)
  AttributeError: 'dict' object has no attribute 'get_value'

File uploads currently fail under Firefox, Chrome, and PhantomJS

splinter.Browser.attach_file(name, path) needs an absolute path, not a relative path.

The fix is as simple as inserting the following before line 184 in behaving\web\steps\forms.py

def i_attach(context, name, path):
    if not os.path.exists(path):
        path = os.path.join(context.attachment_dir, path)
        if not os.path.exists(path):
            assert False
    path = os.path.abspath(path)
    context.browser.attach_file(name, path)

I can do a pull request if you like as well

Issue with phantomjs left running

I've started using PhantomJS as my browser under behaving.web and I'm noticing
that it's leaving the process running after the behave run is finished. After a while,
I have a dozen background phantomjs processes each taking a 1/2G of memory each...

I don't know who's "fault" it is: behaving, behave, splinter, selenium, phantomjs etc.,
and it's unlikely to be behaving, but I thought I'd flag it so you can keep your eye
on it. If I have time, I'll try to look at the chain of execution and report back.

phantomjs 2.0.0 under Linux.

missing wait_time=timeout in 'I should not see "text" within {timeout} seconds'

It seems to me that there is a missing wait_time=timeout argument to the code below.

@step(u'I should not see "{text}" within {timeout:d} seconds')
def should_not_see_within_timeout(context, text, timeout):
assert context.browser.is_text_not_present(text), u'Text was found'

The positive tests seems to be using it OK.

@step(u'I should see "{text}" within {timeout:d} seconds')
def should_see_within_timeout(context, text, timeout):
assert context.browser.is_text_present(text, wait_time=timeout), u'Text not found'

I've checked here that the wait_time can be used with the negative text present method.

http://splinter.cobrateam.info/docs/matchers.html

Packages using the behaving Python namespace

This is realy a Request for Discussion, but I thought I'd post it here rather than sending you email,
so that the discussion can be followed by others.

Firstly, thank-you very much for writing behaving - it's saved me huge amounts of my time.

Secondly, I appreciate the way that you used Python namespace packages for your components,
and I would like to propose that as the way forward for the behave community to package up step libraries in a way for making them work together. And I like the idea of the behaving namespace being completely independent from the behave base.

I've done a proof of concept package that plugs into the behaving.cmd namespace, which
will be a step library for the standard file manipulation commands. But I just cut and pasted your layout and namespace packaging so that it should "just work" alongside behaving. See the
README at https://github.com/lampmantech/behaving.cmd

Could I ask you to take a look at the package and layout and double check that I didn't
make any mistakes in my cut and paste. I didn't bother with buildout, but perhaps travis should be put back in...

If you like the proof-of-concept, then we can suggest the layout and packaging to be the way forward for packaging step libraries. Then the behave community can work together without fragmentation and the havoc wrecked by entropy, and behaving.cmd can replace the dormant https://github.com/behave/behave4cmd , ideally under the behave project.

context.personas emptied before scenario

I was following the docs, and added context.personas = PERSONAS to before_all(). This doesn't work for me, because in before_scenario() context.personas = {} empties the dict and there are no personas available for the Given step.

Either I'm doing something wrong, or the personas dict shouldn't be emptied, or context.personas = PERSONAS should be assigned to context in before_scenario() instead - this works.

How to escape the quotes needed to parse the variable

Hi,
Any idea how to escape the quotes needed(?) to parse the variables? Tried {}/:[] with no result.

Example:
Step "#hello_$randomday_$randommonth_$randomyear" - the variables are not parsed
Step " #hello_"$randomday" _ "$randommonth" _ "$randomyear" " - the variables are parsed but I got something like this - #hello_ "1" _ "July" _"2015"

Thank you for your help with this,
Bogdan

'I press' step does not escape single quotes within text

There is logic in behaving/web/steps/links.py to handle single quotes (which will disrupt XPath) within the specified link text, but this logic is not present in the 'I press "{name"}' step in behaving/web/steps/forms.py, so usage like

I press "Dave's Books"

will fail with "Element not found".

Passing configuration information to backends

This is a Request for Enhancement, but also the identification of a broader issue across behaving namespace packages.

With behaving.web I can select the browser that will be used from a feature/step.
But in some cases, I need to configure the browser that will be called by splinter.
I may need to set firefox up with a profile, or instruct PhotomJS about the cache.

Unforunately the call that splinter makes takes very different call signatures for each brower so there is no way to do this in a generalized way. E.g. for firefox:

def __init__(self, profile=None, extensions=None, user_agent=None, profile_preferences=None, fullscreen=False, wait_time=2):

For PhantomJS

def __init__(self, user_agent=None, load_images=True, desired_capabilities=None, wait_time=2, custom_headers={}, **kwargs)

You could do this by individualized steps to parameterize each browser, but even then it would get messy, as some of these parameters are not just strings, but dictionaries.

This is a generic problem of how to configure the backend, and I think needs a generic solution. A generic solution would be then adopted by all of the packages in the
behaving namespace so that we all stay on the same page.

If you look at the approach we have taken in:
https://github.com/lampmantech/behaving.trytond

you'll see an environment.cfg file in the src/behaving/tests/features directory alongside the environment.py to parameterize the steps. This can be used
to parameterize the steps, and the reason we used configobj rather than
configparser is that it gracefully handles dictionaries or JSON. I think that something like this will be needed by behaving to parameterize the arguments to the browser instances that are created by splinter, or any other back end, like a server.

If our approach works for you, all we need to do is sync some naming conventions.
For example the section names should be the behaving namespace names,
so that we all could use the same environment.cfg file, and any client-end use
of the environment.cfg file would know that it could use any mix of all of
the possible behaving namespace packages. There may even be some common settings
in a [behaving] sections: things like verbosity, or which debugger to call on error.

missing email configuartion

i have gmail account in testing
where and how i should set config for imap or pop3 config that let behaving connect and check for new mail
i can't find it in guide there is only one line about configuration
context.mail_path = os.path.join(os.path.dirname(mypackage.file), '../../var/mail/')
this like use /var/mail old style linux internal mailing system
please help about this

mailmock not compatible with python 3.6

error: uncaptured python exception, closing channel <smtpd.SMTPChannel connected 127.0.0.1:59782 at 0x7f0c411f0898> (<class 'TypeError'>:process_message() got an unexpected keyword argument 'mail_options'

method signature needs two additional parameters mail_options and rcpt_options
possibly other changes as well

Decoding mail payload

Hi, I was using click_link_in_email step and seems like you are not encoding the payload there as in should_receive_email_containing_text for example. Is it a bug, or I'm using it wrong?

deployment of behaving 1.5.0 on PyPi is not installable

https://pypi.python.org/pypi/behaving/ lists behaving 1.5.0 as deployed and available, however a

$ pip install behaving==1.5.0

fails with a 404 not found, with the logs saying it looked for the download in https://pypi.python.org/simple/behaving/ which only lists downloads up to behaving 1.4.1

Additionally, https://pypi.python.org/pypi/behaving/1.4.1 has a green download button, whereas https://pypi.python.org/pypi/behaving/1.5.0 is missing the button.

Can't find a Behaving version that works on Python 3.9

We're trying to run file upload tests on Python 3.9, which means we need to use Selenium 4 in order to fix SeleniumHQ/selenium#8762, but there doesn't seem to be any Behaving version that we can use.

  • Behaving 2.0.0 is incompatible with Selenium 4; attempting to click on an element with steps like 'I click the link with text that contains "{text}"' results in an AttributeError: 'dict' object has no attribute 'click'
  • Behaving 3.0.0 to 3.0.4 requires Splinter 0.16.0, which is incompatible with Selenium 4 (won't install).
  • Behaving 3.0.5+ requires Python 3.10.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.