Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ pnpm add --save-dev cypress
```

**Open Cypress**

To open cypress, execute this command on the bash in the folder where cypress is located:
````
npx cypress open
user:/example/to/cypress/tests/for/mapbender/$ npx cypress open
````
Then select E2E Testing in the window that opens

Expand Down
7 changes: 7 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost',
experimentalRunAllSpecs: true,
viewportHeight: 800,
viewportWidth: 1280,
// setupNodeEvents(on, config) {
// // implement node event listeners here
// },
Expand All @@ -18,6 +20,11 @@ module.exports = defineConfig({
layer : {
1 : 'Themen'
},
sources :{
wmts: 'https://www.wmts.nrw.de/geobasis/wmts_nw_alkis',
wms: 'https://www.wms.nrw.de/geobasis/wms_nw_alkis?VERSION=1.3.0&Service=WMS&Request=getCapabilities',
vt: 'https://wms.wheregroup.com/tileserver/style/osm-liberty.json'
},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/mapbender/00-init/00-login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('mapbender login to app', () => {
cy.visit(mainUrl);
});

it('login', () => {
it('test login to mapbender', () => {
cy.login({_username: user, _password: password});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('copy and delete application', () => {
cy.login({_username: user, _password: password});
});

it('Copy Application', () => {
it('test copy and delete application', () => {
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.visit(mainUrl);
cy.contains(myAppTitle).scrollIntoView({ offset: { top: -200, left:0 } });
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/mapbender/00-init/02-copyApplication.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('copy application', () => {
cy.login({_username: user, _password: password});
});

it('Copy Application', () => {
it('test copy application', () => {
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.visit(mainUrl);
cy.contains(myAppTitle).scrollIntoView({ offset: { top: -200, left:0 } });
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/mapbender/00-init/03-deleteApplication.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('delete application', () => {
cy.login({_username: user, _password: password});
});

it('Copy Application', () => {
it('test delete application', () => {
cy.contains(myAppTitle).scrollIntoView({ offset: { top: -200, left:0 } });
cy.wait(2000);
cy.deleteApplication({ _slug: myAppSlug });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('check_backend_main_functions', () => {
cy.login({_username: user, _password: password});
});

it('Check backend functions', () => {
it('test check backend standard functions', () => {
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug });

cy.visit(mainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('check_backend_main_functions', () => {
cy.login({_username: user, _password: password});
});

it('Check backend application functions', () => {
it('test check backend standard application functions', () => {
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug });
cy.visit(mainUrl);
cy.contains(myAppTitle).scrollIntoView({ offset: { top: -200, left:0 } });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ describe('create new user', () => {
cy.login({_username: user, _password: password});
});

it('addMapbenderUser ', () => {
it('test add mapbender user ', () => {
cy.CyLog("create new user", "Start");
cy.addMapbenderUser({ _username: userName, _email: userMail, _password: userPassword });
cy.CyLog("create new user", "Stopp");
});

})
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('delete Mapbender User', () => {
cy.login({_username: user, _password: password});
})

it('deleteMapbenderUser ', () => {
it('test delete mapbender user ', () => {
cy.deleteMapbenderUser(userName);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const mbGroup = 'Cypress';
const mbGroupDescription = 'This is the Cypress Test Group';
describe('create new user', () => {
describe('create new group', () => {

const myApp = Cypress.env('application');
const user = myApp['user'];
const password = myApp['password'];
Expand All @@ -11,8 +12,9 @@ describe('create new user', () => {
cy.login({_username: user, _password: password});
});

it('addMapbenderGroup ', () => {
it('test add mapbender group ', () => {
cy.CyLog("create new group", "Start");
cy.addMapbenderGroup(mbGroup, mbGroupDescription);
cy.CyLog("create new group", "Stopp");
});

})
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('delete Mapbender User', () => {
cy.login({_username: user, _password: password});
})

it('deleteMapbenderGroup ', () => {
it('test delete mapbender group ', () => {
cy.deleteMapbenderGroup(mbGroupTitle);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('add user to group', () => {

const myAppUrl = mainUrl + 'application/' + myAppSlug;
const waitLong= 2000;
it('deleteDataSource', () => {
it('test add mapbender user to group', () => {
cy.CyLog('test user to group', 'Start');
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.visit(mainUrl);
Expand Down
38 changes: 35 additions & 3 deletions cypress/e2e/mapbender/01-backend/02-sources/04-addDataSource.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,49 @@ describe('Add Data Source', () => {
const user = myApp['user'];
const password = myApp['password'];
const mainUrl = myApp['mainUrl'];
const sourceWMTS = "manager/repository/new/wmts";
const sourceWMS = "manager/repository/new/wms";
const sourceVT = "manager/repository/new/vector_tiles";

beforeEach(() => {
cy.visit(mainUrl);
cy.login({_username: user, _password: password});
})

const dataSource = 'https://www.wms.nrw.de/geobasis/wms_nw_alkis?VERSION=1.3.0&Service=WMS&Request=getCapabilities';
const serviceWMS = Cypress.env('application')['sources']['wms'];
const serviceWMTS = Cypress.env('application')['sources']['wmts'];
const serviceVT = Cypress.env('application')['sources']['vt'];

//const serviceWMS = Cypress.env('application').sources.wms;
const waitLong= 2000;
it('addDataSource', () => {
it('test add data source', () => {
cy.CyLog('Test add Data Source', 'Start');
cy.addMapbenderSource(dataSource);

// Test vector tiles
cy.addMapbenderSource(serviceVT, sourceVT);
cy.wait(waitLong);
cy.get('a#tabApplications').click();
cy.wait(waitLong);
cy.get('a#tabService').click();
cy.wait(waitLong);
cy.get('a#tabLayers').click();
cy.wait(waitLong);


// Test WMS Service
cy.addMapbenderSource(serviceWMS, sourceWMS);
cy.wait(waitLong);
cy.get('a#tabApplications').click();
cy.wait(waitLong);
cy.get('a#tabContact').click();
cy.wait(waitLong);
cy.get('a#tabService').click();
cy.wait(waitLong);
cy.get('a#tabLayers').click();
cy.wait(waitLong);

// Test WMTS Service
cy.addMapbenderSource(serviceWMTS, sourceWMTS);
cy.wait(waitLong);
cy.get('a#tabApplications').click();
cy.wait(waitLong);
Expand All @@ -24,6 +55,7 @@ describe('Add Data Source', () => {
cy.wait(waitLong);
cy.get('a#tabLayers').click();
cy.wait(waitLong);
cy.get('a[data-test="mb-containerMatrixsets"]').click();
cy.CyLog('Test add Data Source', 'End');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Update Data Source', () => {

const dataSource = 'FOSS4G Conference Locations';
const waitLong= 2000;
it('updateDataSource', () => {
it('test update data source', () => {
cy.CyLog('Test update Data Source', 'Start');
const url = Cypress.env('application')['mainUrl'];
cy.visit(url + 'manager/repository');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,40 @@ describe('Delete Data Source', () => {
cy.login({_username: user, _password: password});
})

const dataSourceTitle = 'WMS NW ALKIS';
const dataSourceTitleWMS = 'WMS NW ALKIS';
const dataSourceTitleWMTS = 'WMTS NW ALKIS';
const dataSourceTitleVT = 'OSM Liberty';
const waitLong= 2000;
it('deleteDataSource', () => {
it('test delete data source', () => {
cy.CyLog('Test delete Data Source', 'Start');
const url = Cypress.env('application')['mainUrl'];
cy.visit(url + 'manager/repository');

cy.get('a[data-test="mb-delete-source-' + dataSourceTitle + '"]').then($elem =>{
// WMS Service delete
cy.get('a[data-test="mb-delete-source-' + dataSourceTitleWMS + '"]').then($elem =>{
const wmsLength = $elem.length;
for (let i = 0; i < $elem.length; i++){
cy.deleteMapbenderSource(dataSourceTitle);
cy.deleteMapbenderSource(dataSourceTitleWMS);
}
});

// WMTS Service delete
cy.get('a[data-test="mb-delete-source-' + dataSourceTitleWMTS + '"]').then($elem =>{
const wmsLength = $elem.length;
for (let i = 0; i < $elem.length; i++){
cy.deleteMapbenderSource(dataSourceTitleWMTS);
}
});

// Vector tile Service delete
cy.get('a[data-test="mb-delete-source-' + dataSourceTitleVT + '"]').then($elem =>{
const wmsLength = $elem.length;
for (let i = 0; i < $elem.length; i++){
cy.deleteMapbenderSource(dataSourceTitleVT);
}
});


cy.wait(waitLong);
cy.CyLog('Test delete Data Source', 'End');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('add link to toolbar in layout', () => {

const myAppUrl = mainUrl + 'application/' + myAppSlug;
const waitLong= 2000;
it('deleteDataSource', () => {
it('test add link to toolbar', () => {
cy.CyLog('test add link to toolbar in layout', 'Start');
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ describe('add wms service to layerset', () => {
const dataSourceTitle = ['WMS NW ALKIS', 'FOSS4G'];
const waitLong= 2000;
const waitShort = 500;
it('deleteDataSource', () => {
it('test add wms service', () => {
cy.CyLog('test add wms service layerset main', 'Start');
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );

cy.addMapbenderSource(dataSource);
cy.addMapbenderSource(dataSource, 'manager/repository/new/wms');

cy.visit(mainUrl);
cy.get('[data-test="' + myAppSlug + '-edit"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ describe('Test Legend', () => {
const myUrl = mainUrl + 'application/' + myAppSlug;
// create selector for layertree (layers must be activated for legend)
const mbSelector = 'div.accordion-cell div.mb-element-layertree';
it('Test Legend', () => {
it('test map legend', () => {
cy.CyLog("Test Legend", "Start");
cy.showBanner("Legend test!")
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.visit(myUrl);

Expand All @@ -30,21 +31,21 @@ describe('Test Legend', () => {
})

/**
* Alle Hauptlayer Nodes auslesen und aktivieren
* elements: Array mit Layer Node Namen
* Read and process all main layer nodes
* elements: Array with Layer Node Namen
*/
cy.get('li.serviceContainer')
.children('div.leaveContainer')
.children('span.layer-title')
.then($elems =>{
for(let i = 0; i < $elems.length; i++){
cy.CyLog('Test Layertree: ', 'Test layer name: ' + $elems[i].title);
cy.showLayerTree({_layerNodeTitle: $elems[i].title});
cy.showLayerNode({_layerNodeTitle: $elems[i].title});
cy.activateLayer({_layerNodeTitle: $elems[i].title});
}
})
// Legende anschalten.
cy.get('span.iconBig > i.fa-th-list').parent().click();
cy.get('span[data-test="mb-iconLegend"]').click();
cy.wait(2000);
cy.get('div.legend-dialog').find('button[data-test="mb-legend-btn-close"]').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ describe('Test WMS-Loader', () => {
const waitLong = 2000;
const wms1 = 'https://www.wms.nrw.de/geobasis/wms_nw_tfis?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0'; // geoportal.nrw touristic informations
const wms2 = 'https://www.wms.nrw.de/wms/kitas?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0'; // geoportal.nrw kindertagesstätten
it('Test WMS-Loader', () => {
it('test WMS loader', () => {
cy.CyLog("Test WMS-Loader", "Start");
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.visit(myUrl);


// test wms1
// open wmsloader
cy.get('span.iconBig > i.fa-globe').parent().click();
cy.get('span[data-test="mb-iconWms"]').click();

// add wms-link
cy.get('div.mb-element-wmsloader')
Expand All @@ -37,7 +37,7 @@ describe('Test WMS-Loader', () => {
.click();

// test wms2
cy.get('span.iconBig > i.fa-globe').parent().click();
cy.get('span[data-test="mb-iconWms"]').click();
cy.get('div.mb-element-wmsloader')
.find('input[name="loadWmsUrl"]')
.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ describe('Test POI', () => {

const myUrl = mainUrl + 'application/' + myAppSlug;
const waitLong = 2000;
it('Test POI', () => {
it('test POI', () => {
cy.CyLog("Test POI", "Start");
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
cy.viewport(1200, 800);
cy.visit(myUrl);

// open POI
cy.get('span.iconBig > i.fa-thumbtack').parent().click();
cy.get('span[data-test="mb-iconPoi"]').click();
// write POI Text
cy.get('div.mb-poi-popup').find('textarea.form-control').type('{enter}Cypress Test POI!');
// Create POI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ describe('Test print', () => {
});

const myUrl = mainUrl + 'application/' + myAppSlug;
it('Test', () => {
it('test print', () => {
cy.CyLog("Test Print", "Start");
cy.copyApplication({ _title: myAppTitle, _slug: myAppSlug } );
// Chance default ViewPort. Because the print button is not visible in smaller sizes
cy.viewport(1200, 800);
cy.visit(myUrl);

// Open print menu.
cy.get('i.fa-print').click();
cy.get('span[data-test="mb-iconPrint"]').click();

// Test the template choice
cy.get('label.form-label[for="template"]')
Expand Down
Loading