Skip to content

Commit

Permalink
main pulled into end-to-end-tests
Browse files Browse the repository at this point in the history
- updated lock file
- removed unneeded untypedFn module (and parent folder) and contained waitForEvent fn
- added Array check on options.layers[layer].nodeThresholds.steps in MapPanel.resolveNodeThresholds to remove warning in Grafana
  • Loading branch information
sanchezelton committed Oct 14, 2024
1 parent d31c457 commit 74c5ba9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 23 deletions.
4 changes: 0 additions & 4 deletions e2e/js/untypedFn.js

This file was deleted.

17 changes: 11 additions & 6 deletions e2e/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { clearInterval } from 'timers';
import { IFlowSheet } from '../src/types';
import { IThreshold } from './interfaces/Threshold.interface';
import { reverseStr } from '../test/utils';
import { waitForEvent } from './js/untypedFn';

const PubSub = pubsub.PubSub;

Expand Down Expand Up @@ -56,8 +55,10 @@ const getCheckStrokeColorFn = (page: Page) => {
let edgeCount = edgeNames.length;
for (const testEdge of edgeNames) {
console.log(`Test Edge: ${testEdge}`);
const edgeLocator: Locator = await page.locator(`.edge > path[text="${testEdge}"]`);
await expect(edgeLocator).toHaveCSS('stroke', colorNameMatcher ?? BasicColorMatcher.GREY);
const edgeLocator: Locator = await page.locator(`.topology > path[class*="edge-az-${testEdge}"]`);
if ((await edgeLocator.all()).length > 0) {
await expect(edgeLocator).toHaveCSS('stroke', colorNameMatcher ?? BasicColorMatcher.GREY);
}
}

// control paths in orange (always orange, but may not visible depending on enable/disable edge edit mode)
Expand Down Expand Up @@ -334,10 +335,12 @@ pluginTest.describe("plugin testing", () => {
await expect(layer1DefaultColorDropdownSelected).toMatch(BasicColorMatcher.GREY);

const topologyNodes = ['A', 'B', 'C'];
// generate all directional edges from topologyNodes
const testEdges = topologyNodes.reduce((acc: string[], outNode: string) => {
for (const inNode of topologyNodes) {
if (inNode !== outNode) {
acc.push(`${inNode}--${outNode}`);
acc.push(`${outNode}--${inNode}`);
}
}
return acc;
Expand All @@ -350,10 +353,11 @@ pluginTest.describe("plugin testing", () => {
// step 1: trigger elements to fetch config remote url containing 'normal' topology

// enable fetching
const fetchConfigSlideButton = await page.locator('[id="Network Map Panel"] > div > div:nth-child(2) > div label').first();
const fetchConfigSlideButton = await page.locator('[id="Network Map Panel"] > div > div:nth-child(2) [class*="select-value-container"]').first();
console.log(`step1: ${(await fetchConfigSlideButton.all()).length}`);
await fetchConfigSlideButton.click();
// provide URL
const fetchConfigUrlField = await page.locator('[id="Network Map Panel"]').getByRole('textbox').first();
const fetchConfigUrlField = await page.locator('[id="Network Map Panel"]').getByRole('combobox').first();
await fetchConfigUrlField.fill(topologyUrl);
// trigger the load
let hasCompletedMapRender = false;
Expand All @@ -377,7 +381,8 @@ pluginTest.describe("plugin testing", () => {
}, this);
makeRenderPromise();
// trigger render
await page.locator('[id="Network Map Panel"]').first().click();
// await page.locator('[id="Network Map Panel"]').click();
await fetchConfigUrlField.blur();

// check stroke colors with remotely loaded topology (should populate selected color control)
// TODO: @esanchez confer w/ @jkadafer WRT to use case where a choice color is made but a remote URL removes the color control
Expand Down
14 changes: 8 additions & 6 deletions src/MapPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,14 @@ class MapPanel extends Component<MapPanelProps> {
for(let layer=0; layer<LAYER_LIMIT; layer++){
if(!options.layers[layer]){ continue; }
let layerThresholds: any[] = [];
options.layers[layer]?.nodeThresholds?.steps.forEach((step)=>{
layerThresholds.push({
color: this.theme.visualization.getColorByName(step.color),
value: step.value || 0,
})
})
if (Array.isArray(options.layers[layer]?.nodeThresholds?.steps)) {
options.layers[layer]?.nodeThresholds?.steps.forEach((step)=>{
layerThresholds.push({
color: this.theme.visualization.getColorByName(step.color),
value: step.value || 0,
});
});
}
thresholds.push(layerThresholds);
}
// snapshot the current options. If they're not the same as the last options, update them.
Expand Down
39 changes: 32 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10363,7 +10363,16 @@ string-template@~0.2.1:
resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add"
integrity sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -10452,7 +10461,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -10990,10 +11006,10 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

underscore@1.13.7:
version "1.13.7"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10"
integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==
underscore@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209"
integrity sha512-cp0oQQyZhUM1kpJDLdGO1jPZHgS/MpzoWYfe9+CM2h/QGDZlqwT2T3YGukuBdaNJ/CAPoeyAZRRHz8JFo176vA==

undici-types@~6.19.2:
version "6.19.8"
Expand Down Expand Up @@ -11394,7 +11410,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -11412,6 +11428,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 74c5ba9

Please sign in to comment.