|
1 | | -# Generated by Selenium IDE |
2 | 1 | import time |
3 | 2 | from selenium import webdriver |
4 | 3 | from selenium.webdriver.common.by import By |
5 | 4 | from selenium.webdriver.support import expected_conditions as EC |
6 | 5 | from selenium.webdriver.support.wait import WebDriverWait |
7 | 6 |
|
| 7 | +CSS_SEL_FE_ERR_MSG_CONTENT = "tbody .ds-u-text-align--left:nth-child(2)" |
| 8 | + |
8 | 9 |
|
9 | 10 | class TestNodeSampleApp(): |
10 | 11 | driver_ready = False |
@@ -73,6 +74,13 @@ def _assert_EOB_table_records_present(self, cnt): |
73 | 74 | elements = self._find_elem_xpath(xpath) |
74 | 75 | assert len(elements) == cnt |
75 | 76 |
|
| 77 | + def _assert_EOB_table_error_present(self): |
| 78 | + element = self._find_and_return(30, |
| 79 | + By.CSS_SELECTOR, |
| 80 | + CSS_SEL_FE_ERR_MSG_CONTENT) |
| 81 | + assert element is not None |
| 82 | + print(element.text) |
| 83 | + |
76 | 84 | def _input_user_and_passwd_and_login(self): |
77 | 85 | self._find_and_sendkey(30, By.ID, "username-textbox", "BBUser10000") |
78 | 86 | self._find_and_sendkey(30, By.ID, "password-textbox", "PW10000!") |
@@ -110,5 +118,26 @@ def test_node_sample_app_deny_access(self): |
110 | 118 | self._input_user_and_passwd_and_login() |
111 | 119 | self._find_and_click(30, By.ID, "deny") |
112 | 120 | time.sleep(5) |
113 | | - self._assert_EOB_table_header_present() |
114 | | - self._assert_EOB_table_records_present(0) |
| 121 | + self._assert_EOB_table_error_present() |
| 122 | + |
| 123 | + def test_node_sample_app_grant_followed_by_deny_access(self): |
| 124 | + ''' |
| 125 | + this is to verify that the cached result from previous |
| 126 | + authorized eob query is clean up (should not see cached claims) |
| 127 | + ''' |
| 128 | + self.driver.get("http://client:3000/") |
| 129 | + self.driver.set_window_size(1500, 1800) |
| 130 | + elem = self._find_and_click(30, By.ID, "auth_btn") |
| 131 | + assert elem is not None |
| 132 | + self._input_user_and_passwd_and_login() |
| 133 | + self._find_and_click(30, By.ID, "approve") |
| 134 | + time.sleep(5) |
| 135 | + self._assert_EOB_table_records_present(10) |
| 136 | + # go again |
| 137 | + elem = self._find_and_click(30, By.ID, "auth_btn") |
| 138 | + assert elem is not None |
| 139 | + self._input_user_and_passwd_and_login() |
| 140 | + self._find_and_click(30, By.ID, "deny") |
| 141 | + time.sleep(5) |
| 142 | + # should see error message |
| 143 | + self._assert_EOB_table_error_present() |
0 commit comments