Skip to content

Commit

Permalink
test: WIP migration to new structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh committed Jun 1, 2019
1 parent 9d97959 commit 440d961
Show file tree
Hide file tree
Showing 3 changed files with 325 additions and 135 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?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>
<!-- breaks the test?
<description>X</description>
-->
<Point>
<coordinates>
-73.9470660219183,40.784236650177654
</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/// <reference types="Cypress" />
var os = require('../../../support/selectors.js');

os.layerFeaturesDialog = {
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: '[data-testid=\'featurelist\'] .slick-row',
ROWS_CELLS: '.slick-cell',
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() {
// TODO: set to 15 once we enable description in the test data
cy.get(os.layerFeaturesDialog.HEADER_CELLS).should('have.length', 14);
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');
// commented out in the test data
// 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.ROWS_CELLS).contains('18TWL8884215339');
});
});

// Check selection
cy.get(os.layerFeaturesDialog.ROWS).should('be.visible');
cy.get(os.layerFeaturesDialog.ROWS).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).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).first().click();
cy.get(os.layerFeaturesDialog.FULL_FOOTER_STATUS_TEXT).should('contain', '7 records (1 selected)');

cy.get(os.layerFeaturesDialog.ROWS).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).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).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).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');
});
});
Loading

0 comments on commit 440d961

Please sign in to comment.