small medium large xlarge

Generic-user-small
03 Jan 2018, 23:03
Denis S Dujota (13 posts)

having a hard time trying to get all this error fixed, it gives me the hint that i should just set the ignore JS error, but that seems like a bandaid solution considering i cant even tell what the error is.

i checked the markup and it should be filling in the name and password as expected not sure why its breaking at the log in button unless it’s something else i am not catching

Randomized with seed 55471

Customer Search
Hello World from Webpacker
Hello World from Webpacker
  Search by Name (FAILED - 1)

Failures:

  1) Customer Search Search by Name
     Failure/Error: click_button "Log in"
     
     Capybara::Poltergeist::JavascriptError:
       One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
     
       TypeError: undefined is not a constructor (evaluating 'Object.assign({}, merged, opt)')
       TypeError: undefined is not a constructor (evaluating 'Object.assign({}, merged, opt)')
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:25247
           at :0 in reduce
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:25247 in combine
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:25097
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:20 in __webpack_require__
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:17126
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:20 in __webpack_require__
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:60006
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:20 in __webpack_require__
           at http://127.0.0.1:61132/packs-test/customers-76cdc7aa0db0aea04fea.js:63
     # ./spec/features/customer_search_spec.rb:51:in `block (2 levels) in <top (required)>'

Top 1 slowest examples (4.51 seconds, 98.2% of total time):
  Customer Search Search by Name
    4.51 seconds ./spec/features/customer_search_spec.rb:45

Finished in 4.59 seconds (files took 2.66 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/customer_search_spec.rb:45 # Customer Search Search by Name

Randomized with seed 55471
Dmfcb_pragsmall
04 Jan 2018, 13:24
David Copeland (511 posts)

Does it work when you try it in your browser? Often this stuff happens because the JS is broken and you should see it dev mode by trying it outside a test. You can also try commenting out JS until the problem goes away and then adding it back in to figure out what is wrong.

Generic-user-small
04 Jan 2018, 14:01
Denis S Dujota (13 posts)

The first thing i tried was logging out, then going to /customers and logging in, which then brought me to the search page as expected, the search worked as expected.

i double checked my install of phantomJS which was a pain to get it working. (PS- i had to use brew install phantomJS as the standalone download file provided by them would not carry over to the project, might be worth noting)

i thought about your suggestion, but where do i start? Comment out parts of the Angular view? The login page is Devise, not JS so i am a bit confused about what to start commenting and feel like I am just shooting in the dark

the console does not throw any errors at me either


Update - went to your source code, copied and pasted your source code for the angular view to see if it would behave differently, and no change.

Update 2 - did some googling and found out that the error I was getting was part of the

import “babel-polyfill”;

Generic-user-small
04 Jan 2018, 14:08
Denis S Dujota (13 posts)

now that i can finally get past the log in error using import babel/pollyfill;

new issue:

Customer Search
Hello World from Webpacker
Hello World from Webpacker
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
  Search by Name (FAILED - 1)

Failures:

  1) Customer Search Search by Name
     Failure/Error:
           within "section.search-results" do
             expect(page).to have_content("Results")
             expect(page.all("ol li.list-group-item").count).to eq(4)
       
             list_group_items = page.all("ol li.list-group-item")
       
             expect(list_group_items[0]).to have_content("Patricia")
             expect(list_group_items[0]).to have_content("Dobbs")
             expect(list_group_items[3]).to have_content("I.T.")
             expect(list_group_items[3]).to have_content("Pat")
     
     Capybara::Poltergeist::JavascriptError:
       One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
     
       ERROR ReferenceError: Can't find variable: Intl
       ERROR ReferenceError: Can't find variable: Intl
           at :0 in error
       ERROR CONTEXT [object Object]
       ERROR CONTEXT [object Object]
           at :0 in error
     # ./spec/features/customer_search_spec.rb:57:in `block (2 levels) in <top (required)>'

Top 1 slowest examples (18.49 seconds, 99.5% of total time):
  Customer Search Search by Name
    18.49 seconds ./spec/features/customer_search_spec.rb:45

Finished in 18.58 seconds (files took 2.92 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/customer_search_spec.rb:45 # Customer Search Search by Name

Randomized with seed 50859
Generic-user-small
04 Jan 2018, 18:46
Denis S Dujota (13 posts)

OK! Passing spec now !!

1.) what i learned, i need babel to fix the login issue to work with the new versions of JS

2.) using a date formatter will break the test, i had to remove

 | date: format : "mediumDate" 

here is the passing spec

Randomized with seed 40637

Customer Search
Hello World from Webpacker
Hello World from Webpacker
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
  Search by Name

Top 1 slowest examples (18.3 seconds, 99.6% of total time):
  Customer Search Search by Name
    18.3 seconds ./spec/features/customer_search_spec.rb:45

Finished in 18.38 seconds (files took 2.84 seconds to load)
1 example, 0 failures

Randomized with seed 40637

Source material that helped me through these problems: https://stackoverflow.com/questions/36993962/installing-phantomjs-on-mac

https://github.com/angular/universal/issues/516

https://github.com/babel/babel-brunch/issues/59

You must be logged in to comment