Skip to content

Commit

Permalink
Tests - Fix project home page cypress, moving to playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Feb 11, 2025
1 parent a7c6867 commit aa7aabc
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 80 deletions.
15 changes: 0 additions & 15 deletions tests/end2end/cypress/integration/projects_homepage-ghaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,6 @@ describe('Projects homepage', function () {
})
})

it('Check project_acl visibility according to the connected user and its group', function () {
cy.logout();
cy.visit('/index.php/view/');
cy.get('.liz-repository-project-item:visible .liz-project-title').contains('project_acl').should('not.exist');

cy.loginAsUserA();
cy.visit('/index.php/view/');
cy.get('.liz-repository-project-item:visible .liz-project-title').contains('project_acl').should('exist');

cy.loginAsAdmin();
cy.visit('/index.php/view/');
cy.get('.liz-repository-project-item:visible .liz-project-title').contains('project_acl').should('not.exist');
cy.logout();
})

it('Check hide_project visibility, it has to never been displayed because config.options.hideProject:"True"', function () {
cy.logout();
cy.visit('/index.php/view/');
Expand Down
30 changes: 26 additions & 4 deletions tests/end2end/playwright/landing_page_config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import {HomePage} from "./pages/homepage";
import {AdminPage} from "./pages/admin";

test.describe('Landing page content', {
tag: ['@write'],
}, () => {

test('Fill form & check content', async ({ browser }) => {

const adminContext = await browser.newContext({ storageState: 'playwright/.auth/admin.json' });
test('Fill form & check content', {
tag: '@write',
}, async ({ browser }) =>
{
const adminContext = await browser.newContext({ storageState: getAuthStorageStatePath('admin') });
const page = await adminContext.newPage();
const adminPage = new AdminPage(page);
// unanthenticated context
Expand Down Expand Up @@ -72,4 +73,25 @@ test.describe('Landing page content', {
await expect(homeUserPage.bottomContent).toHaveText('Bottom unauth only');

});

[
{ login: 'anonymous', count: 0 },
{ login: 'user_in_group_a', count: 1 },
{ login: 'admin', count: 0 },
].forEach(({ login, count}) => {
test(`Check "project_acl" visibility according to "${login}" login and its group`,
{
tag: '@readonly',
}, async ({browser}) => {
let context;
if (login !== 'anonymous') {
context = await browser.newContext({storageState: getAuthStorageStatePath(login)});
} else {
context = await browser.newContext();
}
const homePage = new HomePage(await context.newPage());
await homePage.open();
await expect(homePage.page.getByRole('link', { name: 'project_acl' })).toHaveCount(count);
});
});
});
8 changes: 8 additions & 0 deletions tests/end2end/playwright/pages/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ export class HomePage extends BasePage {
this.bottomContent = page.locator('#landingPageContentBottom');
this.search = page.locator('#search');
}

/**
* open function
* Open the URL on the home page.
*/
async open(){
await this.page.goto('index.php');
}
}
182 changes: 129 additions & 53 deletions tests/qgis-projects/tests/project_acl.qgs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis saveUser="etienne" projectname="" version="3.16.15-Hannover" saveUserFull="Etienne Trimaille" saveDateTime="2022-04-27T18:41:22">
<homePath path=""/>
<qgis projectname="" saveDateTime="2025-02-11T13:29:22" saveUser="etienne" saveUserFull="Etienne Trimaille" version="3.40.3-Bratislava">
<homePath path=""></homePath>
<title></title>
<autotransaction active="0"/>
<evaluateDefaultValues active="0"/>
<trust active="0"/>
<transaction mode="Disabled"></transaction>
<projectFlags set="TrustStoredLayerStatistics"></projectFlags>
<projectCrs>
<spatialrefsys>
<wkt>GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<spatialrefsys nativeFormat="Wkt">
<wkt>GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
Expand All @@ -18,14 +16,31 @@
<geographicflag>true</geographicflag>
</spatialrefsys>
</projectCrs>
<verticalCrs>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</verticalCrs>
<elevation-shading-renderer combined-method="0" edl-distance="0.5" edl-distance-unit="0" edl-is-active="1" edl-strength="1000" hillshading-is-active="0" hillshading-is-multidirectional="0" hillshading-z-factor="1" is-active="0" light-altitude="45" light-azimuth="315"></elevation-shading-renderer>
<layer-tree-group>
<customproperties/>
<custom-order enabled="0"/>
<customproperties>
<Option></Option>
</customproperties>
<custom-order enabled="0"></custom-order>
</layer-tree-group>
<snapping-settings tolerance="12" minScale="0" mode="2" intersection-snapping="0" scaleDependencyMode="0" maxScale="0" self-snapping="0" type="1" enabled="0" unit="1">
<individual-layer-settings/>
<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></individual-layer-settings>
</snapping-settings>
<relations/>
<relations></relations>
<polymorphicRelations></polymorphicRelations>
<mapcanvas annotationsVisible="1" name="theMapCanvas">
<units>degrees</units>
<extent>
Expand All @@ -36,8 +51,8 @@
</extent>
<rotation>0</rotation>
<destinationsrs>
<spatialrefsys>
<wkt>GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<spatialrefsys nativeFormat="Wkt">
<wkt>GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
Expand All @@ -49,21 +64,20 @@
</spatialrefsys>
</destinationsrs>
<rendermaptile>0</rendermaptile>
<expressionContextScope/>
<expressionContextScope></expressionContextScope>
</mapcanvas>
<projectModels/>
<legend updateDrawingOrder="true"/>
<mapViewDocks/>
<mapViewDocks3D/>
<main-annotation-layer autoRefreshEnabled="0" refreshOnNotifyMessage="" autoRefreshTime="0" type="annotation" refreshOnNotifyEnabled="0">
<projectModels></projectModels>
<legend updateDrawingOrder="true"></legend>
<mapViewDocks></mapViewDocks>
<main-annotation-layer autoRefreshMode="Disabled" autoRefreshTime="0" hasScaleBasedVisibilityFlag="0" legendPlaceholderImage="" maxScale="0" minScale="0" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" styleCategories="AllStyleCategories" type="annotation">
<id>Annotations_1b82beaa_5a0a_445e_b2ad_d7288106e20f</id>
<datasource></datasource>
<keywordList>
<value></value>
</keywordList>
<layername></layername>
<srs>
<spatialrefsys>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
Expand All @@ -82,11 +96,12 @@
<type></type>
<title></title>
<abstract></abstract>
<links/>
<links></links>
<dates></dates>
<fees></fees>
<encoding></encoding>
<crs>
<spatialrefsys>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
Expand All @@ -98,13 +113,25 @@
<geographicflag>false</geographicflag>
</spatialrefsys>
</crs>
<extent/>
<extent></extent>
</resourceMetadata>
<items/>
<items></items>
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
<Private>0</Private>
</flags>
<customproperties>
<Option></Option>
</customproperties>
<layerOpacity>1</layerOpacity>
<blendMode>0</blendMode>
<paintEffect></paintEffect>
</main-annotation-layer>
<projectlayers/>
<layerorder/>
<projectlayers></projectlayers>
<layerorder></layerorder>
<labelEngineSettings></labelEngineSettings>
<properties>
<Digitizing>
<AvoidIntersectionsMode type="int">2</AvoidIntersectionsMode>
Expand Down Expand Up @@ -134,6 +161,7 @@
<CandidatesPoint type="int">16</CandidatesPoint>
<CandidatesPolygon type="int">30</CandidatesPolygon>
<CandidatesPolygonPerCM type="double">2.5</CandidatesPolygonPerCM>
<DrawLabelMetrics type="bool">false</DrawLabelMetrics>
<DrawRectOnly type="bool">false</DrawRectOnly>
<DrawUnplaced type="bool">false</DrawUnplaced>
<PlacementEngineVersion type="int">0</PlacementEngineVersion>
Expand All @@ -142,7 +170,7 @@
<ShowingCandidates type="bool">false</ShowingCandidates>
<ShowingPartialsLabels type="bool">true</ShowingPartialsLabels>
<TextFormat type="int">0</TextFormat>
<UnplacedColor type="QString">255,0,0,255</UnplacedColor>
<UnplacedColor type="QString">255,0,0,255,rgb:1,0,0,1</UnplacedColor>
</PAL>
<Paths>
<Absolute type="bool">false</Absolute>
Expand All @@ -156,10 +184,12 @@
</SpatialRefSys>
<Variables>
<variableNames type="QStringList">
<value>lizmap_repository</value>
<value>lizmap_user</value>
<value>lizmap_user_groups</value>
</variableNames>
<variableValues type="QStringList">
<value>features</value>
<value></value>
<value></value>
</variableValues>
Expand All @@ -170,37 +200,44 @@
<value>1.6283924843423798</value>
<value>1.0</value>
</WMSExtent>
<WMSMaxAtlasFeatures type="int">1</WMSMaxAtlasFeatures>
<WMSRootName type="QString">project_acl</WMSRootName>
<WMSServiceCapabilities type="QString">True</WMSServiceCapabilities>
<WMSServiceTitle type="QString">project_acl</WMSServiceTitle>
</properties>
<dataDefinedServerProperties>
<Option type="Map">
<Option name="name" value="" type="QString"/>
<Option name="properties"/>
<Option name="type" value="collection" type="QString"/>
<Option name="name" type="QString" value=""></Option>
<Option name="properties"></Option>
<Option name="type" type="QString" value="collection"></Option>
</Option>
</dataDefinedServerProperties>
<visibility-presets/>
<transformContext/>
<visibility-presets></visibility-presets>
<transformContext></transformContext>
<projectMetadata>
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type></type>
<title></title>
<abstract></abstract>
<links/>
<links></links>
<dates>
<date type="Created" value="2021-02-03T11:18:47"></date>
</dates>
<author>nboisteault</author>
<creation>2021-02-03T11:18:47</creation>
</projectMetadata>
<Annotations/>
<Layouts/>
<Bookmarks/>
<ProjectViewSettings UseProjectScales="0">
<Scales/>
<DefaultViewExtent xmax="1.06054054054054059" ymin="-1" xmin="-1.06054054054054059" ymax="1">
<spatialrefsys>
<wkt>GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<Annotations></Annotations>
<Layouts></Layouts>
<mapViewDocks3D></mapViewDocks3D>
<Bookmarks></Bookmarks>
<Sensors></Sensors>
<ProjectViewSettings UseProjectScales="0" rotation="0">
<Scales></Scales>
<DefaultViewExtent xmax="1.46304347826086967" xmin="-1.46304347826086967" ymax="1" ymin="-1">
<spatialrefsys nativeFormat="Wkt">
<wkt>GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
Expand All @@ -212,19 +249,58 @@
</spatialrefsys>
</DefaultViewExtent>
</ProjectViewSettings>
<ProjectTimeSettings frameRate="1" timeStep="1" timeStepUnit="h" cumulativeTemporalRange="0"/>
<ProjectDisplaySettings>
<ProjectStyleSettings DefaultSymbolOpacity="1" RandomizeDefaultSymbolColor="1" colorModel="Rgb" iccProfileId="attachment:///">
<databases></databases>
</ProjectStyleSettings>
<ProjectTimeSettings cumulativeTemporalRange="0" frameRate="1" timeStep="1" timeStepUnit="h" totalMovieFrames="100"></ProjectTimeSettings>
<ElevationProperties FilterInvertSlider="0">
<terrainProvider type="flat">
<TerrainProvider offset="0" scale="1"></TerrainProvider>
</terrainProvider>
</ElevationProperties>
<ProjectDisplaySettings CoordinateAxisOrder="Default" CoordinateType="MapCrs">
<BearingFormat id="bearing">
<Option type="Map">
<Option name="decimal_separator" value="" type="QChar"/>
<Option name="decimals" value="6" type="int"/>
<Option name="direction_format" value="0" type="int"/>
<Option name="rounding_type" value="0" type="int"/>
<Option name="show_plus" value="false" type="bool"/>
<Option name="show_thousand_separator" value="true" type="bool"/>
<Option name="show_trailing_zeros" value="false" type="bool"/>
<Option name="thousand_separator" value="" type="QChar"/>
<Option name="decimal_separator" type="invalid"></Option>
<Option name="decimals" type="int" value="6"></Option>
<Option name="direction_format" type="int" value="0"></Option>
<Option name="rounding_type" type="int" value="0"></Option>
<Option name="show_plus" type="bool" value="false"></Option>
<Option name="show_thousand_separator" type="bool" value="true"></Option>
<Option name="show_trailing_zeros" type="bool" value="false"></Option>
<Option name="thousand_separator" type="invalid"></Option>
</Option>
</BearingFormat>
<GeographicCoordinateFormat id="geographiccoordinate">
<Option type="Map">
<Option name="angle_format" type="QString" value="DecimalDegrees"></Option>
<Option name="decimal_separator" type="invalid"></Option>
<Option name="decimals" type="int" value="6"></Option>
<Option name="rounding_type" type="int" value="0"></Option>
<Option name="show_leading_degree_zeros" type="bool" value="false"></Option>
<Option name="show_leading_zeros" type="bool" value="false"></Option>
<Option name="show_plus" type="bool" value="false"></Option>
<Option name="show_suffix" type="bool" value="false"></Option>
<Option name="show_thousand_separator" type="bool" value="true"></Option>
<Option name="show_trailing_zeros" type="bool" value="false"></Option>
<Option name="thousand_separator" type="invalid"></Option>
</Option>
</GeographicCoordinateFormat>
<CoordinateCustomCrs>
<spatialrefsys nativeFormat="Wkt">
<wkt>GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>EPSG:7030</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</CoordinateCustomCrs>
</ProjectDisplaySettings>
<ProjectGpsSettings autoAddTrackVertices="0" autoCommitFeatures="0" destinationFollowsActiveLayer="1" destinationLayer="">
<timeStampFields></timeStampFields>
</ProjectGpsSettings>
</qgis>
Loading

0 comments on commit aa7aabc

Please sign in to comment.