Skip to content

Commit

Permalink
test(download.spec.js): resize window before running download action
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Dec 30, 2021
1 parent ae98757 commit 0f25cbe
Showing 1 changed file with 20 additions and 41 deletions.
61 changes: 20 additions & 41 deletions tests/e2e/specs/download.spec.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
/* eslint-disable no-undef */
module.exports = {

'download route default file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`

browser
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
.setValue('.export-file-name input[type=text]', downloadFileNameAppend)
.clearDownloadedFiles()
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.json`)
.clearDownloadedFiles()
.end()
},

'download route json file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`
let fileName = `ors-route${downloadFileNameAppend}.json`

browser
.resizeWindow(1848, 980)
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.clearDownloadedFiles()
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
Expand All @@ -42,21 +21,21 @@ module.exports = {
.click({selector: '.menuable__content__active a', index: 0})
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.json`)
.clearDownloadedFiles()
.checkDownloadFileIsValid(fileName)
.deleteDownloadedFile(fileName)
.end()
},

'download route geojson file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`
let fileName = `ors-route${downloadFileNameAppend}.json`

browser
.resizeWindow(1848, 980)
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.clearDownloadedFiles()
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
Expand All @@ -67,20 +46,20 @@ module.exports = {
.click({selector: '.menuable__content__active a', index: 1})
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.json`)
.clearDownloadedFiles()
.checkDownloadFileIsValid(fileName)
.deleteDownloadedFile(fileName)
.end()
},
'download route ors gpx file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`
let fileName = `ors-route${downloadFileNameAppend}.gpx`

browser
.resizeWindow(1848, 980)
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.clearDownloadedFiles()
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
Expand All @@ -91,20 +70,20 @@ module.exports = {
.click({selector: '.menuable__content__active a', index: 2})
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.gpx`)
.clearDownloadedFiles()
.checkDownloadFileIsValid(fileName)
.deleteDownloadedFile(fileName)
.end()
},
'download route standard gpx file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`
let fileName = `ors-route${downloadFileNameAppend}.gpx`

browser
.resizeWindow(1848, 980)
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.clearDownloadedFiles()
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
Expand All @@ -115,20 +94,20 @@ module.exports = {
.click({selector: '.menuable__content__active a', index: 3})
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.gpx`)
.clearDownloadedFiles()
.checkDownloadFileIsValid(fileName)
.deleteDownloadedFile(fileName)
.end()
},
'download route kml file': function (browser) {
const directionsUrl = `${browser.globals.devServerURL}/#/directions/Mannheim,BW,Germany/Heidelberg,BW,Germany/data/%7B"coordinates":"8.492765,49.488789;8.692416,49.401247","options":%7B"zoom":8,"profile":"driving-car","preference":"recommended"%7D%7D`
const downloadFileNameAppend = `-${new Date().getTime()}`
let fileName = `ors-route${downloadFileNameAppend}.kml`

browser
.resizeWindow(1848, 980)
.url(directionsUrl)
.waitForElementVisible('.app-content', 10000)
.assert.elementPresent('#app')
.click('.open-menu')
.clearDownloadedFiles()
.pause(1000)
.click('.open-download-btn')
.waitForElementVisible('.download-modal', 10000)
Expand All @@ -139,8 +118,8 @@ module.exports = {
.click({selector: '.menuable__content__active a', index: 4})
.click('.download')
.pause(1000)
.checkDownloadFileIsValid(`ors-route${downloadFileNameAppend}.kml`)
.clearDownloadedFiles()
.checkDownloadFileIsValid(fileName)
.deleteDownloadedFile(fileName)
.end()
}
}

0 comments on commit 0f25cbe

Please sign in to comment.