Skip to content

Commit

Permalink
chore: added basic 3D frontend test
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Oct 18, 2023
1 parent d705f47 commit 1384456
Show file tree
Hide file tree
Showing 3 changed files with 578 additions and 0 deletions.
66 changes: 66 additions & 0 deletions test/3D.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import _ from 'lodash'
import chai, { util, expect } from 'chai'
import chailint from 'chai-lint'

import { core, map } from '@kalisio/kdk/test.client.js'

const suite = '3D'

const catalogLayersTab = 'catalog-layers-tab'
const userLayersTab = 'user-layers-tab'

describe(`suite:${suite}`, () => {
let runner, page
const user = { email: '[email protected]', password: 'Pass;word1' }

before(async () => {
chailint(chai, util)

runner = new core.Runner(suite, {
appName: 'kano',
user: user.email,
geolocation: { latitude: 43.10, longitude: 1.71 },
localStorage: {
'kano-welcome': false
}
})
page = await runner.start()
await core.login(page, user)
})

it('import data and switch to 3D mode', async () => {
await map.importLayer(page, runner.getDataPath('trace.gpx'))
await map.saveLayer(page, userLayersTab, 'trace')
await core.clickPaneAction(page, 'top', 'toggle-globe')
await map.zoomToLayer(page, userLayersTab, 'trace')
})

it('check terrain layer category', async () => {
await map.clickCatalogTab(page, catalogLayersTab)
const categoryId = await map.getLayerCategoryId(page, map.getLayerId('K2'))
expect(categoryId).to.equal('categories-terrain-layers')
expect(await map.isLayerCategoryOpened(page, categoryId)).beFalse()
await map.clickLayerCategory(page, catalogLayersTab, categoryId)
expect(await map.isLayerCategoryOpened(page, categoryId)).beTrue()
await core.clickOpener(page, 'right')
})

it('check base and terrain layers', async () => {
await core.clickOpener(page, 'right')
const layers = ['IMAGERY', 'K2']
for (const layer of layers) {
await map.clickLayer(page, catalogLayersTab, layer)
}
await core.clickOpener(page, 'right')
expect(await runner.captureAndMatch('terrain')).beTrue()
}).timeout(60000)

it('remove layer', async () => {
await map.removeLayer(page, userLayersTab, 'trace')
})

after(async () => {
await core.logout(page)
await runner.stop()
})
})
Binary file added test/data/3D/screenrefs/terrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1384456

Please sign in to comment.