Skip to content

Commit 3cf9ca0

Browse files
committed
fix some UI tests and update changelog
1 parent b5891db commit 3cf9ca0

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Support for complex geometries (points, lines, polygons, multigeometry)
3333
- Export extreme points (northernmost, southernmost, easternmost, westernmost) and geometric center
3434
- Configurable via `WIKIBASE_*` environment variables
35+
- **Global regions layer** - Interactive map overlay showing continent and ocean boundaries:
36+
- Toggle-able layer control to show/hide global regions on the main map
37+
- Simplified ocean geometries for efficient rendering
38+
- Color-coded regions (brown for continents, blue for oceans)
39+
- Dashed line styling for clear visual distinction
40+
- Click to view region details and navigate to regional feeds
41+
- Integrated with feed landing pages showing region outlines
3542
- **Geocoding/gazetteer search** - Map search functionality allowing users to search for locations by name:
3643
- Nominatim geocoder integration (default)
3744
- Optional GeoNames support (requires username configuration)
@@ -97,6 +104,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
97104
- **Unified admin control panel** - Consolidated admin status display, publish/unpublish buttons, provenance information, and "Edit in Admin" link into single highlighted box at top of work landing page. Provenance is collapsible.
98105
- **Improved text wrapping** - Page titles and abstract text now properly wrap on narrow windows instead of overflowing.
99106
- **Unified URL structure** - Changed ID-based URLs from `/publication/<id>/` to `/work/<id>/` for consistency with DOI-based URLs.
107+
- **Consolidated work identifier logic** - Centralized logic for determining work identifiers (DOI or internal ID) in a `get_identifier()` method on the `Work` model:
108+
- Ensures consistent identifier usage across permalinks, sitemaps, and API responses
109+
- Prioritizes DOI when available, falls back to internal ID
110+
- Reduces code duplication across views and serializers
100111
- **Refactored views_geometry.py** - Eliminated code duplication by making DOI-based functions wrap ID-based functions. Reduced from 375 to 240 lines (~36% reduction).
101112
- **Renamed "Locate" to "Contribute"** - URL, page title, and navigation updated for clarity about crowdsourcing purpose.
102113
- **Contribute page layout refactored** - Fixed text overflow issues with proper CSS containment strategy.

tests-ui/test_feeds_and_work_landing.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def setUpClass(cls):
4343
def test_europe_feed_page_loads(self):
4444
"""Test that the Europe feed page loads and displays works."""
4545
try:
46-
start_chrome(f'{self.live_server_url}/feeds/continent/europe/', headless=False)
46+
start_chrome(f'{self.live_server_url}/feeds/continent/europe/', headless=True)
4747
driver = get_driver()
4848

4949
# Check page loaded
@@ -94,39 +94,38 @@ def test_work_landing_page_from_fixture(self):
9494
try:
9595
# Use the work's identifier (DOI or ID)
9696
identifier = work.get_identifier()
97-
start_chrome(f'{self.live_server_url}/work/{identifier}/', headless=False)
97+
start_chrome(f'{self.live_server_url}/work/{identifier}/', headless=True)
9898
driver = get_driver()
9999

100100
# Check page loaded
101101
self.assertIn("OPTIMAP", driver.title)
102102

103-
# Check for work title
103+
# Check for work details on the page
104+
page_text = driver.page_source
104105
self.assertTrue(
105-
Text(work.title).exists() and work.title in driver.page_source,
106-
f"Page should contain work title: {work.title}"
106+
work.title in page_text,
107+
"Work landing page shows the work title"
108+
)
109+
self.assertTrue(
110+
work.abstract in page_text,
111+
"Work landing page shows the work abstract"
112+
)
113+
self.assertTrue(
114+
work.doi in page_text and f"href=\"https://doi.org/{work.doi}\"",
115+
"Work landing page shows the work doi as a link"
107116
)
108-
109-
page_text = driver.page_source.lower()
110117
self.assertTrue(
111-
'work' in page_text and work.title in page_text,
112-
"Page should be a work landing page showing the work title"
118+
work.source.name in page_text and f"href=\"{work.source.homepage_url}\"" in page_text,
119+
"Work landing page shows the work source as a link"
120+
)
121+
self.assertTrue(
122+
f"href=\"{work.openalex_id}\"" in page_text,
123+
"Work landing page shows the OpenAlex ID as a link"
113124
)
114125

115126
leaflet_paths = find_all(S('path.leaflet-interactive'))
116-
self.assertEqual(len(leaflet_paths), 3) # has geometries on the map from test_data_optimap.json
117-
for path in leaflet_paths:
118-
self.assertEqual(path.web_element.get_attribute('stroke'), '#158F9B')
119-
120-
click(leaflet_paths[0])
121-
122-
wait_until(lambda: Text('View work details').exists())
123-
124-
# the last paper is the first in the paths
125-
self.assertIn('Visit work', S('div.leaflet-popup-content').web_element.text)
126-
self.assertIn('Paper 3', S('div.leaflet-popup-content').web_element.text)
127-
self.assertIn('OPTIMAP Test Journal', S('div.leaflet-popup-content').web_element.text)
128-
self.assertIn('better? Dresden!', S('div.leaflet-popup-content').web_element.text)
129-
127+
self.assertEqual(len(leaflet_paths), 1) # has one on the map
128+
130129
# Take screenshot
131130
screenshot_path = os.path.join(os.getcwd(), 'tests-ui', 'screenshots', 'work_landing.png')
132131
driver.save_screenshot(screenshot_path)

0 commit comments

Comments
 (0)