Skip to content

Commit

Permalink
Update browser landing test to reflect new content.
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-next committed Nov 13, 2024
1 parent f018bfa commit 872179c
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions server/webdriver/shared_tests/browser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,30 @@ def test_page_landing(self):
self.assertEqual(shared.safe_url_open(self.driver.current_url), 200)

# Assert page title is correct
WebDriverWait(self.driver,
self.TIMEOUT_SEC).until(EC.title_contains(title_text))
self.assertEqual(title_text, self.driver.title)
WebDriverWait(self.driver, self.TIMEOUT_SEC).until(
EC.title_contains(title_text)
)
self.assertIn(title_text, self.driver.title)

# Wait for title to be present
title_present = EC.text_to_be_present_in_element((By.TAG_NAME, 'h1'),
'Knowledge Graph')
WebDriverWait(self.driver, self.TIMEOUT_SEC).until(title_present)
h1_locator = (By.CSS_SELECTOR, '#intro-text h1')
WebDriverWait(self.driver, self.TIMEOUT_SEC).until(
EC.text_to_be_present_in_element(h1_locator, 'Knowledge Graph')
)
h1_element = self.driver.find_element(*h1_locator)
self.assertEqual("Knowledge Graph", h1_element.text)

# Assert intro is correct
intro = self.driver.find_element(By.XPATH,
'//*[@id="browser_landing"]/div/p[1]')
intro_locator = (By.CSS_SELECTOR, '#intro-text .container header p')
WebDriverWait(self.driver, self.TIMEOUT_SEC).until(
EC.presence_of_element_located(intro_locator)
)
intro_element = self.driver.find_element(*intro_locator)
expected_intro_start = 'The Data Commons Knowledge Graph is constructed'
self.assertTrue(
intro.text.startswith(
'The Data Commons Knowledge Graph is constructed'))
intro_element.text.startswith(expected_intro_start),
f"Intro text does not start with expected text. Found: {intro_element.text}"
)

def test_page_serve_ca_population(self):
"""Test the browser page for California population can be loaded successfully."""
Expand Down

0 comments on commit 872179c

Please sign in to comment.