-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(featurelist): Cypress tests for featurelist.
- Loading branch information
Showing
6 changed files
with
347 additions
and
3 deletions.
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
cypress/fixtures/regression-tests/layers-dialog/layer-features/feat.kml
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,156 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<kml xmlns:kml="http://earth.google.com/kml/2.2"> | ||
<Document id="featureCollection"> | ||
<Style id="defaultStyle"> | ||
<LineStyle> | ||
<width>1.5</width> | ||
</LineStyle> | ||
<PolyStyle> | ||
<color>7d8a30c4</color> | ||
</PolyStyle> | ||
</Style> | ||
<Folder> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>Astor Pl</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>4-6-6 Express</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>4 nights, 6-all times, 6 Express-weekdays AM southbound, PM northbound</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>1</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-73.99106999861966,40.73005400028978 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>Canal St</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>4-6-6 Express</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>4 nights, 6-all times, 6 Express-weekdays AM southbound, PM northbound</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>2</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-74.00019299927328,40.71880300107709 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>50th St</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>1-2</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>1-all times, 2-nights</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>3</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-73.98384899986625,40.76172799961419 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>Bergen St</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>2-3-4</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>4-nights, 3-all other times, 2-all times</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>4</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-73.97499915116808,40.68086213682956 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>Pennsylvania Ave</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>3-4</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>4-nights, 3-all other times</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>5</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-73.89488591154061,40.66471445143568 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>Morrison Av - Soundview</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>6</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>6-all times</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>51</value> | ||
</Data> | ||
</ExtendedData> | ||
<Point> | ||
<coordinates> | ||
-73.87451599929486,40.82952100156747 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
<Placemark> | ||
<styleUrl>#defaultStyle</styleUrl> | ||
<name>96th St</name> | ||
<ExtendedData> | ||
<Data name="line"> | ||
<value>Q</value> | ||
</Data> | ||
<Data name="notes"> | ||
<value>Q-all times</value> | ||
</Data> | ||
<Data name="objectid"> | ||
<value>643</value> | ||
</Data> | ||
</ExtendedData> | ||
<description>This is the description text.</description> | ||
<Point> | ||
<coordinates> | ||
-73.9470660219183,40.784236650177654 | ||
</coordinates> | ||
</Point> | ||
</Placemark> | ||
</Folder> | ||
</Document> | ||
</kml> |
180 changes: 180 additions & 0 deletions
180
cypress/integration/regression-tests/layers-dialog/layer-features.spec.js
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,180 @@ | ||
/// <reference types="Cypress" /> | ||
var os = require('../../../support/selectors.js'); | ||
|
||
os.layerFeaturesDialog = { | ||
CELLS: '.slick-cell', | ||
DESCRIPTION_CELL: '[data-testid=\'featurelist\'] .slick-viewport .slick-cell', | ||
DIALOG: '[data-testid=\'featurelist\']', | ||
FOOTER_STATUS_TEXT: '[ng-if=\'ctrl.status\']', | ||
FULL_FOOTER_STATUS_TEXT: '[data-testid=\'featurelist\'] [ng-if=\'ctrl.status\']', | ||
GRID: '[data-testid=\'featurelist\'] .slick-grid', | ||
HEADER_CELLS: '.slick-column-name', | ||
HEADER_ROW: '.slick-header', | ||
ROWS_CELLS: '[data-testid=\'featurelist\'] .slick-cell.l5', | ||
SOURCE_GRID: '.js-source-grid', | ||
VIEWPORT: '.slick-viewport', | ||
buttons: { | ||
CLOSE: '[ng-click=\'ctrl.close()\']' | ||
}, | ||
contextMenu: { | ||
EXPORT: '[title=\'Exports data to a file\']', | ||
DESELECT_ALL: '[title=\'Deselects all items\']', | ||
INVERT_SELECTION: '[title=\'Inverts the selection\']', | ||
SELECT_ALL: '[title=\'Selects all items\']', | ||
HIDE_SELECTED: '[title=\'Hides selected items\']', | ||
DISPLAY_ALL: '[title=\'Displays all items\']', | ||
HIDE_UNSELECTED: '[title=\'Hides unselected items\']', | ||
REMOVE_SELECTED: '[title=\'Removes selected items\']', | ||
REMOVE_UNSELECTED: '[title=\'Removes the unselected items\']' | ||
} | ||
}; | ||
|
||
var TEST_FIXTURE_DATA = 'regression-tests/layers-dialog/layer-features/feat.kml'; | ||
|
||
describe('Feature grid', function() { | ||
before('Login', function() { | ||
cy.login(); | ||
}); | ||
|
||
it('Shows data', function() { | ||
// Upload a file | ||
cy.get(os.Toolbar.addData.OPEN_FILE_BUTTON).click(); | ||
cy.get(os.importDataDialog.DIALOG).should('be.visible'); | ||
cy.upload(TEST_FIXTURE_DATA); | ||
cy.get(os.importDataDialog.NEXT_BUTTON).click(); | ||
cy.get(os.importKMLDialog.DIALOG).should('be.visible'); | ||
cy.get(os.importKMLDialog.LAYER_TITLE_INPUT).should('be.visible'); | ||
cy.get(os.importKMLDialog.OK_BUTTON).click(); | ||
|
||
// Load a layer | ||
cy.get(os.layersDialog.Tabs.Layers.Tree.LAYER_4).should('contain', TEST_FIXTURE_DATA + ' Features (7)'); | ||
|
||
cy.get(os.layersDialog.Tabs.Layers.Tree.LAYER_4).rightClick(); | ||
cy.get(os.layersDialog.Tabs.Layers.Tree.Type.featureLayer.Local.contextMenu.menuOptions.SHOW_FEATURES).click(); | ||
cy.get('[title=\'' + TEST_FIXTURE_DATA + '\']').should('be.visible'); | ||
|
||
// Check status bar | ||
cy.get(os.layerFeaturesDialog.DIALOG).within(function() { | ||
cy.get(os.layerFeaturesDialog.FOOTER_STATUS_TEXT).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.FOOTER_STATUS_TEXT).should('contain', '7 records'); | ||
}); | ||
|
||
cy.get(os.layerFeaturesDialog.DIALOG).within(function() { | ||
cy.get(os.layerFeaturesDialog.SOURCE_GRID).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.SOURCE_GRID).within(function() { | ||
cy.get(os.layerFeaturesDialog.HEADER_ROW).should('be.visible'); | ||
// Check column headers | ||
cy.get(os.layerFeaturesDialog.HEADER_ROW).within(function() { | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).should('have.length', 15); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS + ':empty').should('exist'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('TIME'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('MGRS'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LAT_DMS'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LON_DMS'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LAT'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LON'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LAT_DDM'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('LON_DDM'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('line'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('name'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('notes'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('objectid'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('ID'); | ||
cy.get(os.layerFeaturesDialog.HEADER_CELLS).contains('description'); | ||
}); | ||
}); | ||
|
||
// Check data | ||
cy.get(os.layerFeaturesDialog.VIEWPORT).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.VIEWPORT).within(function() { | ||
cy.get(os.layerFeaturesDialog.CELLS).contains('18TWL8884215339'); | ||
}); | ||
}); | ||
|
||
cy.get(os.layerFeaturesDialog.DESCRIPTION_CELL).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.DESCRIPTION_CELL).contains('Show'); | ||
cy.get(os.layerFeaturesDialog.DESCRIPTION_CELL).contains('Show').click(); | ||
cy.get(os.descriptionInfoDialog.DIALOG, {timeout: 5000}).should('be.visible'); | ||
cy.get(os.descriptionInfoDialog.DIALOG).within(function() { | ||
// Check description content | ||
cy.get(os.descriptionInfoDialog.CONTENT).should('be.visible'); | ||
// https://github.com/cypress-io/cypress/issues/136 for why this is needed | ||
cy.get(os.descriptionInfoDialog.CONTENT).then(function($iframe) { | ||
const $body = $iframe.contents().find('body'); | ||
expect($body.text()).to.equal('This is the description text.'); | ||
}); | ||
cy.get(os.descriptionInfoDialog.CLOSE_BUTTON).click(); | ||
}); | ||
cy.get(os.descriptionInfoDialog.DIALOG, {timeout: 5000}).should('not.exist'); | ||
|
||
// Check selection | ||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).first().click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)'); | ||
|
||
// Check context menu works. | ||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).first().rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.EXPORT).should('be.visible'); | ||
|
||
cy.get(os.layerFeaturesDialog.contextMenu.DESELECT_ALL).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records'); | ||
|
||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).first().click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)'); | ||
|
||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).first().rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.INVERT_SELECTION).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (6 selected)'); | ||
|
||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.SELECT_ALL).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (7 selected)'); | ||
|
||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.DESELECT_ALL).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records'); | ||
|
||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).last().click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)'); | ||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.HIDE_SELECTED).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '6 records (1 hidden)'); | ||
|
||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.DISPLAY_ALL).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records'); | ||
|
||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).last().click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)'); | ||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.HIDE_UNSELECTED).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '1 record (1 selected, 6 hidden)'); | ||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.DISPLAY_ALL).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)'); | ||
|
||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.REMOVE_SELECTED).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '6 records'); | ||
|
||
cy.get(os.layerFeaturesDialog.ROWS_CELLS).last().click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '6 records (1 selected)'); | ||
cy.get(os.layerFeaturesDialog.GRID).rightClick(); | ||
cy.get(os.layerFeaturesDialog.contextMenu.REMOVE_UNSELECTED).click(); | ||
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '1 record (1 selected)'); | ||
|
||
// Check Close button works | ||
cy.get(os.layerFeaturesDialog.DIALOG).within(function() { | ||
cy.get(os.layerFeaturesDialog.buttons.CLOSE).should('be.visible'); | ||
cy.get(os.layerFeaturesDialog.buttons.CLOSE).click(); | ||
}); | ||
cy.get('[title=\'' + TEST_FIXTURE_DATA + '\']').should('not.exist'); | ||
|
||
// Clean up | ||
cy.get(os.layersDialog.Tabs.Layers.Tree.LAYER_4).should('contain', TEST_FIXTURE_DATA + ' Features (1)'); | ||
cy.get(os.layersDialog.Tabs.Layers.Tree.LAYER_4).click(); | ||
cy.get(os.layersDialog.Tabs.Layers.Tree.Type.featureLayer.REMOVE_LAYER_BUTTON_WILDCARD).click(); | ||
cy.get(os.layersDialog.DIALOG).should('not.contain', TEST_FIXTURE_DATA + ' Features'); | ||
cy.get(os.Application.PAGE).type('v'); | ||
}); | ||
}); |
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div class="flex-fill w-100 d-flex flex-column"> | ||
<div class="modal-body flex-fill u-overflow-y-auto card d-flex"> | ||
<iframe class="card flex-fill bg-light"></iframe> | ||
<iframe class="card flex-fill bg-light" data-testid="descriptioninfocontent"></iframe> | ||
</div> | ||
</div> |
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