Попытка «разморозить» годовалый проект и увидеть некоторые странные ошибки JavaScript. Мне не повезло в поисках решения.
Я предполагаю, что это как-то связано с тем, что на моем устройстве dev слишком свежо (или слишком старое) для работы с этой кодовой базой, но не уверен, что это лучший способ устранить это.
Есть мысли, как с этим справиться?
Спасибо за любую помощь!
Вот спецификация:
# ./spec/support/helpers/comments_page_helpers
...
def open_image_comments_modal(section_position:, photo_position:)
selector = "editable-section:nth-child(#{section_position}) " \
"li.photo:nth-child(#{photo_position})"
within selector do
find('a.image-wrapper img').click ### <== line #23
end
expect(page).to have_css('.modal-comments-container')
end
...
и сбой:
5) Comment creation for image behaves like added comment adds single comment
Failure/Error: find('a.image-wrapper img').click
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).
Possibly unhandled rejection: {"data":{"message":"unauthorized"},"status":401,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/v1/comments","params":{"commentable_id":4179,"commentable_type":"Attachment"},"headers":{"Accept":"application/json"}},"statusText":"Unauthorized "}
Possibly unhandled rejection: {"data":{"message":"unauthorized"},"status":401,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/v1/comments","params":{"commentable_id":4179,"commentable_type":"Attachment"},"headers":{"Accept":"application/json"}},"statusText":"Unauthorized "}
at http://127.0.0.1:50066/assets/application-f59647de5de8bec0c768ec8da4dfa097f8e2db01844d3e5d71b6a6dd8b15abfb.js:26422
Shared Example Group: "added comment" called from ./spec/features/comments/creation_spec.rb:76
# ./spec/support/helpers/comments_page_helpers.rb:23:in `block in open_image_comments_modal'
# ./spec/support/helpers/comments_page_helpers.rb:22:in `open_image_comments_modal'
# ./spec/features/comments/creation_spec.rb:69:in `block (3 levels) in <top (required)>'