Commit 15c09b32 authored by Matthieu Fesselier's avatar Matthieu Fesselier

add e2e tests

parent 414597ce
Pipeline #7081 passed with stage
in 3 minutes and 59 seconds
describe('solid-map', function() {
this.beforeAll('visit', () => {
cy.visit('/examples/e2e/solid-map.html')
})
it('display markers', () => {
cy.get('#map-1 .leaflet-marker-pane').children().should('have.length', 3)
})
it('display content in popup markers', () => {
cy.get('#map-2 .leaflet-marker-pane').children().first().click({force: true})
cy.get('#map-2 .leaflet-popup-pane').children().should('have.length', 1)
cy.get('#map-2 .leaflet-popup-content solid-display')
.should('have.length', 1)
.and('have.attr', 'data-src', 'event-1.jsonld')
cy.get('#map-2 .leaflet-popup-content solid-display > div > solid-set-default')
.should('have.length', 1)
.and('have.attr', 'name', 'infos')
cy.get('#map-2 .leaflet-popup-content solid-display > div > solid-set-default[name=infos] > solid-display-value').should('have.length', 2)
cy.get('#map-2 .leaflet-popup-content solid-display > div > solid-set-default[name=infos] > solid-display-value[name=name]').contains('Test 1')
cy.get('#map-2 .leaflet-popup-content solid-display > div > solid-set-default[name=infos] > solid-display-value[name=category]').contains('showcase event')
})
it('groups markers', () => {
cy.get('#map-3 .leaflet-marker-pane .group-meetup').should('have.length', 1)
cy.get('#map-3 .leaflet-marker-pane .group-showcaseevent').should('have.length', 2)
})
it('applies attributes', () => {
cy.get('#map-4 .leaflet-marker-pane').children().first().click({force: true})
cy.get('#map-4 .leaflet-popup-content solid-display-div[name=name]')
.should('have.length', 1)
.should('have.class', 'test-class-name')
cy.get('#map-4 .leaflet-popup-content solid-display-div[name=name] button')
.should('have.length', 1)
.contains('Modifier')
.click()
cy.get('#map-4 .leaflet-popup-content solid-display-div[name=name] > div')
.should('have.attr', "contenteditable")
})
it('filters markers', () => {
cy.get('#map-5 solid-form').should('have.length', 1)
cy.get('#map-5 solid-form input[name=category]').type('showcase')
cy.get('#map-5 .leaflet-marker-pane').children().should('have.length', 2)
cy.get('#map-5 span#counter').contains('2 results')
cy.get('#map-5 solid-form input[name=category]').clear().type('mee')
cy.get('#map-5 .leaflet-marker-pane').children().should('have.length', 1)
cy.get('#map-5 span#counter').contains('1 results')
})
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>SIB test: solid-map</title>
<script type="module" src="../../dist/index.js"></script>
<script type="module" src="../../dist/components/solid-map.js"></script>
<script>
document.addEventListener("DOMContentLoaded", event => {
document.querySelector("solid-map").addEventListener("resourceSelect", event => console.log(event.detail.resource));
});
</script>
<link rel="stylesheet" href="../styles.css" />
</head>
<body>
<h2>Sib Map</h2>
<solid-map
id="map-1"
data-src="../data/map/events.jsonld"
style="display: block; width: 800px; height: 600px;"
></solid-map>
<solid-map
id="map-2"
data-src="../data/map/events.jsonld"
fields="infos(name, category)"
style="display: block; width: 800px; height: 600px;"
></solid-map>
<solid-map
id="map-3"
data-src="../data/map/events.jsonld"
group-by="category"
style="display: block; width: 800px; height: 600px;"
></solid-map>
<solid-map
id="map-4"
data-src="../data/map/events.jsonld"
fields="infos(name, category)"
group-by="category"
class-name="test-class-name"
widget-name="solid-display-div"
editable-name
style="display: block; width: 800px; height: 600px;"
></solid-map>
<solid-map
id="map-5"
data-src="../data/map/events.jsonld"
fields="name, category"
search-fields="category"
counter-template="<span id='counter'>${counter} results<span>"
style="display: block; width: 800px; height: 600px;"
></solid-map>
<style>
.group-meetup {
border-color: coral;
}
</style>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment