Code Monkey home page Code Monkey logo

behave's People

Contributors

blakewest avatar epiphanymachine avatar melcher avatar

Stargazers

 avatar

Watchers

 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

behave's Issues

Clicking on an object not on the page should fail

There should be a way to ensure an element is on the page when we click on it. The fact that:

find('Something not on the page').trigger('click');

Succeeds without errors seems pretty inherently wrong. Perhaps something like.

clickOn('Something not on the page');

Could fail, so find could still delegate to jquery.

Prevent clicks from being called on disabled buttons (hack for angular bug)

There's a bug/feature in angular where calling .click() or .trigger('click') on a disabled button, which would normally do nothing in a regular browser/html situation, actually propagates the click event through the stack. This means that, in our testing, clicking "Save" on a disabled save button will totally do the save action. Who knew?
Seems like behave could step in here and not click on a disabled button/link (or maybe error?). The reproducible fiddle for angular is here:

http://jsfiddle.net/e78xjvLu/3/ (angular 1.2.28). This does not appear to be an issue in 1.21

select options - buggy, not working with selecting label

I am using ng-options="o as o for o in type_options" with a fault option chosen from an array

I would like to not do this but the choose.from is not working

find('[selected]').attr('selected', false);
find('spouse').attr('selected', true).trigger('change');

it would also be cool if choose(label) was a thing

Text should perhaps go after icon

If you pass in something with a space (or maybe a #), it fails on the icon search. This is lame.

Syntax error, unrecognized expression: icon.glyphicon-Invoice #

Add in rough matching

Probably use a "~" in front of the word you pass in, and have that do a rough match.

Watch out for the ~ actually being the CSS sibling selector. Determine conflicts and what to do about them.

find has some unexpected behavior

Specifically,
Looking in the "hipaa_accept" view and the hipaaAcceptModal view on provider portal, doing a find on "~Yes, Accept for ' + patients[0].name" was returning the whole modal. I had to pass in "clickable" to the find function in order to return the button itself. This was causing the test to unexpectedly fail. Not sure why it took "clickable" to return only the button. But that's a problem.

href don't work

working:

expect($('[href="images/employeeDependentUpload.csv"]')).toBeVisible();

not working

expect(find('[href="images/employeeDependentUpload.csv"]')).toBeVisible(); <-- grabs element below correct one

expect(find('href="images/employeeDependentUpload.csv"')).toBeVisible();
expect(find('"images/employeeDependentUpload.csv"')).toBeVisible();
expect(find('images/employeeDependentUpload.csv')).toBeVisible();
expect(find('employeeDependentUpload.csv')).toBeVisible();
expect(find('~employeeDependentUpload.csv')).toBeVisible();
expect(find('~employeeDependentUpload')).toBeVisible();

Exact matching doesn't always work

To replicate:
Put this in the tempalte:
%a.btn.btn-secondary(ui-sref="^")
Back to All Invoices

Or this...
%button.btn.btn-md.btn-primary(type='submit' ng-hide="data.invoice.human_status === 'paid'" bs-modal data-template="/templates/invoices/mark_as_paid")
Mark as Paid

Do find('Mark as Paid') and it returns nothing. Or find('Back to All Invoices') and it returns nothing.

I would expect it to return the nodes in the tree that have text exactly matching those.

Find couldn't find text

Given the following html file...

<div class='signin well' test-me='user-well'>
  <app-alerts></app-alerts>
  <h3 class='text-center'>Create Account</h3>
  <form class='form-signin' name='loginForm' ng-class="{'has-error': error.bad_invite_code}">
    <div class='form-group form-group-compact'>
      <input class='form-control' name='invite_code' placeholder='Enter invite code here' autofocus='' ng-model='vm.invite_code' test-me='invite-code'>
    </div>
    <div class='form-group'>
      <span class='help-block' ng-show='vm.error.bad_invite_code' test-me='user-failed-code'>
        That invite code is incorrect. Please
        <a href='http://www.hint.com/#contact' target='_blank' test-me='get-invite-code'>contact us</a>
        to get yours!
      </span>
    </div>
    <div class='form-group'>
      <button class='btn btn-block btn-lg btn-primary' type='submit' ng-click='vm.verifyCode(vm.invite_code)' ng-disabled='!vm.invite_code' test-me='user-submit'>Create Account</button>
    </div>
  </form>
</div>

doing find('incorrect') did not return anything. Unclear why... seems like it should have found the text within the 'user-failed-code' span.

Finding multiple items when not expecting to

With the given view...

.modal(tabindex="-1" role="dialog")
  .modal-dialog
    .modal-content
      %form.form-horizontal(role='form' name='form' novalidate)
        .modal-header.text-highlight
          %a.close(ng-click="$hide()" type="button") &times;
          %h4.modal-title
            Email This Charge Receipt

        .modal-body
          %h3 Patient Information
          %p Patient DOB: 5/19/87
          .form-group
            %label.col-xs-2 Send to
            .col-xs-6.no-padding-left
              %div(ng-show="charge.patient.id === charge.account.id")
                Joe Smitherson
            .col-xs-6.no-padding-left
              %select(ng-if="charge.patient.id !== charge.account.id"
              ng-model="emailParams.type")
                %option(value='')
                  Select a recipient
                %option(value="patient_charge_receipt")
                  {{charge.patient.name}} (patient)
                %option(value="payer_charge_receipt")
                  {{charge.account.name}} (payer)
            .col-xs-2
              %a.btn.btn-primary(ng-click="sendEmail(emailParams)")
                Send Email
        .modal-footer.panel-footer
          %a.btn.btn-default(ng-click="$hide()")
            Cancel

If I do find('Joe Smitherson'), it finds multiple items. wtf?

Support contextual / restricted finds

I want to be able to test something like

  var employees = find('table.employees');
  expect(find("Joe", employees)).toBeVisible();

or maybe

  var employees = find('table.employees');
  within(employees, function(){
    expect(find('Joe')).toBeVisible();
  });

The point being that it only searches within a subset of the entire page.

unexpected behavior for find

no payment info,

if I do find('label') or find('.label'), I expect Behave to return the element.

This is when Behave.view = the above element.

fill('field-name') with multiple fields (but only one visible) fails

When there are 2 "name" fields, only one of which is visible at any one time, fill('field-name') fails because it finds them both. You have to do something like fill(findAll('field-name')[0]) or some such.
Maybe...
have fill(..) only work on visible fields. Or something else.

find vs findall vs tryfind

Proposed functionality for find/findAll:

  // Find an element
  // -- throws an exception unless results.length !== 1
  find('string') 

  // Find any/all elements
  // -- finds any number of elements (including 0)
  // -- could be used by the find function
  findAll('string') 

  // Find a specific number of elements
  // -- throws an exception unless results.length == number
  find(3, 'string')
  // alternatively
  find('string', {length: 3})

I believe this would remove the necessity for tryfind, as you could just do a findAll. This loosely borrows it's behavior/syntax from ActiveRecord, where find() will throw an exception or return 1 element and find_all just returns any number of elements and doesn't throw an exception in any case.

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.