Skip to content

Commit

Permalink
e2e: test <a href="media/"><img src="media/"></a> in popup
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Jan 28, 2025
1 parent 32f2161 commit 2147c6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
7 changes: 7 additions & 0 deletions tests/end2end/playwright/popup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,16 @@ test.describe('Popup', () => {
y: 415
}
});

// Assert bootstrap tabs are visible
await expect(page.locator('#newOlMap #liz_layer_popup')).toBeVisible();
await expect(page.locator('#newOlMap #liz_layer_popup_contentDiv > div > div > div > ul > li > button.active')).toBeVisible();
await expect(page.locator('#newOlMap #liz_layer_popup_contentDiv > div > div > div > ul > li:nth-child(2) > button')).toBeVisible();

// Assert media links are replaced by the lizmap media service
const mediaLink = 'http://localhost:8130/index.php/view/media/getMedia?repository=testsrepository&project=popup&path=media%2Fimages%2Fmontpellier.qgs.webp';
await expect(page.locator('#popup_dd_1_tab1 a')).toHaveAttribute('href', mediaLink);
await expect(page.locator('#popup_dd_1_tab1 a img')).toHaveAttribute('src', mediaLink);
});

test('changes popup tab', async ({ page }) => {
Expand Down
21 changes: 5 additions & 16 deletions tests/qgis-projects/tests/popup.qgs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<qgis projectname="" saveDateTime="2024-07-15T10:32:53" saveUser="nboisteault" saveUserFull="nboisteault" version="3.34.8-Prizren">
<qgis projectname="" saveDateTime="2025-01-28T11:44:14" saveUser="nboisteault" saveUserFull="nboisteault" version="3.34.15-Prizren">
<homePath path=""></homePath>
<title></title>
<transaction mode="Disabled"></transaction>
Expand Down Expand Up @@ -43,8 +43,8 @@
</layer-tree-group>
<snapping-settings enabled="0" intersection-snapping="0" maxScale="0" minScale="0" mode="2" scaleDependencyMode="0" self-snapping="0" tolerance="12" type="1" unit="1">
<individual-layer-settings>
<layer-setting enabled="0" id="dnd_popup_3b9d335a_5491_45fa_8a8b_8dca1ca7ff3b" maxScale="0" minScale="0" tolerance="12" type="1" units="1"></layer-setting>
<layer-setting enabled="0" id="townhalls_pg_6c85c4bf_fe76_46b1_8445_0041d55d6e76" maxScale="0" minScale="0" tolerance="12" type="1" units="1"></layer-setting>
<layer-setting enabled="0" id="dnd_popup_3b9d335a_5491_45fa_8a8b_8dca1ca7ff3b" maxScale="0" minScale="0" tolerance="12" type="1" units="1"></layer-setting>
</individual-layer-settings>
</snapping-settings>
<relations>
Expand Down Expand Up @@ -1057,6 +1057,7 @@ def my_form_open(dialog, layer, feature):
)
ELSE ''
END %]
&lt;a href="media/images/montpellier.qgs.webp" target="_blank"&gt;&lt;img src="media/images/montpellier.qgs.webp"&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;div id="popup_dd_[% $id %]_tab2" class="tab-pane "&gt;
Expand Down Expand Up @@ -1114,18 +1115,6 @@ def my_form_open(dialog, layer, feature):
</mapTip>
</maplayer>
<maplayer autoRefreshMode="Disabled" autoRefreshTime="0" geometry="Point" hasScaleBasedVisibilityFlag="0" labelsEnabled="0" legendPlaceholderImage="" maxScale="0" minScale="100000000" readOnly="0" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" simplifyAlgorithm="0" simplifyDrawingHints="0" simplifyDrawingTol="1" simplifyLocal="0" simplifyMaxScale="1" styleCategories="AllStyleCategories" symbologyReferenceScale="-1" type="vector" wkbType="Point">
<extent>
<xmin>763818.78410616668406874</xmin>
<ymin>6274272.6375590842217207</ymin>
<xmax>776574.44688994809985161</xmax>
<ymax>6286437.04803071543574333</ymax>
</extent>
<wgs84extent>
<xmin>3.78966504381948344</xmin>
<ymin>43.56338375897173165</ymin>
<xmax>3.94929342688383667</xmax>
<ymax>43.67409308240065258</ymax>
</wgs84extent>
<id>townhalls_pg_6c85c4bf_fe76_46b1_8445_0041d55d6e76</id>
<datasource>service='lizmapdb' key='id' estimatedmetadata=true srid=2154 type=Point checkPrimaryKeyUnicity='1' table="tests_projects"."townhalls_pg" (geom)</datasource>
<shortname>townhalls_pg</shortname>
Expand Down Expand Up @@ -1749,7 +1738,7 @@ def my_form_open(dialog, layer, feature):
<Sensors></Sensors>
<ProjectViewSettings UseProjectScales="0" rotation="0">
<Scales></Scales>
<DefaultViewExtent xmax="782045.32394637318793684" xmin="763479.4154808419989422" ymax="6285886.84987394418567419" ymin="6274133.31412096228450537">
<DefaultViewExtent xmax="783337.28149422956630588" xmin="762187.45793298562057316" ymax="6285756.67271297331899405" ymin="6274263.49128193315118551">
<spatialrefsys nativeFormat="Wkt">
<wkt>PROJCRS["RGF93 v1 / Lambert-93",BASEGEOGCRS["RGF93 v1",DATUM["Reseau Geodesique Francais 1993 v1",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4171]],CONVERSION["Lambert-93",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",46.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",49,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",44,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",700000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",6600000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["France - onshore and offshore, mainland and Corsica."],BBOX[41.15,-9.86,51.56,10.38]],ID["EPSG",2154]]</wkt>
<proj4>+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs</proj4>
Expand Down Expand Up @@ -1817,4 +1806,4 @@ def my_form_open(dialog, layer, feature):
<ProjectGpsSettings autoAddTrackVertices="0" autoCommitFeatures="0" destinationFollowsActiveLayer="1" destinationLayer="dnd_popup_3b9d335a_5491_45fa_8a8b_8dca1ca7ff3b" destinationLayerName="dnd_popup" destinationLayerProvider="postgres" destinationLayerSource="service='lizmapdb' sslmode=disable key='id' estimatedmetadata=true srid=2154 type=Polygon checkPrimaryKeyUnicity='1' table=&quot;tests_projects&quot;.&quot;dnd_popup&quot; (geom)">
<timeStampFields></timeStampFields>
</ProjectGpsSettings>
</qgis>
</qgis>

0 comments on commit 2147c6c

Please sign in to comment.