Skip to content

Commit 104b9e2

Browse files
committed
VueUiSkeleton add e2e component test
1 parent 42e2d26 commit 104b9e2

File tree

3 files changed

+259
-17
lines changed

3 files changed

+259
-17
lines changed

cypress/fixtures/skeleton.json

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"config": {
3+
"type": "line",
4+
"style": {
5+
"backgroundColor": "#FFFFFF",
6+
"color": "#2D353C",
7+
"maxHeight": 500,
8+
"animated": true,
9+
"chestnut": {
10+
"color": "#6376DD"
11+
},
12+
"sparkline": {
13+
"color": "#6376DD",
14+
"strokeWidth": 0.7
15+
},
16+
"line": {
17+
"axis": {
18+
"show": true,
19+
"color": "#6376DD",
20+
"strokeWidth": 0.5
21+
},
22+
"path": {
23+
"color": "#6376DD",
24+
"strokeWidth": 1,
25+
"showPlots": true
26+
}
27+
},
28+
"bar": {
29+
"axis": {
30+
"show": true,
31+
"color": "#6376DD",
32+
"strokeWidth": 0.5
33+
},
34+
"borderRadius": 0.5,
35+
"color": "#6376DD",
36+
"barWidth": 9
37+
},
38+
"donut": {
39+
"color": "#6376DD",
40+
"strokeWidth": 64
41+
},
42+
"onion": {
43+
"color": "#6376DD"
44+
},
45+
"gauge": {
46+
"color": "#6376DD"
47+
},
48+
"quadrant": {
49+
"grid": {
50+
"color": "#6376DD",
51+
"strokeWidth": 0.5
52+
},
53+
"plots": {
54+
"radius": 1.5,
55+
"color": "#6376DD"
56+
}
57+
},
58+
"radar": {
59+
"grid": {
60+
"color": "#6376DD",
61+
"strokeWidth": 0.5
62+
},
63+
"shapes": {
64+
"color": "#6376DD"
65+
}
66+
},
67+
"waffle": {
68+
"color": "#6376DD"
69+
},
70+
"table": {
71+
"th": {
72+
"color": "#6376DD"
73+
},
74+
"td": {
75+
"color": "#6376DD",
76+
"strokeWidth": 0.5
77+
}
78+
},
79+
"rating": {
80+
"useSmiley": false,
81+
"color": "#6376DD",
82+
"filled": true,
83+
"strokeWidth": 1,
84+
"maxWidth": 200
85+
},
86+
"verticalBar": {
87+
"axis": {
88+
"show": true,
89+
"color": "#6376DD",
90+
"strokeWidth": 0.5
91+
},
92+
"borderRadius": 0.5,
93+
"color": "#6376DD"
94+
},
95+
"heatmap": {
96+
"cellsX": 26,
97+
"cellsY": 7,
98+
"color": "#6376DD"
99+
},
100+
"candlesticks": {
101+
"axis": {
102+
"show": true,
103+
"color": "#6376DD",
104+
"strokeWidth": 0.5
105+
},
106+
"candle": {
107+
"color": "#6376DD",
108+
"strokeWidth": 1
109+
}
110+
},
111+
"pyramid": {
112+
"color": "#6376DD"
113+
}
114+
}
115+
}
116+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import VueUiSkeleton from './vue-ui-skeleton.vue'
2+
3+
describe('<VueUiSkeleton />', () => {
4+
5+
function updateConfigInFixture(modifiedConfig) {
6+
cy.get('@fixture').then((fixture) => {
7+
const updatedFixture = { ...fixture, config: modifiedConfig };
8+
cy.wrap(updatedFixture).as('fixture');
9+
});
10+
}
11+
12+
beforeEach(function () {
13+
cy.fixture('skeleton.json').as('fixture');
14+
cy.viewport(500, 360);
15+
});
16+
17+
it('renders', () => {
18+
cy.get('@fixture').then((fixture) => {
19+
cy.mount(VueUiSkeleton, {
20+
props: {
21+
dataset: fixture.dataset,
22+
config: fixture.config
23+
}
24+
});
25+
26+
[
27+
{
28+
type: 'pyramid',
29+
height: 400
30+
},
31+
{
32+
type: 'sparkline',
33+
height: 120
34+
},
35+
{
36+
type: 'candlesticks',
37+
height: 330
38+
},
39+
{
40+
type: 'heatmap',
41+
height: 150
42+
},
43+
{
44+
type: 'chestnut',
45+
height: 320
46+
},
47+
{
48+
type: 'line',
49+
height: 360
50+
},
51+
{
52+
type: 'bar',
53+
height: 360
54+
},
55+
{
56+
type: 'donut',
57+
height: 500
58+
},
59+
{
60+
type: 'onion',
61+
height: 500
62+
},
63+
{
64+
type: 'gauge',
65+
height: 500
66+
},
67+
{
68+
type: 'quadrant',
69+
height: 500
70+
},
71+
{
72+
type: 'radar',
73+
height: 500
74+
},
75+
{
76+
type: 'waffle',
77+
height: 500
78+
},
79+
{
80+
type: 'table',
81+
height: 360
82+
},
83+
{
84+
type: 'rating',
85+
height: 80
86+
},
87+
{
88+
type: 'verticalBar',
89+
height: 500
90+
},
91+
].forEach(t => {
92+
cy.wait(300);
93+
94+
let modifiedConfig = {
95+
...fixture.config,
96+
type: t.type
97+
}
98+
99+
updateConfigInFixture(modifiedConfig);
100+
101+
cy.mount(VueUiSkeleton, {
102+
props: {
103+
dataset: fixture.dataset,
104+
config: modifiedConfig
105+
}
106+
});
107+
108+
cy.viewport(500, t.height);
109+
110+
cy.get(`[data-cy="skeleton-${t.type}"]`)
111+
.should('exist');
112+
113+
});
114+
});
115+
})
116+
})

0 commit comments

Comments
 (0)