Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions cypress/e2e/ingestion/files-ui.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
/// <reference types="cypress" />

import { byTestId, testIds } from '../../support/selectors';
import { continuePastMissingNodeCoverageWarning } from '../../support/journey-helpers';

describe('File Handling and Processing', () => {
const nodeFile = 'AngularTesting_nodelist_withseqs_TN93_BS.csv';
const compatibleNodeFile = 'AngularTesting_nodes_Map.csv';
const linkFile = 'AngularTesting_Epi_linklist_BS.csv';
const additionalNodeFile = compatibleNodeFile;
const geoJSONLocationFile = 'map-node-locations.geojson';
const coverageNodeFile = 'missing-node-coverage-nodes.csv';
const coverageLinkFile = 'missing-node-coverage-links.csv';
const matchedCoverageNodeFile = 'missing-node-coverage-matched-nodes.csv';
const matchedCoverageLinkFile = 'missing-node-coverage-matched-links.csv';
const extraCoverageNodeFile = 'missing-node-coverage-extra-node.csv';
const loadNodeFile = () => cy.loadFiles([{ name: nodeFile, datatype: 'node' }]);

beforeEach(() => {
Expand Down Expand Up @@ -180,6 +186,7 @@ describe('File Handling and Processing', () => {
cy.contains('#file-table .file-table-row', linkFile, { timeout: 20000 }).should('be.visible');
cy.get('.runtime-error-banner').should('not.exist');
cy.get('#launch').should('not.be.disabled').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.get('.lm_tab.lm_active', { timeout: 20000 }).should('contain.text', '2D Network');
});

Expand Down Expand Up @@ -286,6 +293,7 @@ describe('File Handling and Processing', () => {
]);

cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.get('.lm_tab.lm_active', { timeout: 20000 }).should('contain.text', '2D Network');

cy.window().its('commonService.session.data.nodes').should('have.length.greaterThan', 0);
Expand All @@ -303,6 +311,110 @@ describe('File Handling and Processing', () => {
});
});

it('gates launch when imported node and topology identifiers do not match', () => {
cy.loadFiles([
{ name: coverageNodeFile, datatype: 'node', field1: 'id' },
{ name: coverageLinkFile, datatype: 'link', field1: 'source', field2: 'target' },
]);

cy.get('#launch').click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog), { timeout: 10000 })
.should('be.visible')
.parents('.p-dialog')
.as('coverageDialog');

cy.get('@coverageDialog')
.find(byTestId(testIds.filesMissingNodeDataSection))
.should('contain.text', 'Missing node data (1)')
.and('contain.text', 'D');
cy.get('@coverageDialog')
.find(byTestId(testIds.filesMissingLinkInformationSection))
.should('contain.text', 'Missing link information (1)')
.and('contain.text', 'C');
cy.window().then((win: any) => {
expect(win.commonService.session.network.launched).to.equal(false);
expect(win.commonService.session.data.nodes).to.have.length(0);
});

cy.get('@coverageDialog')
.find(byTestId(testIds.filesMissingNodeCoverageCancel))
.click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog)).should('not.exist');
cy.get('.lm_tab.lm_active').should('contain.text', 'Files');
cy.window().then((win: any) => {
expect(win.commonService.session.network.launched).to.equal(false);
expect(win.commonService.session.files.map((file: any) => file.name)).to.include.members([
coverageNodeFile,
coverageLinkFile,
]);
});

cy.get('#launch').click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog), { timeout: 10000 })
.should('be.visible')
.parents('.p-dialog')
.find(byTestId(testIds.filesMissingNodeCoverageContinue))
.click({ force: true });

cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
cy.get('.lm_tab.lm_active', { timeout: 20000 }).should('contain.text', '2D Network');
});

it('launches without a coverage dialog when explicit topology is absent or fully matched', () => {
cy.loadFiles([{ name: coverageNodeFile, datatype: 'node', field1: 'id' }]);
cy.get('#launch').click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog)).should('not.exist');
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');

