Passed
Push — master ( 139be6...b9ad79 )
by
unknown
09:22
created

test/functional/graph.helpers.ts   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 19
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
mnd 0
bc 0
fnc 3
dl 0
loc 19
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A graph.helpers.ts ➔ waitForGraphStabilization 0 3 1
A graph.helpers.ts ➔ getElementBBox 0 6 1
A graph.helpers.ts ➔ waitForAllTransitions 0 3 1
1
import { ElementHandle } from 'puppeteer';
2
import { TRANSITION_DURATION } from '../../src/utils/AppConsts';
3
4
export async function waitForGraphStabilization() {
5
    await page.waitFor(500);
6
}
7
8
export async function waitForAllTransitions() {
9
    await page.waitFor(TRANSITION_DURATION);
10
}
11
12
// Replacement of element.boundingBox() - we need to get node positions within SVG container, not relative to main frame
13
export async function getElementBBox(element: ElementHandle<SVGGraphicsElement>) {
14
    return await element.evaluate(el => {
15
        const { x, y, width, height } = el.getBBox();
16
        return { x, y, width, height };
17
    });
18
}
19