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
it("Should select a single node", () => { | |
const johnSnowId = "Customer::id::C1"; | |
return cy | |
.wait("@queryGraph") | |
.waitUntilGraphSimulationEnd() | |
.selectionHasNode(johnSnowId) | |
.then((isNodeSelected) => expect(isNodeSelected).to.be.false) | |
.getGraphNodeInformationById(johnSnowId) | |
.then((johnSnow) => cy.clickOnGraphNode(johnSnow)) |
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
// Gets the node informations such as x and y position given a nodeId | |
Cypress.Commands.add("getGraphNodeInformationById", (nodeId) => { | |
return cy.window().then((window) => { | |
return window.__FDZ_GENOME_GRAPH_API__.getGraphNodes().get(nodeId); | |
}); | |
}); | |
// Waits for the simulation to end | |
Cypress.Commands.add("waitUntilGraphSimulationEnd", () => { | |
return cy.window().then((window) => { |
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
waitUntilGraphSimulationEnd: () => { | |
return new Promise((resolve) => { | |
// We are checking if when the hasSimulationEnded flag is set to true | |
const delay = window.setInterval(() => { | |
if (this.componentRef.state.hasSimulationEnded) { | |
resolve(); | |
window.clearInterval(delay); | |
} | |
}, 500); | |
}); |
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
class GenomGraph extends PureComponent {...} | |
const GraphComponent = TESTING ? exposeGraphAPI(GenomeGraph) : GenomeGraph; | |
export default GraphComponent; |
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
export default function exposeGraphAPI(GraphComponent) { | |
class ExposeGraphApi extends PureComponent { | |
componentDidMount() { | |
window.__FDZ_GENOME_GRAPH_API__ = { | |
getGraphNodes: () => {...}, | |
waitUntilGraphSimulationEnd: () => {...}, | |
.... | |
} | |
} | |
render() { |
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
[ | |
{ | |
"level": 1, | |
"code": 1, | |
"name": "Aveiro" | |
}, | |
{ | |
"level": 2, | |
"code": 101, | |
"name": "Águeda" |