These are chat archives for reactioncommerce/reaction

29th
Jul 2015
Aaron Judd
@aaronjudd
Jul 29 2015 01:29
@boboci9 fixed in development.

@mikemurray
testing both core (or any other package) + app at the same time in the velocity control panel:

meteor add xolvio:cucumber

1: App testing must be cucumber
2: symlink reaction/tests/jasmine to packages/core/tests/

Note: I have all packages in a packages dir outside of the app. I do not symlink them. I use PACKAGE_DIRS=
I am also now using the bin/clone-packages.sh script to checkout all reaction packages - but use at your own risk. set PACKAGES_DIRS first!
I have been unable to get jasmine tests in the app and packages functioning at the same time. (but the current structure is needed for the CLI testing to work properly).

This might be our best bet for end to end testing for the moment pending updates from velocity.
Bogi
@boboci9
Jul 29 2015 07:27
:+1:
Bogi
@boboci9
Jul 29 2015 10:23

Hi all, I am making some testing with the productPublish method and although the function is being executed and the the isVisible flag is changed correctly I always get a server error

Exception while invoking method 'publishProduct' Error: Did not check() all arguments during call to 'publishProduct'

although all the arguments are checked in the function

publishProduct: (productId) ->
    check productId, String
    unless ReactionCore.hasPermission('createProduct')
      throw new Meteor.Error 403, "Access Denied"
    @unblock()

    product = ReactionCore.Collections.Products.findOne(productId)
    #one variant required to publish product
    if product?.variants[0].price and product?.variants[0].title and product?.title
      # log this
      ReactionCore.Events.info "toggle product visibility ", product._id, !product.isVisible
      # toggle isVisible
      result = Products.update product._id, {$set: {isVisible: !product.isVisible}}
      return Products.findOne(product._id).isVisible
    else
      # debug log this
      ReactionCore.Events.debug "invalid product visibility ", productId
      # non-informative error
      throw new Meteor.Error 400, "Bad Request"

Can anyone help me in what am I missing?

Aaron Judd
@aaronjudd
Jul 29 2015 14:11
is there another (invalid) argument being passed to publishProduct somewhere? or productId is missing?
Bogi
@boboci9
Jul 29 2015 14:29
productId is there and the functionality is working
the isVisible flag is changed
Spencer Norman
@spencern
Jul 29 2015 14:29
Is anything else getting passed to publishProduct?
audit-argument-check will throw that error if you pass an argument that is not getting checked at all
Aaron Judd
@aaronjudd
Jul 29 2015 14:32
there is one call to publishProduct that is using a callback.. that’s the only case I could find in the code where there was more than a simple call + argument
Bogi
@boboci9
Jul 29 2015 14:58
Then it must be coming from my calls sorry
Spencer Norman
@spencern
Jul 29 2015 16:35
Do I need to do anything to get tests to run on a new package within reaction other than add test files within the package?
Aaron Judd
@aaronjudd
Jul 29 2015 16:37
no, but it can be a bit tricky - see comment earlier:re cucumber. you can run CLI tests all day, the package tests may not show up in the “velocity console” unless you symlink them and don’t have any other tests in reaction/tests (or use cucumber at the app level)
this is a “velocity” issue that hopefully will be resolved soon (so close, yet so far)
Spencer Norman
@spencern
Jul 29 2015 16:38
yeah, so I need to symlink the tests directory into the app level tests directory still to get them to show up in velocity?
in the velocity on-page ui that is
Aaron Judd
@aaronjudd
Jul 29 2015 16:39
the trick is -> with onTest - they only run with meteor test or meteor test-packages
but by symlinking them, you are adding to the app, and it will find them
(see the circle.yml for example on running them on the CLI)
Spencer Norman
@spencern
Jul 29 2015 16:40
thanks
Spencer Norman
@spencern
Jul 29 2015 16:55
To document this for future-me who will need this again. Symlinking the tests js file into the app level tests directory has the tests running as expected in the velocity console.
And they will work just running meteor
Aaron Judd
@aaronjudd
Jul 29 2015 17:05
:thumbsup: (yeah you don’t need to use meteor test unless running CLI tests)
Spencer Norman
@spencern
Jul 29 2015 17:05
Followup question: I’m having trouble getting my factories recognized in a new package, anythign special I need to do there?
Aaron Judd
@aaronjudd
Jul 29 2015 17:05
I’ve noticed some odd discrepencies (things that pass on the console, but not the CLI) so I’d recommmend testing with CLI before you call it a day
Spencer Norman
@spencern
Jul 29 2015 17:05
That’s good to know
Aaron Judd
@aaronjudd
Jul 29 2015 17:06
I’m not sure about the Factories
Spencer Norman
@spencern
Jul 29 2015 17:06
:thumbsup: I’ll explore it a bit
Aaron Judd
@aaronjudd
Jul 29 2015 17:06
maybe add to your package.onUse
Spencer Norman
@spencern
Jul 29 2015 17:07
yeah, good call
Aaron Judd
@aaronjudd
Jul 29 2015 17:07
(although I think we do api.imply on it in core)
Spencer Norman
@spencern
Jul 29 2015 18:23
Ok, so I have the CLI tests working with the latest dev branch of the app and core (using the circle.yml line to run tests), but can’t get the velocity-reporter to run the tests. I’ve added velocity:html-reporter and sanjo:jasmine to the packages list, and the reporter is recognizing the files, but no dice on any tests running
Aaron Judd
@aaronjudd
Jul 29 2015 18:30
did you delete reaction/tests/jasmine (you can only have one) if you are symlinking a package
Spencer Norman
@spencern
Jul 29 2015 18:37
i did
does stream error Network error ws://localhost:3000/websocket: connect ECONNREFUSED mean anything to you?
I feel like I’ve been seeing this for a while and the tests were running before, but not sure now
Aaron Judd
@aaronjudd
Jul 29 2015 18:38
it’s a non-issue - part of the velocity startup
Michael Jenny
@prinzdezibel
Jul 29 2015 19:30
@aaronjudd Hi Aaron, what's the reason behind using swiper for the cart? Wouldn't native scroll be good enough?
Aaron Judd
@aaronjudd
Jul 29 2015 19:33
that’s mostly about the mobile experience (swipable) - I don’t remember the specifics but native scroll didn’t handle the mobile stuff well. I expect that will get refactored out at some point for a more native solution though
Spencer Norman
@spencern
Jul 29 2015 22:48
Answer for the testing issues I’m having, is that I’m just bad at following directions. Adding the onTest section to my package has cleared up some of my issues.
Aaron Judd
@aaronjudd
Jul 29 2015 22:56
@spencern considering how long it took me to get the tests “working” in CI - I don’t think it’s you :worried: