Skip to content

Commit

Permalink
test: test embed mode only in e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Oct 27, 2021
1 parent db6d21e commit 2d5d98b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 40 deletions.
2 changes: 2 additions & 0 deletions tests/e2e/specs/app-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
.assert.elementPresent('.leaflet-draw')
.assert.elementPresent('#polyline-measure-control')
.assert.elementPresent('.my-location-btn')
.assert.not.elementPresent('.view-on-ors')
.end()
},
'app embedded mode rendering': function (browser) {
Expand All @@ -36,6 +37,7 @@ module.exports = {
.assert.not.elementPresent('.leaflet-draw')
.assert.not.elementPresent('#polyline-measure-control')
.assert.not.elementPresent('.my-location-btn')
.assert.elementPresent('.view-on-ors')
.end()
}
}
40 changes: 0 additions & 40 deletions tests/integration/specs/AppRender.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,44 +80,4 @@ describe('App rendering', () => {
done.fail(err)
})
})

it('should render app in embed mode', async (done) => {

let vueInstance = await new AppLoader().loadApp(AppRootComponent, '#app', '<App/>')

// Switch the application to embed mode
store.commit('embed', true)

vueInstance.appHooks.loadRegisteredHooks()
vueInstance.appHooks.run('appLoaded', vueInstance)

let appContent = vueInstance.$el.querySelector('.app-content')
expect(appContent).toBeDefined()
expect(appContent).not.toBeNull()

let mapView = vueInstance.$el.querySelector('#map-view')
expect(mapView).toBeDefined()
expect(mapView).not.toBeNull()

appContent.__vue__.$nextTick(() => {
// In embed mode, simple place search and other components must not be visible
expect(appContent.querySelector('.my-location-floating-menu')).toBeNull()
expect(appContent.querySelector('.fit-all-features')).toBeNull()
expect(appContent.querySelector('.over-brand')).toBeNull()
expect(appContent.querySelector('#polyline-measure-control')).toBeNull()
expect(appContent.querySelector('.simple-place-search')).toBeNull()

// The decision about rendering or not some leaflet or third-part components
// is made on mount or created cycle. As we are setting the embed more after the
// app load cycle, then this check is not working. Another strategy has to be found
// expect(appContent.querySelector('.leaflet-draw')).toBeNull()
// expect(appContent.querySelector('.leaflet-control-zoom')).toBeNull()

// In embed mode, view-on-ors button must be visible
let viewOnOrs = appContent.querySelector('.view-on-ors')
expect(viewOnOrs).toBeDefined()
expect(viewOnOrs).not.toBeNull()
done()
})
})
})

0 comments on commit 2d5d98b

Please sign in to comment.