0
votes

SitePrism has been working great for my automation project until I needed to get a handle on a particular ReactModal object that works with straight capybara find command but not in SitePrism. I would really appreciate any help with this issue.

calling find in pry debugger with would work

pry(#RSpec::Core::ExampleGroup::Nested_1)> find "div:nth-child(18) > div > div > div"

=> # "div:nth-child(18) > div > div > div"

pry(#RSpec::Core::ExampleGroup::Nested_1)> find find "div:nth-child(18) > div > div > div"

=> # "div:nth-child(18) > div > div > div"

however calling SitePrism object @videos_page.clipping would result in error

pry(#RSpec::Core::ExampleGroup::Nested_1)>@videos_page.clipper ArgumentError: wrong number of arguments (given 2, expected 0) from /Users/kpham/.rvm/gems/ruby-2.3.0@social/gems/site_prism-2.9/lib/site_prism/element_container.rb:28:in initialize'

pry(#RSpec::Core::ExampleGroup::Nested_1)>@videos_page.clipping ArgumentError: wrong number of arguments (given 2, expected 0) from /Users/kpham/.rvm/gems/ruby-2.3.0@social/gems/site_prism-2.9/lib/site_prism/element_container.rb:28:ininitialize'

class ClippingDialog <SitePrism::Page
    element :header, ".bc-modal-header h3"
    element :close, ".bc-close"
    section :body, ClippingDialogBody, ".bc-modal-body"
    section :footer, ClippingDialogFooter, ".bc-modal-footer"
end

class VideosPage <SitePrism::Page
    set_url "/videos"
    section :clipper, ClippingDialog, ".bc-dialog.bc-dialog-clipping"
    section :clipping, ClippingDialog, "div:nth-child(18) > div > div > div"
end

<div class="ReactModalPortal">
    <div class="ReactModal__Overlay ReactModal__Overlay--after-open bc-modal bc-modal-clipping" data-reactid=".2">
        <div class="ReactModal__Content ReactModal__Content--after-open bc-modal-content bc-modal-content-clipping" tabindex="-1" data-reactid=".2.0">
            <div role="dialog" class="bc-dialog bc-dialog-clipping" data-reactid=".2.0.0">
1

1 Answers

0
votes

Found the issue with my section definition, cut and paste error.

class ClippingDialog <SitePrism::Page 

should be:

class ClippingDialog <SitePrism::Section

My issue is resolved.