Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #290 from OrlandoSoto/master
Browse files Browse the repository at this point in the history
updated tests for links that open in new tab in production
  • Loading branch information
ascott1 committed Jan 8, 2015
2 parents 838d34b + eb00481 commit 4848336
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 29 deletions.
21 changes: 10 additions & 11 deletions test/browser_testing/features/loan_conventional.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ Examples:
@loan_options @prod_only
Scenario Outline: Test Navigational outbound links in the Conventional Loan page
When I click on the "<link_name>" link
Then I should be directed to the external "<full_url>" URL
And I should see "<page_title>" displayed in the page title
Then I should see the "<relative_url>" URL with page title <page_title> open in a new tab

Examples:
| link_name | full_url | page_title |
| Fannie Mae or Freddie Mac | /askcfpb/1959/what-are-fannie-mae-and-freddie-mac.html | Consumer Financial Protection Bureau |
| unless youre buying a home with multiple units | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | Consumer Financial Protection Bureau |
| Maximum loan amount varies by county | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | Consumer Financial Protection Bureau |
| Good Faith Estimates | /askcfpb/146/what-is-a-good-faith-estimate-what-is-a-gfe.html | Consumer Financial Protection Bureau |
| Learn more about mortgage insurance | /askcfpb/1953/what-is-mortgage-insurance-and-how-does-it-work.html | Consumer Financial Protection Bureau |
| What are Fannie Mae and Freddie Mac? | /askcfpb/1959/what-are-fannie-mae-and-freddie-mac.html | Consumer Financial Protection Bureau |
| How can I find the loan limit for a conforming loan in my county? | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | Consumer Financial Protection Bureau |
| What is a Good Faith Estimate? | /askcfpb/146/what-is-a-good-faith-estimate-what-is-a-gfe.html | Consumer Financial Protection Bureau |
| link_name | relative_url | page_title |
| Fannie Mae or Freddie Mac | /askcfpb/1959/what-are-fannie-mae-and-freddie-mac.html | What are Fannie Mae and Freddie Mac? |
| unless youre buying a home with multiple units | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | How can I find the loan limit for a conforming loan in my county? |
| Maximum loan amount varies by county | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | How can I find the loan limit for a conforming loan in my county? |
| Good Faith Estimates | /askcfpb/146/what-is-a-good-faith-estimate-what-is-a-gfe.html | What is a Good Faith Estimate? What is a GFE? |
| Learn more about mortgage insurance | /askcfpb/1953/what-is-mortgage-insurance-and-how-does-it-work.html | What is mortgage insurance and how does it work? |
| What are Fannie Mae and Freddie Mac? | /askcfpb/1959/what-are-fannie-mae-and-freddie-mac.html | What are Fannie Mae and Freddie Mac? |
| How can I find the loan limit for a conforming loan in my county? | /askcfpb/1961/how-can-i-find-the-loan-limit-for-a-conforming-loan-in-my-county.html | How can I find the loan limit for a conforming loan in my county? |
| What is a Good Faith Estimate? | /askcfpb/146/what-is-a-good-faith-estimate-what-is-a-gfe.html | What is a Good Faith Estimate? What is a GFE? |

@smoke_testing @loan_options
Scenario Outline: Test OTHER LOAN TYPES links in the Conventional Loan page
Expand Down
52 changes: 34 additions & 18 deletions test/browser_testing/features/pages/rate_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
LOAN_TYPE_DDL = "loan-type" # LOAN TYPE DROPDOWN LIST
LOCATION_DDL = "location" # LOCATION DROPDOWN LIST
RATE_STRUCTURE_DDL = "rate-structure" # RATE STRUCTURE DROPDOWN LIST
COUNTY_DLL = "county" # COUNTY DROPDOWN LIST
COUNTY_DLL = "county" # COUNTY DROPDOWN LIST

# ELEMENT ID'S FOR LABELS/WARNINGS
LOAN_AMOUNT_LABEL = "loan-amount-result" # LOAN AMOUNT LABEL
Expand Down Expand Up @@ -97,7 +97,6 @@ def get_hb_alert_text(self, alert_text):
element = self.driver.find_element_by_css_selector(HB_WARNING)
return element.text


def is_hb_alert_hidden(self, alert_text):
l_wait = 5
msg = 'HB alert text was not visible within %s seconds' % l_wait
Expand All @@ -106,8 +105,8 @@ def is_hb_alert_hidden(self, alert_text):
WebDriverWait(self.driver, l_wait)\
.until(EC.text_to_be_present_in_element((By.CSS_SELECTOR,
HB_WARNING_HIDDEN), alert_text), msg)
element = self.driver.find_element_by_css_selector(HB_WARNING_HIDDEN)
return element.text
e = self.driver.find_element_by_css_selector(HB_WARNING_HIDDEN)
return e.text
except TimeoutException:
return False

Expand All @@ -116,8 +115,8 @@ def get_dp_alert_text(self, alert_text):
msg = "Element %s not found after %s seconds" % (DP_WARNING, l_wait)

WebDriverWait(self.driver, 5)\
.until(lambda s: (s.find_element_by_css_selector(DP_WARNING)), msg)
.until(lambda s: (s.find_element_by_css_selector(DP_WARNING)), msg)

return self.driver.find_element_by_css_selector(DP_WARNING).text

