Skip to content

Commit 993d196

Browse files
author
tasawernawaz
committed
Merge pull request #104 from edx/tasawer/story/ecom-4512-credentials-acceptance-tests
Credentials acceptance tests updated.
2 parents 3498de5 + 3e9afae commit 993d196

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

acceptance_tests/pages.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def login(self, username, password):
6161
class LMSDashboardPage(LMSPage):
6262
def __init__(self, browser):
6363
super(LMSDashboardPage, self).__init__(browser)
64-
self.credential_css_selector = '.wrapper-xseries-certificates'
6564

6665
@property
6766
def url(self):
@@ -70,11 +69,27 @@ def url(self):
7069
def is_browser_on_page(self):
7170
return self.browser.title.startswith('Dashboard')
7271

72+
def go_to_programs_tab(self):
73+
self.q(css='a[href^="/dashboard/programs/"]').click()
74+
75+
76+
class LMSProgramListingPage(LMSPage):
77+
def __init__(self, browser):
78+
super(LMSProgramListingPage, self).__init__(browser)
79+
self.credential_css_selector = '.certificate-container'
80+
81+
@property
82+
def url(self):
83+
return self._build_url('dashboard/programs')
84+
85+
def is_browser_on_page(self):
86+
return self.browser.title.startswith('Programs')
87+
7388
def are_credential_links_present(self):
7489
return self.q(css=self.credential_css_selector).present
7590

7691
def click_credential_link(self):
77-
self.q(css=self.credential_css_selector + ' ul li a').click()
92+
self.q(css=self.credential_css_selector + ' a').click()
7893

7994
def get_credential_link(self):
80-
return self.q(css=self.credential_css_selector + ' ul li a').attrs('href')[0]
95+
return self.q(css=self.credential_css_selector + ' a').attrs('href')[0]

acceptance_tests/test_rendering.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from selenium.webdriver.support.ui import WebDriverWait
55

66
from acceptance_tests.mixins import LoginMixin, CredentialsApiMixin
7-
from acceptance_tests.pages import LMSDashboardPage
7+
from acceptance_tests.pages import LMSDashboardPage, LMSProgramListingPage
88

99

1010
class RenderCredentialTests(LoginMixin, WebAppTest, CredentialsApiMixin):
@@ -20,11 +20,15 @@ def test_student_dashboard_with_certificate(self):
2020
student_dashboard = LMSDashboardPage(self.browser).wait_for_page()
2121
student_dashboard.is_browser_on_page()
2222

23-
self.assertTrue(student_dashboard.are_credential_links_present())
23+
student_dashboard.go_to_programs_tab()
24+
program_listing_page = LMSProgramListingPage(self.browser).wait_for_page()
25+
program_listing_page.is_browser_on_page()
2426

25-
credential_link = student_dashboard.get_credential_link()
27+
self.assertTrue(program_listing_page.are_credential_links_present())
2628

27-
student_dashboard.click_credential_link()
29+
credential_link = program_listing_page.get_credential_link()
30+
31+
program_listing_page.click_credential_link()
2832
WebDriverWait(self.browser, 10).until(EC.presence_of_element_located((By.ID, 'action-print-view')))
2933

3034
# check the credential hash-id matches with rendered credential page.
@@ -41,4 +45,8 @@ def test_student_dashboard_with_revoked_certificate(self):
4145
student_dashboard = LMSDashboardPage(self.browser).wait_for_page()
4246
student_dashboard.is_browser_on_page()
4347

44-
self.assertFalse(student_dashboard.are_credential_links_present())
48+
student_dashboard.go_to_programs_tab()
49+
program_listing_page = LMSProgramListingPage(self.browser).wait_for_page()
50+
program_listing_page.is_browser_on_page()
51+
52+
self.assertFalse(program_listing_page.are_credential_links_present())

0 commit comments

Comments
 (0)