Skip to content

Commit c25b8e3

Browse files
committed
Merge pull request #65 from UWIT-IAM/GH-64
[GH-64] Fix failed test runs due to pyyaml error and old dependencies. Also, misc poetry and test changes.
2 parents f61ea53 + 524e4c6 commit c25b8e3

7 files changed

Lines changed: 823 additions & 836 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
webdriver-report
33
secrets.json
44
/*/**/__pycache__/*
5+
.python-version
56

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
FROM ghcr.io/uwit-iam/poetry:latest AS apt-base
2-
ENV ALLOW_HOSTS_MODIFICATION "1"
1+
# The poetry image is built often, so pinning to avoid breaking changes
2+
FROM ghcr.io/uwit-iam/poetry:2025.04.02T012232 AS apt-base
3+
ENV ALLOW_HOSTS_MODIFICATION="1"
34
RUN apt-get update && apt-get -y install curl jq dnsutils
45

5-
FROM apt-base as poetry-base
6+
FROM apt-base AS poetry-base
67
WORKDIR /uw-idp-tests
78
COPY poetry.lock pyproject.toml scripts/entrypoint.sh ./
8-
RUN poetry install
9+
RUN poetry install --no-root
910

1011
FROM poetry-base AS test-runner
1112
COPY settings.yaml ./

poetry.lock

Lines changed: 807 additions & 824 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[tool.poetry]
22
name = "uw-idp-web-tests"
33
version = "0.1.0"
4+
package-mode = false
45
description = ""
56
authors = ["Tom Thorogood <goodtom@uw.edu>", "Glen Goulter <glenrg@uw.edu>"]
67

78
[tool.poetry.dependencies]
8-
python = "^3.8"
9+
python = "^3.10"
910
black = "^21.5b2"
1011
boto3 = "^1.17.92"
1112
click = "^8.0.1"
@@ -14,7 +15,7 @@ inflection = "^0.5.1"
1415
nslookup = "^1.4.0"
1516
pydantic = "^1.8.2"
1617
pytest = "^6.2.4"
17-
PyYAML = "^5.4.1"
18+
PyYAML = "^6.0.2"
1819
typing-extensions = "^3.10.0"
1920
# Pinned until https://github.com/UWIT-IAM/webdriver-recorder/pull/25
2021
# is merged and released.

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def duo_push(current_browser: Chrome):
174174
Select the other duo option, to get to the bypass code option
175175
"""
176176
wait = WebDriverWait(current_browser, 10)
177-
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(), 'Other options')]")))
178-
current_browser.wait_for_tag('a', 'Other options').click()
177+
wait.until(EC.element_to_be_clickable((By.XPATH, "//button[contains(text(), 'Other options')]")))
178+
current_browser.wait_for_tag('button', 'Other options').click()
179179
current_browser.wait_for_tag('b', 'Other options to log in')
180180

181181

tests/test_2fa_duo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_2fa_session_multiple_crn(self, netid10, enter_duo_passcode):
168168
self.browser.send_inputs(netid10, self.password)
169169
self.browser.click(Locators.submit_button)
170170
self.browser.wait_for_tag('div', 'Select a UW NetID for 2nd factor authentication.')
171-
self.browser.find_element_by_xpath("//input[@value='sptest07']").click()
171+
self.browser.find_element(By.XPATH, "//input[@value='sptest07']").click()
172172
self.browser.click(Locators.submit_button)
173173
enter_duo_passcode(self.browser, match_service_provider=self.sp)
174174

@@ -196,7 +196,7 @@ def test_remember_me_cookie(
196196
Select the other duo option, to get to the bypass code option
197197
"""
198198
wait = WebDriverWait(fresh_browser, 10)
199-
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(), 'Other options')]")))
199+
wait.until(EC.element_to_be_clickable((By.XPATH, "//button[contains(text(), 'Other options')]")))
200200
enter_duo_passcode(fresh_browser, match_service_provider=sp, select_this_is_my_device=True)
201201

202202
# go to an idp site to retrieve the shib idp cookies

tests/test_password_sign_on.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from tests.helpers import Locators
1717
from tests.models import ServiceProviderInstance
18+
from selenium.webdriver.common.by import By
1819

1920

2021
def add_suffix(suffix: str, netid: str) -> str:
@@ -103,7 +104,7 @@ def test_new_session_standard_bad_creds(self):
103104
self.browser.send_inputs(bad_netid, self.password)
104105
self.browser.click(Locators.submit_button)
105106
self.browser.wait_for_tag('p', 'Your sign-in failed.')
106-
element = self.browser.find_element_by_id('weblogin_netid')
107+
element = self.browser.find_element(By.ID, 'weblogin_netid')
107108
element.click()
108109
element.clear()
109110
bad_password = '1'
@@ -208,6 +209,6 @@ def test_query_parameters(self, netid):
208209
self.browser.snap()
209210
self.browser.get(url)
210211
self.browser.wait_for_tag('h1', 'query parameters')
211-
element = self.browser.find_elements_by_tag_name('p')
212+
element = self.browser.find_elements(By.TAG_NAME, 'p')
212213
for snippet in ('fname = Joe', 'lname = Smith', 'age = 30'):
213214
assert (snippet in element[1].text)

0 commit comments

Comments
 (0)