# CHART AREA
Expand All @@ -139,7 +138,7 @@ def is_chart_faded(self):
try:
WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
CHART_FADED)))
CHART_FADED)))
return True
except TimeoutException:
return False
Expand All @@ -150,7 +149,7 @@ def is_chart_loaded(self):
try:
WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
CHART_NOT_FADED)))
CHART_NOT_FADED)))
return True
except TimeoutException:
return False
Expand Down Expand Up @@ -210,7 +209,7 @@ def set_location(self, state_name):
select.select_by_visible_text(state_name)

WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
CHART_NOT_FADED)), msg)

# HOUSE PRICE
Expand Down Expand Up @@ -242,8 +241,9 @@ def get_down_payment_percent(self):

# Wait for the dp percentage to change from the default amount of 10
try:
WebDriverWait(self.driver, 5)\
.until(lambda s: (s.find_element_by_id(DOWN_PAYMENT_PERCENT).get_attribute("value")) != "10")
WebDriverWait(self.driver, 2)\
.until(lambda s: (s.find_element_by_id(DOWN_PAYMENT_PERCENT)
.get_attribute("value")) != "10")
return element.get_attribute("value")
except TimeoutException:
return element.get_attribute("value")
Expand Down Expand Up @@ -274,8 +274,10 @@ def get_down_payment_amount(self):

# Wait for the dp amount to change from the default amount of 20,000
try:
WebDriverWait(self.driver, 5)\
.until(lambda s: (s.find_element_by_id(DOWN_PAYMENT_AMOUNT_TBOX).get_attribute("value")) != "20,000")
WebDriverWait(self.driver, 2)\
.until(lambda s: (s.find_element_by_id
(DOWN_PAYMENT_AMOUNT_TBOX)
.get_attribute("value")) != "20,000")
return element.get_attribute("value")
except TimeoutException:
return element.get_attribute("value")
Expand All @@ -291,10 +293,11 @@ def set_down_payment_amount(self, down_payment):
# LOAN AMOUNT
def get_loan_amount(self):
# Get the text from the Loan Amount label
# Wait for the loan amount to change from the default amount of $180,000
# Wait for the loan amount to change from the default amount ($180,000)
try:
WebDriverWait(self.driver, 2)\
.until(lambda s: (s.find_element_by_id(LOAN_AMOUNT_LABEL).text) != "$180,000")
.until(lambda s: (s.find_element_by_id(LOAN_AMOUNT_LABEL)
.text) != "$180,000")
return self.driver.find_element_by_id(LOAN_AMOUNT_LABEL).text
except TimeoutException:
return self.driver.find_element_by_id(LOAN_AMOUNT_LABEL).text
Expand All @@ -315,7 +318,7 @@ def is_county_highlighted(self):
try:
WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
css)), msg)
css)), msg)
return True
except TimeoutException:
return False
Expand All @@ -328,7 +331,7 @@ def set_county(self, county_name):
WebDriverWait(self.driver, l_wait)\
.until(EC.text_to_be_present_in_element((By.ID,
COUNTY_DLL), county_name), msg)

select = Select(self.driver.find_element_by_id(COUNTY_DLL))
select.select_by_visible_text(county_name)

Expand Down Expand Up @@ -407,7 +410,7 @@ def is_loan_type_highlighted(self):
try:
WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
css)), msg)
css)), msg)
return True
except TimeoutException:
return False
Expand All @@ -432,6 +435,19 @@ def is_arm_type_visible(self):
except NoSuchElementException:
return True

def is_arm_type_highlighted(self):
css = ".highlight-dropdown #" + ARM_TYPE_DDL
l_wait = 2
msg = '%s not found after %s seconds' % (css, l_wait)

try:
WebDriverWait(self.driver, l_wait)\
.until(EC.presence_of_element_located((By.CSS_SELECTOR,
css)), msg)
return True
except TimeoutException:
return False

# TABS AND LINKS
def get_active_tab_text(self):
element = self.driver.find_element_by_css_selector(".active-tab a")
Expand Down
20 changes: 20 additions & 0 deletions test/browser_testing/features/rate_checker_loan_details.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,23 @@ Examples:
| loan_term | option_state |
| 30 Years | enabled |
| 15 Years | disabled |


@rate_checker
Scenario: Select Adjustable then change back to Fixed rate to verify that ARM Type disappears
When I select "Adjustable" Rate Structure
And I select "Fixed" Rate Structure
Then I should NOT see the ARM Type selection


@rate_checker
Scenario: Select Adjustable rate then verify that ARM Type is highlighted
When I select "Adjustable" Rate Structure
Then I should see the ARM Type field highlighted


@rate_checker
Scenario: Select Adjustable rate, ARM Type then verify that ARM Type is NOT highlighted
When I select "Adjustable" Rate Structure
And I select "7/1" ARM Type
Then I should NOT see the ARM Type field highlighted
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def step(context, alert_text):
actual_text = context.rate_checker.get_county_alert_text(alert_text)
assert_that(actual_text, equal_to(False))


@then(u'I should see the County field highlighted')
def step(context):
actual_state = context.rate_checker.is_county_highlighted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ def step(context):
assert_that(arm_type_selection, equal_to(False))


@then(u'I should see the ARM Type field highlighted')
def step(context):
actual_state = context.rate_checker.is_arm_type_highlighted()
assert_that(actual_state, equal_to(True))


@then(u'I should NOT see the ARM Type field highlighted')
def step(context):
actual_state = context.rate_checker.is_arm_type_highlighted()
assert_that(actual_state, equal_to(False))


# INTEREST COST LABEL
@then(u'I should see primary Interest costs over the first "{loan_years}" years')
@then(u'I should see primary Interest costs over "{loan_years}" years')
Expand Down

0 comments on commit 4848336

Please sign in to comment.