cy.visit('/?skipEula=1&skipDemoSession=1');
cy.get('#fileDropRef', { timeout: 15000 }).should('exist');

cy.loadFiles([
{ name: matchedCoverageNodeFile, datatype: 'node', field1: 'id' },
{ name: matchedCoverageLinkFile, datatype: 'link', field1: 'source', field2: 'target' },
]);
cy.get('#launch').click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog)).should('not.exist');
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
});

it('cancels an update without replacing the currently processed network', () => {
cy.loadFiles([
{ name: matchedCoverageNodeFile, datatype: 'node', field1: 'id' },
{ name: matchedCoverageLinkFile, datatype: 'link', field1: 'source', field2: 'target' },
]);
cy.get('#launch').click({ force: true });
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');

cy.get(byTestId(testIds.appFileMenuButton)).click({ force: true });
cy.contains('[role="menuitem"]', 'Add Data').click({ force: true });
cy.get('.lm_tab.lm_active', { timeout: 20000 }).should('contain.text', 'Files');
cy.loadFiles([{ name: extraCoverageNodeFile, datatype: 'node', field1: 'id' }]);

cy.get(byTestId(testIds.filesUpdateButton)).click({ force: true });
cy.get(byTestId(testIds.filesMissingNodeCoverageDialog), { timeout: 10000 })
.should('be.visible')
.parents('.p-dialog')
.find(byTestId(testIds.filesMissingNodeCoverageCancel))
.click({ force: true });

cy.window().then((win: any) => {
expect(win.commonService.session.network.launched).to.equal(true);
expect(win.commonService.session.data.nodes.map((node: any) => node._id).sort())
.to.deep.equal(['A', 'B']);
expect(win.commonService.session.files.map((file: any) => file.name))
.to.include(extraCoverageNodeFile);
});
});

