mad-eye / meteor-mocha-web

easily and safely run mocha tests within the Meteor framework
MIT License
145 stars 46 forks source link

cross origin frame error (CORS?) #147

Open dcsan opened 9 years ago

dcsan commented 9 years ago

I'm getting this with meteor 1.1

image

however the "Mocha iframe" will display just fine...

any ideas?

dcsan commented 9 years ago

when i run the testing from CLI i get varying results - sometimes runs and sometimes doesn't.


➜  chatu git:(tests-breaking) ✗ cat bin/velo-test.sh 
#!/usr/bin/env bash
cd app
meteor --test --settings private/config/local.json

➜  chatu git:(tests-breaking) ✗ bin/velo-test.sh 
stream error Network error: ws://localhost:3000/websocket: connect ECONNREFUSED
-- PubSubMan.usepackages                     \
-- cards.useing packages                     \
-- chatabox.use packages                     \
-- airtable.use packages                     |
-- Inbox.useing packages                     |
-- layout.on_usepackages                     |
-- pairs.on_use packages                     |
-- pairs.on_use packages                     |
-- Storybot.use packages                     |
-- Trix.on_useg packages                     |
I20150401-12:18:57.916(-7)? PubSubMan.init    
I20150401-12:18:57.918(-7)? publishing
I20150401-12:18:57.919(-7)? makeExportable Chatrooms
I20150401-12:18:58.009(-7)? _setup stories
I20150401-12:18:58.009(-7)? parse appRoutes
I20150401-12:18:58.009(-7)? create server routes
I20150401-12:18:58.718(-7)? lessonByName { deleted: { '$ne': true }, cname: 'about' } count: 1
I20150401-12:18:58.726(-7)? chatroomByName { deleted: { '$ne': true }, cname: 'about' } count: 1
I20150401-12:18:58.730(-7)? sub PlayerTasks { story: 'about' }
I20150401-12:18:58.730(-7)? Player.tasks find ok { story: 'about' }
PASSED mocha : start here:Lessons => is accessible in the list of lessons
FAILED mocha : start here:Lessons => contains the button 'next'
Error: Uncaught SecurityError: Blocked a frame with origin "http://localhost:5000" from accessing a cross-origin frame. (http://localhost:5000/packages/mike_mocha.js?81e347a16dc440779b8caa4163b6179df74c6bfc:10145)
    at global.onerror (http://localhost:5000/packages/mike_mocha.js?81e347a16dc440779b8caa4163b6179df74c6bfc:5774:10)
FAILED mocha : start here:Lessons => Jenny appears after click on 'next'
Error: Uncaught SecurityError: Blocked a frame with origin "http://localhost:5000" from accessing a cross-origin frame. (http://localhost:5000/packages/mike_mocha.js?81e347a16dc440779b8caa4163b6179df74c6bfc:10145)
    at global.onerror (http://localhost:5000/packages/mike_mocha.js?81e347a16dc440779b8caa4163b6179df74c6bfc:5774:10)
FAILURE
➜  chatu git:(tests-breaking) ✗ bin/velo-test.sh
stream error Network error: ws://localhost:3000/websocket: connect ECONNREFUSED
-- PubSubMan.use                             \
-- cards.use                                 \
-- chatabox.use packages                     \
-- airtable.use packages                     |
-- Inbox.useing packages                     |
-- layout.on_usepackages                     |
-- pairs.on_use packages                     |
-- pairs.on_use packages                     |
-- Storybot.use packages                     |
-- Trix.on_useg packages                     |
I20150401-12:19:46.183(-7)? PubSubMan.init    
I20150401-12:19:46.184(-7)? publishing
I20150401-12:19:46.184(-7)? makeExportable Chatrooms
I20150401-12:19:46.264(-7)? _setup stories
I20150401-12:19:46.264(-7)? parse appRoutes
I20150401-12:19:46.264(-7)? create server routes
PASSED mocha : start here:Lessons => is accessible in the list of lessons
I20150401-12:19:53.835(-7)? lessonByName { deleted: { '$ne': true }, cname: 'about' } count: 1
I20150401-12:19:53.838(-7)? chatroomByName { deleted: { '$ne': true }, cname: 'about' } count: 1
I20150401-12:19:53.855(-7)? sub PlayerTasks { story: 'about' }
I20150401-12:19:53.855(-7)? Player.tasks find ok { story: 'about' }
FAILED mocha : start here:Lessons => contains the button 'next'
undefined
FAILED mocha : start here:Lessons => Jenny appears after click on 'next'
undefined
FAILURE
rissem commented 9 years ago

Hmm possibly a race condition reporting to the parent process?

Could you include a list of packages that your app uses? Or even more awesome would be a reproduction repo.

dcsan commented 9 years ago

hi -

Could you include a list of packages that your app uses?

there's a fair number of packages in the app, listed below

Or even more awesome would be a reproduction repo.

I could open up the private repo to you if that would help, but that's a bit too much to ask of you.

➜  chatu git:(tests) cat app/.meteor/versions
accounts-base@1.2.0
accounts-password@1.1.1
aldeed:collection2@2.3.3
aldeed:simple-schema@1.3.2
aldeed:template-extension@3.4.3
amplify@1.0.0
autoupdate@1.2.1
babrahams:editable-json@0.3.13
base64@1.0.3
binary-heap@1.0.3
blaze@2.1.1
blaze-tools@1.0.3
boilerplate-generator@1.0.3
callback-hook@1.0.3
chatu:cards@0.0.1
chatu:thunk@0.0.1
check@1.0.5
coffeescript@1.0.6
dburles:collection-helpers@1.0.2
dburles:mongo-collection-instances@0.3.3
dcsan:apubsubman@0.0.1
dcsan:chatabox@0.0.1
dcsan:dclib@0.0.2
dcsan:extdata@0.0.1
dcsan:inbox@0.0.1
dcsan:ionic@0.1.17_6
dcsan:layout@0.0.1
dcsan:mpgames@0.0.2
dcsan:pairs@0.0.2
dcsan:ribot@0.0.1
dcsan:ribot-editor@0.0.2
dcsan:slots@0.0.1
dcsan:streamer@0.0.1
dcsan:trix@0.0.2
ddp@1.1.0
deps@1.0.7
ejson@1.0.6
email@1.0.6
fastclick@1.0.3
fortawesome:fontawesome@4.3.0
fourseven:scss@2.0.1_5
geojson-utils@1.0.3
gwendall:session-json@0.1.7
html-tools@1.0.4
htmljs@1.0.4
http@1.1.0
id-map@1.0.3
iron:controller@1.0.7
iron:core@1.0.7
iron:dynamic-template@1.0.7
iron:layout@1.0.7
iron:location@1.0.7
iron:middleware-stack@1.0.7
iron:router@1.0.7
iron:url@1.0.7
jquery@1.11.3_2
json@1.0.3
lai:collection-extensions@0.1.3
launch-screen@1.0.2
less@1.0.14
livedata@1.0.13
localstorage@1.0.3
logging@1.0.7
meteor@1.1.6
meteor-platform@1.2.2
meteorhacks:async@1.0.0
meteorhacks:kadira@2.20.1
meteorhacks:meteorx@1.3.1
meteorhacks:npm@1.3.0
meteorhacks:subs-manager@1.3.0
meteoric:ionic-sass@0.1.9
meteoric:ionicons-sass@0.1.6
meteortoys:toykit@0.2.2
mike:mocha@0.5.2
minifiers@1.1.5
minimongo@1.0.8
mobile-status-bar@1.0.3
momentjs:moment@2.9.0
mongo@1.1.0
mongo-livedata@1.0.8
mquandalle:jade@0.4.1
msavin:mongol@1.0.8
natestrauser:select2@3.5.1
npm-bcrypt@0.7.8_2
npm-container@1.0.0
observe-sequence@1.0.6
ordered-dict@1.0.3
pcel:toastr@1.0.1
practicalmeteor:chai@1.9.2_3
practicalmeteor:loglevel@1.1.0_3
random@1.0.3
reactive-dict@1.1.0
reactive-var@1.0.5
reload@1.1.3
retry@1.0.3
routepolicy@1.0.5
sergeyt:d3@3.4.1
service-configuration@1.0.4
session@1.1.0
sha@1.0.3
spacebars@1.0.6
spacebars-compiler@1.0.6
srp@1.0.3
stylus@1.0.7
templating@1.1.1
tracker@1.0.7
udondan:yml@3.2.2_1
ui@1.0.6
underscore@1.0.3
url@1.0.4
velocity:core@0.4.5
velocity:html-reporter@0.3.2
velocity:node-soft-mirror@0.3.1
velocity:shim@0.1.0
velocity:test-proxy@0.0.4
velocityjs:velocityjs@1.2.1
webapp@1.2.0
webapp-hashing@1.0.3
dcsan commented 9 years ago

it looks like the ordering is different on each of those test runs. I do have some debug in there to tell what's happening.

the start of the tests does have some code to load up data, which can take a while but the format looks fine i think:

MochaWeb?.testOnly ->
  describe "Lessons", ->
    before (done)->
      @timeout(20000)
      Meteor.call 'reloadAll', ->
        done()

    describe "start here", ->
      it "is accessible in the list of lessons", (done)->

        # setTimeout ->
        #   $('a[href="/lessons"]').click()
        #   setTimeout ->
        #     console.log($('.imageBox'))
        #     chai.assert.equal($('.imageBox > .title.item-text-wrap:contains("Start here")').length, 1)
        #     done()
        #   , 100
        # , 100

        chai.assert.lengthOf($('a[href="/lessons"]'), 1, "there is Lessons link")
        $('a[href="/lessons"]').click()
        setTimeout ->
          chai.assert.lengthOf($('.imageBox > .title.item-text-wrap:contains("Start here")'), 1, "there is 'Start here' button")
          done()
        , 100