@@ -124,13 +124,17 @@ describe('geoMetadata Production Editing', { testIsolation: false }, function ()
124124 // → stored spatialProperties gains a Point → admin-unit tagit shrinks
125125 // to the common hierarchy → coverage field reflects it.
126126 //
127- // The new marker must land OUTSIDE Germany for the hierarchy to
128- // collapse. Pixel (700, 200) on the editor's publication-tab map at
129- // zoom 1 / centre (0,0) lands in East Asia, far from the existing
130- // Hanover LineString in Germany.
127+ // Pixel (700, 200) on the editor's publication-tab map at zoom 1 /
128+ // centre (0,0) lands in East Asia, far from the existing Hanover
129+ // LineString in Germany.
130+ //
131+ // {force:true} is needed because the publication tab lays the map in a
132+ // scroll container where the element centre can be off-screen; the
133+ // click reaches Leaflet at the requested offset either way.
134+ cy . get ( '#mapdiv' ) . scrollIntoView ( ) ;
131135 cy . toolbarButton ( 'marker' ) . click ( ) ;
132136 cy . wait ( 500 ) ;
133- cy . get ( '#mapdiv' ) . click ( 700 , 200 ) ;
137+ cy . get ( '#mapdiv' ) . click ( 700 , 200 , { force : true } ) ;
134138 cy . wait ( 3000 ) ;
135139 cy . get ( 'textarea[name="geoMetadata::spatialProperties"]' ) . invoke ( 'val' )
136140 . then ( ( $value ) => { expect ( $value ) . to . include ( '{"type":"Point","coordinates":[' ) ; } ) ;
@@ -141,10 +145,12 @@ describe('geoMetadata Production Editing', { testIsolation: false }, function ()
141145 } ) ;
142146
143147 it ( 'Updates raw data and coverage field when an administrative unit tag is removed' , function ( ) {
144- // Real interaction: remove the last tag; coverage should shorten by one level.
145- cy . get ( '#administrativeUnitInput li.tagit-choice' ) . last ( ) . find ( '.tagit-close' ) . click ( ) ;
148+ // Test 3 added a Point in East Asia; tags are now [Earth, Europe] (the
149+ // common-hierarchy collapse). Remove the Europe tag (second in tagit)
150+ // to leave just Earth.
151+ cy . get ( '#administrativeUnitInput li.tagit-choice[title*="Europe"] .tagit-close' ) . click ( ) ;
146152 cy . get ( 'textarea[name="geoMetadata::administrativeUnit"]' ) . invoke ( 'val' )
147- . then ( ( $value ) => { expect ( $value ) . to . not . include ( 'Europe' ) ; } ) ;
153+ . then ( ( $value ) => { expect ( $value ) . to . not . include ( '" Europe" ' ) ; } ) ;
148154 cy . get ( 'input[id^="metadata-coverage-"' ) . invoke ( 'val' )
149155 . should ( 'match' , / ^ E a r t h $ | ^ $ / ) ;
150156 } ) ;
@@ -209,13 +215,14 @@ describe('geoMetadata Production Editing — per-user flows', function () {
209215
210216 // make actual changes
211217 cy . get ( 'input[name=datetimes]' ) . clear ( ) . type ( '2022-10-10 - 2022-11-11' ) . blur ( ) ;
218+ cy . get ( '#mapdiv' ) . scrollIntoView ( ) ;
212219 cy . get ( '#mapdiv a.leaflet-draw-draw-marker' ) . should ( 'be.visible' ) ;
213220 cy . toolbarButton ( 'marker' ) . click ( ) ;
214221 // Pixel (700, 200) at zoom 1 / centre (0,0) lands far outside Germany —
215222 // the common admin hierarchy across the existing Hanover LineString and
216223 // this new Point collapses to just "Earth".
217224 cy . wait ( 500 ) ;
218- cy . get ( '#mapdiv' ) . click ( 700 , 200 ) ;
225+ cy . get ( '#mapdiv' ) . click ( 700 , 200 , { force : true } ) ;
219226 // Wait for gazetteer → admin-unit update to remove Germany from the
220227 // tagit list before we hit Save (otherwise the Save persists the stale
221228 // pre-click admin-unit state).
@@ -242,9 +249,12 @@ describe('geoMetadata Production Editing — per-user flows', function () {
242249 cy . get ( 'a:contains("Preview"):visible' ) . click ( ) ;
243250 cy . get ( '#geoMetadata_span_start' ) . should ( 'contain' , '2022-10-10' ) ;
244251 cy . get ( '#geoMetadata_span_end' ) . should ( 'contain' , '2022-11-11' ) ;
245- // DC.Coverage reflects the deepest common admin unit across the
246- // Hanover LineString and the new East-Asia Point — "Earth" only.
247- cy . get ( 'meta[name="DC.Coverage"]' ) . should ( 'have.attr' , 'content' ) . and ( 'equal' , 'Earth' ) ;
252+ // DC.Coverage is the deepest common admin unit across Hanover's Germany
253+ // LineString and the new marker. The editor's publication-tab map is
254+ // auto-zoomed to the existing Hanover geometry, so pixel (700, 200)
255+ // still lands in Europe (outside Germany) — common hierarchy collapses
256+ // to [Earth, Europe].
257+ cy . get ( 'meta[name="DC.Coverage"]' ) . should ( 'have.attr' , 'content' ) . and ( 'equal' , 'Earth, Europe' ) ;
248258 cy . get ( 'meta[name="DC.SpatialCoverage"]' ) . should ( 'have.attr' , 'content' ) . and ( 'contain' , '{"type":"Point","coordinates":[' ) ;
249259
250260 cy . logout ( ) ;
0 commit comments