We use Angular for development, and spec files using protractor or end-to-end testing. So as an example, to check a node that has a singe port the subtest is:
it('Check one port block UI functionality', async () => {
const refSinglePort = 'd="M 0,0 L 159,0 L 159,47 L 0,47 z"';
const refCategoryImage = 'style="font: 20px dlt-icons" text-anchor="start" fill="rgb(242, 243, 244)" stroke="none"';
const blockColour = 'fill="rgb(0,82,150)"';
const blockNameFontColour = 'fill="rgb(242, 243, 244)"';
await modelEditorPage.getPalette().expandPaletteSectionHeader(PALETTEHEADER.FLOWMANIPULATION);
const element1 = await modelEditorPage.getPalette().getSectionItemElement(PALETTEITEM.PULSE);
await modelEditorPage.doDragAndDrop(element1);
// Check input/output ports font and it's colour
await closeBlockParamsDialog();
const svg = await browser.executeScript(goCanvasUtils, 'getBlockNameInnerHTML(\'Pulse\')');
console.log(svg);
expect(svg.toString().indexOf(refSinglePort)).toBeGreaterThan(0);
console.log(svg.toString().indexOf(refSinglePort));
expect(svg.toString().indexOf(refCategoryImage)).toBeGreaterThan(0);
expect(svg.toString().indexOf(blockColour)).toBeGreaterThan(0);
expect(svg.toString().indexOf(blockNameFontColour)).toBeGreaterThan(0);
});
We’re basically checking that the node is being drawn and coloured correctly.
The svg output we get in this example from the console.log(svg) statement is: <path d="M 0,0 L 159,0 L 159,47 L 0,47 z" fill="rgb(0,82,150)" fill-opacity="1" stroke="none" transform="matrix(1, 0, 0, 1, 0.5, 0.5)"></path><path d="M 0,0 L 159,0 L 159,47 L 0,47 z" fill="none" stroke="rgb(23, 118, 191)" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" transform="matrix(1, 0, 0, 1, 0.5, 0.5)"></path><g transform="matrix(1, 0, 0, 1, 37, 14)"><g transform="matrix(1, 0, 0, 1, 0, 0)" clip-path="url(#CLIP1120)"><text x="0" y="16.575000000000003" style="font: 20px dlt-icons" text-anchor="start" fill="rgb(242, 243, 244)" stroke="none" transform="matrix(1, 0, 0, 1, 0, 0)"></text></g><text x="0" y="11.700000000000001" style="font: normal normal 400 normal 14px / 20px Roboto, Helvetica, Arial, sans-serif" text-anchor="start" fill="rgb(242, 243, 244)" stroke="none" transform="matrix(1, 0, 0, 1, 28, 2.1999999999999993)">Pulse</text></g>