Skip to content

Commit 5cf4943

Browse files
authored
Merge pull request #110 from opensafely-core/e2e-test
Add viewing request files by filegroup to e2e test
2 parents 39574bb + 83715e9 commit 5cf4943

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/functional/test_e2e.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,24 @@ def test_e2e_release_files(page, live_server, dev_users, release_files_stubber):
121121
# get the request ID for the just-created request, for later reference
122122
request_id = url_regex.match(page.url).groups()[0]
123123

124-
# TODO: View file in group.
125124
# Add this when the view-by-groups is ready.
125+
# Find the filegroup in the tree
126+
# Note: `get_by_role`` gets all links on the page; `locator` searches
127+
# for elements with the filegroup class; the `scope` pseudoselector
128+
# lets us search on the elements themselves as well as their children
129+
filegroup_link = page.get_by_role("link").locator(".filegroup:scope")
130+
expect(filegroup_link).to_be_visible()
131+
expect(filegroup_link).to_contain_text(re.compile("my-new-group", flags=re.I))
132+
133+
# In the initial request view, the tree is collapsed
134+
file_link = page.get_by_role("link").locator(".file:scope")
135+
assert file_link.all() == []
136+
137+
# Click to open the filegroup tree
138+
filegroup_link.click()
139+
# Tree opens fully expanded, so now the file (in its subdir) is visible
140+
find_and_click(file_link)
141+
expect(page.locator("body")).to_contain_text("I am the file content")
126142

127143
# Submit request
128144
submit_button = page.locator("#submit-for-review-button")

0 commit comments

Comments
 (0)