-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
51 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import path from 'path' | ||
describe('download functionality', function () { | ||
beforeEach(() => { | ||
cy.viewport(1848, 980) | ||
}) | ||
|
||
function downloadFile(typeTitle, ext) { | ||
const cleanName = typeTitle.replace(' ', '_') | ||
cy.get('.open-download-btn').click() | ||
cy.get('.download-modal') | ||
cy.get('.export-file-name input[type=text]').clear().type(cleanName) | ||
cy.get('.download-format .v-select__selections').click() | ||
cy.get('.v-menu__content--fixed > .v-select-list > .v-list') | ||
.contains('div > .v-list__tile > ' + | ||
'.v-list__tile__content > .v-list__tile__title', typeTitle).click() | ||
cy.get('.download').click() | ||
let fileName = `${cleanName}.${ext}` | ||
return path.join(Cypress.config('downloadsFolder'), fileName) | ||
} | ||
|
||
it('downloads route json file', () => { | ||
cy.visit('/#/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 filePath = downloadFile('ORS JSON', 'json') | ||
cy.readFile(filePath).its('options').should('deep.equal', | ||
{ | ||
'zoom': 8, | ||
'profile': 'driving-car', | ||
'preference': 'recommended' | ||
}) | ||
// TODO: extend download tests. Aliasing the readFile with as(..) doesn't work | ||
// cy.get('@response').its('places[0].placeName').should('eq', 'Mannheim, BW,Germany') | ||
// cy.get('@response').its('mode').should('eq', 'directions') | ||
// cy.get('@response').its('isRouteData').should('eq', 'directions') | ||
}) | ||
it('downloads a geojson file', () => { | ||
const filePath = downloadFile('GeoJSON', 'json') | ||
cy.readFile(filePath).its('features').should('have.length', 3) | ||
}) | ||
it('downloads a gpx file', () => { | ||
const filePath = downloadFile('ORS API GPX', 'gpx') | ||
cy.readFile(filePath) | ||
}) | ||
it('downloads a gpx file', () => { | ||
const filePath = downloadFile('Standard GPX', 'gpx') | ||
cy.readFile(filePath) | ||
}) | ||
it('downloads a kml file', () => { | ||
const filePath = downloadFile('KML', 'kml') | ||
cy.readFile(filePath) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.