Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Wait for the crash stats home page to finish loading #338

Merged
merged 1 commit into from
Nov 23, 2015

Conversation

davehunt
Copy link
Member

This addresses the current failures, most likely caused by Selenium clicking too soon.

Adhoc: http://webqa-ci-staging1.qa.scl3.mozilla.com:8080/job/socorro.adhoc/43/

Wait(self.selenium, self.timeout).until(
lambda s: 'loading' not in s.find_element(
*self._graph_locator).get_attribute('class'))
return self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with return self? What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns the page object. It's not essential or even used in this patch, I've just been using it in recent projects. It allows for executing code like:

page = MyPage(self.testsetup).wait_for_page_to_load()

Instead of:

page = MyPage(self.testsetup)
page.wait_for_page_to_load()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach. One additional question, have we standardized on moving the wait_for_page_to_load() out of the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of inconsistency between our suites on this. Recently I have been explicitly implementing this wait method and an open method so that instantiation is not tied with any interactions. This allows us to wait for the page to load even if we're creating it as a result of calling a method in another page object, instead of opening the page directly.

I intend to standardise this in the future by offering a page object model package that can be used and extended by our suites.

On 23 Nov 2015, at 19:33, Matt Brandt notifications@github.com wrote:

In pages/home_page.py:

@@ -24,6 +26,13 @@ def init(self, testsetup, product=None):

     if product is None:
         self.selenium.get(self.base_url)
  •    self.wait_for_page_to_load()
    
  • def wait_for_page_to_load(self):
  •    Wait(self.selenium, self.timeout).until(
    
  •        lambda s: 'loading' not in s.find_element(
    
  •            *self._graph_locator).get_attribute('class'))
    
  •    return self
    
    I like this approach. One additional question, have we standardized on moving the wait_for_page_to_load() out of the constructor?


Reply to this email directly or view it on GitHub.

@m8ttyB
Copy link
Contributor

m8ttyB commented Nov 23, 2015

r+ and woot for battling the stability gremlins

red_green

m8ttyB pushed a commit that referenced this pull request Nov 23, 2015
Wait for the crash stats home page to finish loading
@m8ttyB m8ttyB merged commit e051fcb into mozilla:master Nov 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants