<div dir="ltr"><br><div>I see a couple of issues here. The line you have (and other lines in that steps file) is: </div><div><br></div><div><div>on(MainPage).project_tile_element.div(class: 'tux-statsbar').should_not be_visible</div>
</div><div><br></div><div>First of all, please define the elements in the page in a PageObject in the directory features/support/pages/main_page.rb, for example <br>------</div><div><div>class MainPage</div><div> include PageObject</div>
<div><br></div><div> include URL</div><div> page_url URL.url('Special:Mainpage')</div><div><br></div><div> div(:project_tile, class: 'tux-statsbar')</div><div>end</div><div>-----</div><div><br></div><div>
You should never define a page element in a test step. It makes the test difficult to debug and nearly impossible to maintain over time. Page elements should only ever be defined within a PageObject. </div><div><br></div>
<div>Once you've done that, the line in the steps file becomes: </div><div><br></div><div>on(MainPage).project_tile_element.should_not be_visible<br></div><div><br></div><div>which is valid. </div><div><br></div><div>
If that check does not pass, you may have to wait for project_tile to disappear: </div><div><br></div><div><div>on(MainPage) do |page|</div><div> page.wait_until(10) do</div><div> page.text.include? 'Something '</div>
<div> #OR ANY CONDITION</div><div> end</div><div> page.project_tile_element.should_not be_visible</div><div> end</div></div><div><br></div><div><br></div></div><div><br></div><div><br></div><div><br></div><div>
<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 27, 2013 at 6:55 PM, Amir E. Aharoni <span dir="ltr"><<a href="mailto:amir.aharoni@mail.huji.ac.il" target="_blank">amir.aharoni@mail.huji.ac.il</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Hi,<br><br></div><div dir="ltr">I am trying to check that an element does not appear:<br>
<a href="https://gerrit.wikimedia.org/r/#/c/86348/1/tests/browser/features/step_definitions/signed_in_source_language_steps.rb" target="_blank">https://gerrit.wikimedia.org/r/#/c/86348/1/tests/browser/features/step_definitions/signed_in_source_language_steps.rb</a><br>
<br></div><div dir="ltr">I tried to do <element>.<span>should_not be_visible, but apparently that is invalid.<br><br></span></div><div dir="ltr"><span>What is the most robust way to do it?<br><br>
Thanks!<br>
</span></div><div><div><br>--<br>Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי<br><a href="http://aharoni.wordpress.com" target="_blank">http://aharoni.wordpress.com</a><br>“We're living in pieces,<br>I want to live in peace.” – T. Moore</div>
</div></div>
<br>_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org">QA@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/qa" target="_blank">https://lists.wikimedia.org/mailman/listinfo/qa</a><br>
<br></blockquote></div><br></div>