it('detects a GeoJSON location file, joins feature centers to nodes, and stores the layer', () => {
cy.attach_files('#fileDropRef', [nodeFile, geoJSONLocationFile]);

Expand Down Expand Up @@ -351,6 +463,7 @@ describe('File Handling and Processing', () => {
]);

cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.get('.lm_tab.lm_active', { timeout: 20000 }).should('contain.text', '2D Network');

cy.get(byTestId(testIds.appFileMenuButton)).click({ force: true });
Expand Down Expand Up @@ -383,6 +496,7 @@ describe('File Handling and Processing', () => {
]);

cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand Down Expand Up @@ -410,6 +524,7 @@ describe('File Handling and Processing', () => {

cy.loadFiles([{ name: linkFile, datatype: 'link' }]);
cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand All @@ -428,6 +543,7 @@ describe('File Handling and Processing', () => {
]);

cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand All @@ -449,6 +565,7 @@ describe('File Handling and Processing', () => {
.find('.flaticon-delete-1')
.click({ force: true });
cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand All @@ -461,6 +578,7 @@ describe('File Handling and Processing', () => {

cy.loadFiles([{ name: compatibleNodeFile, datatype: 'node', field1: '_id', field2: 'seq' }]);
cy.get('#launch').should('contain.text', 'Update').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand All @@ -482,6 +600,7 @@ describe('File Handling and Processing', () => {
]);

cy.get('#launch').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand All @@ -504,6 +623,7 @@ describe('File Handling and Processing', () => {
cy.get('#launch-reset-settings', { timeout: 20000 })
.should('exist')
.click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 30000 })
.its('commonService.session.network.isFullyLoaded')
.should('be.true');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
applyPreLaunchFileSettings,
assertBubbleReady,
assertSessionAfterLaunchCounts,
continuePastMissingNodeCoverageWarning,
ensurePreLaunchProfileSynced,
visitAppAndAcceptEula,
} from '../../../support/journey-helpers';
Expand All @@ -31,6 +32,7 @@ const launchProfileDirectToBubble = (profile: DatasetProfile): void => {
applyPreLaunchFileSettings(profile);
ensurePreLaunchProfileSynced(profile);
cy.get('#launch', { timeout: 15000 }).should('not.be.disabled').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.window({ timeout: 120000 })
.its('commonService.session.network.isFullyLoaded')
.should('equal', true);
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/journeys/flows/map-direct-launch-uploaded.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
assertMapReady,
assertMapRenderedCounts,
assertSessionAfterLaunchCounts,
continuePastMissingNodeCoverageWarning,
ensurePreLaunchProfileSynced,
openMapSettingsDialog,
selectMapField,
Expand All @@ -33,6 +34,7 @@ const launchProfileDirectToMap = (profile: DatasetProfile): void => {
useOfflineMapLayers({ surviveLaunchReset: true });

cy.get('#launch', { timeout: 15000 }).should('not.be.disabled').click({ force: true });
continuePastMissingNodeCoverageWarning();
cy.get('#loading-information', { timeout: 120000 }).should('not.exist');
cy.window({ timeout: 120000 })
.its('commonService.session.network.isFullyLoaded')
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/journeys/flows/twod-mixed-origin-coloring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getProfile } from '../datasets/profile';
import {
applyPreLaunchFileSettings,
assertAfterLaunchCounts,
continuePastMissingNodeCoverageWarning,
ensurePreLaunchProfileSynced,
ensureTwoDNetworkView,
launchAndWaitForProcessing,
Expand Down Expand Up @@ -229,6 +230,7 @@ describe('Journey Flow - 2D mixed-origin link coloring', () => {
} else {
cy.get('[data-testid="files-update-button"]', { timeout: 20000 }).should('not.be.disabled').click({ force: true });
}
continuePastMissingNodeCoverageWarning();
waitForProcessingDialogToClear();
ensureTwoDNetworkView();
};
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/view-state/dashboard-layout-core.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ describe('Dashboard View State - Golden Layout mechanics', () => {
});
});

cy.window().then((win) => {
win.commonService.visuals.bubble.goldenLayoutComponentResize();
});
closeDashboardTab('Bubble');
cy.wait(250);
assertOpenDashboardTabs(['2D Network', 'Map', 'Table']);

focusDashboardTab('2D Network');
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/view-state/heatmap-view.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const assertHeatmapColorbarFormat = (expectedPercentageFormat: boolean): void =>

describe('Heatmap View', () => {
beforeEach(() => {
visitAppAndAcceptEula({ skipDemoSession: false });
visitAppAndAcceptEula({ skipDemoSession: false, dismissWelcomeOverlay: true });
cy.window({ timeout: 60000 })
.its('commonService.session.network.isFullyLoaded')
.should('equal', true);
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/view-state/map-view.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ describe('Map View', () => {
}, end))
container.dispatchEvent(mm1);

const me1 = new MouseEvent('mouseend', Object.assign({
const me1 = new MouseEvent('mouseup', Object.assign({
bubbles: true, cancelable: true, composed: true,
pointerId: 1, pointerType: 'mouse', isPrimary: true, button: 0
}, end))
Expand All @@ -628,13 +628,13 @@ describe('Map View', () => {
cy.get('#centerMapButton').click({ force: true });
cy.wait(500);

cy.window().then((win: any) => {
cy.window().should((win: any) => {
const lmap = win.commonService.visuals.gisMap.lmap;
const c = lmap.getCenter();
newCenter = { lat: c.lat, lng: c.lng };
const latDiff = Math.abs(newCenter.lat - initialCenter.lat);
const lngDiff = Math.abs(newCenter.lng - initialCenter.lng);
expect(latDiff < 0.05 && lngDiff < 0.05).to.equal(true);
const zoom = lmap.getZoom();
const pixelDiff = lmap.project(newCenter, zoom).distanceTo(lmap.project(initialCenter, zoom));
expect(pixelDiff, 'center difference in rendered map pixels').to.be.at.most(1.5);
})
});

Expand Down
Loading
Loading