@@ -11,11 +11,14 @@ suite('vuex tab', () => {
11
11
} )
12
12
cy . get ( '.vuex-tab' ) . click ( )
13
13
cy . get ( '.history .entry' ) . should ( 'have.length' , 4 )
14
+ cy . get ( '[data-id="load-vuex-state"]' ) . click ( )
15
+ cy . get ( '.recording-vuex-state' ) . should ( 'not.be.visible' )
16
+ cy . get ( '.loading-vuex-state' ) . should ( 'not.be.visible' )
14
17
cy . get ( '.vuex-state-inspector' ) . then ( el => {
15
18
expect ( el . text ( ) ) . to . include ( 'type:"DECREMENT"' )
16
19
expect ( el . text ( ) ) . to . include ( 'count:1' )
17
20
} )
18
- cy . get ( '.history .entry:nth-child(4)' ) . should ( 'have.class' , 'inspected' ) . should ( 'have.class' , 'active' )
21
+ cy . get ( '.history .entry' ) . eq ( 3 ) . should ( 'have.class' , 'inspected' ) . should ( 'have.class' , 'active' )
19
22
} )
20
23
21
24
it ( 'should filter state & getters' , ( ) => {
@@ -28,28 +31,30 @@ suite('vuex tab', () => {
28
31
29
32
it ( 'should filter history' , ( ) => {
30
33
cy . get ( '.left .search input' ) . clear ( ) . type ( 'inc' )
31
- cy . get ( '.history .entry' ) . should ( 'have.length' , 3 )
32
- cy . get ( '.history .entry.inspected' ) . should ( 'have.length' , 1 )
33
- cy . get ( '.history .entry.active' ) . should ( 'have.length' , 0 )
34
+ cy . get ( '.history .entry[data-active="true"] ' ) . should ( 'have.length' , 2 )
35
+ cy . get ( '.history .entry[data-active="true"] .inspected' ) . should ( 'have.length' , 0 )
36
+ cy . get ( '.history .entry[data-active="true"] .active' ) . should ( 'have.length' , 0 )
34
37
35
38
cy . get ( '.left .search input' ) . clear ( ) . type ( '/dec/i' )
36
- cy . get ( '.history .entry' ) . should ( 'have.length' , 2 )
37
- cy . get ( '.history .entry.inspected' ) . should ( 'have.length' , 1 )
38
- cy . get ( '.history .entry.active' ) . should ( 'have.length' , 0 )
39
+ cy . get ( '.history .entry[data-active="true"] ' ) . should ( 'have.length' , 1 )
40
+ cy . get ( '.history .entry[data-active="true"] .inspected' ) . should ( 'have.length' , 0 )
41
+ cy . get ( '.history .entry[data-active="true"] .active' ) . should ( 'have.length' , 0 )
39
42
40
43
cy . get ( '.left .search input' ) . clear ( ) . type ( '/dec)/i' )
41
- cy . get ( '.history .entry' ) . should ( 'have.length' , 4 )
42
- cy . get ( '.history .entry.inspected' ) . should ( 'have.length' , 1 )
43
- cy . get ( '.history .entry.active' ) . should ( 'have.length' , 1 )
44
+ cy . get ( '.history .entry[data-active="true"] ' ) . should ( 'have.length' , 3 )
45
+ cy . get ( '.history .entry[data-active="true"] .inspected' ) . should ( 'have.length' , 0 )
46
+ cy . get ( '.history .entry[data-active="true"] .active' ) . should ( 'have.length' , 1 )
44
47
45
48
cy . get ( '.left .search input' ) . clear ( )
46
49
} )
47
50
48
51
it ( 'should inspect state' , ( ) => {
49
- cy . get ( '.history .entry:nth-child(3) .mutation-type' ) . click ( )
50
- cy . get ( '.history .entry:nth-child(3)' )
52
+ cy . get ( '.history .entry .mutation-type' ) . eq ( 2 ) . click ( )
53
+ cy . get ( '.history .entry' ) . eq ( 2 )
51
54
. should ( 'have.class' , 'inspected' )
52
55
. should ( 'not.have.class' , 'active' )
56
+ cy . get ( '.recording-vuex-state' ) . should ( 'not.be.visible' )
57
+ cy . get ( '.loading-vuex-state' ) . should ( 'not.be.visible' )
53
58
cy . get ( '.vuex-state-inspector' ) . then ( el => {
54
59
expect ( el . text ( ) ) . to . include ( 'type:"INCREMENT"' )
55
60
expect ( el . text ( ) ) . to . include ( 'count:2' )
@@ -60,42 +65,44 @@ suite('vuex tab', () => {
60
65
} )
61
66
62
67
it ( 'should time-travel' , ( ) => {
63
- cy . get ( '.history .entry:nth-child(3) .entry-actions .action:nth-child(3)' ) . click ( { force : true } )
64
- cy . get ( '.history .entry:nth-child(3) ' )
68
+ cy . get ( '.history .entry[data-index="2"] .entry-actions .action:nth-child(3)' ) . click ( { force : true } )
69
+ cy . get ( '.history .entry[data-index="2"] ' )
65
70
. should ( 'have.class' , 'inspected' )
66
71
. should ( 'have.class' , 'active' )
67
72
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
68
73
get ( '#counter p' ) . contains ( '2' )
69
74
} )
70
75
71
- cy . get ( '.history .entry:nth-child(2) .mutation-type' ) . click ( { force : true } )
72
- cy . get ( '.history .entry:nth-child(2) ' )
76
+ cy . get ( '.history .entry[data-index="1"] .mutation-type' ) . click ( { force : true } )
77
+ cy . get ( '.history .entry[data-index="1"] ' )
73
78
. should ( 'have.class' , 'inspected' )
74
79
. should ( 'not.have.class' , 'active' )
75
- cy . get ( '.history .entry:nth-child(3) ' )
80
+ cy . get ( '.history .entry[data-index="2"] ' )
76
81
. should ( 'not.have.class' , 'inspected' )
77
82
. should ( 'have.class' , 'active' )
83
+ cy . get ( '.recording-vuex-state' ) . should ( 'not.be.visible' )
84
+ cy . get ( '.loading-vuex-state' ) . should ( 'not.be.visible' )
78
85
cy . get ( '.vuex-state-inspector' ) . then ( el => {
79
86
expect ( el . text ( ) ) . to . include ( 'type:"INCREMENT"' )
80
87
expect ( el . text ( ) ) . to . include ( 'count:1' )
81
88
} )
82
89
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
83
90
get ( '#counter p' ) . contains ( '2' )
84
91
} )
85
- cy . get ( '.history .entry:nth-child(2) .entry-actions .action:nth-child(3)' ) . click ( { force : true } )
86
- cy . get ( '.history .entry:nth-child(2) ' )
92
+ cy . get ( '.history .entry[data-index="1"] .entry-actions .action:nth-child(3)' ) . click ( { force : true } )
93
+ cy . get ( '.history .entry[data-index="1"] ' )
87
94
. should ( 'have.class' , 'inspected' )
88
95
. should ( 'have.class' , 'active' )
89
- cy . get ( '.history .entry:nth-child(3) ' )
96
+ cy . get ( '.history .entry[data-index="2"] ' )
90
97
. should ( 'not.have.class' , 'inspected' )
91
98
. should ( 'not.have.class' , 'active' )
92
99
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
93
100
get ( '#counter p' ) . contains ( '1' )
94
101
} )
95
102
96
103
// Base state
97
- cy . get ( '.history .entry:nth-child(1) .mutation-type' ) . click ( { force : true } )
98
- cy . get ( '.history .entry:nth-child(1) ' )
104
+ cy . get ( '.history .entry[data-index="0"] .mutation-type' ) . click ( { force : true } )
105
+ cy . get ( '.history .entry[data-index="0"] ' )
99
106
. should ( 'have.class' , 'inspected' )
100
107
. should ( 'not.have.class' , 'active' )
101
108
cy . get ( '.vuex-state-inspector' ) . then ( el => {
@@ -104,8 +111,8 @@ suite('vuex tab', () => {
104
111
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
105
112
get ( '#counter p' ) . contains ( '1' )
106
113
} )
107
- cy . get ( '.history .entry:nth-child(1) .entry-actions .action:nth-child(1)' ) . click ( { force : true } )
108
- cy . get ( '.history .entry:nth-child(1) ' )
114
+ cy . get ( '.history .entry[data-index="0"] .entry-actions .action:nth-child(1)' ) . click ( { force : true } )
115
+ cy . get ( '.history .entry[data-index="0"] ' )
109
116
. should ( 'have.class' , 'inspected' )
110
117
. should ( 'have.class' , 'active' )
111
118
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
@@ -114,10 +121,10 @@ suite('vuex tab', () => {
114
121
} )
115
122
116
123
it ( 'should revert' , ( ) => {
117
- cy . get ( '.history .entry:nth-child(4) .mutation-type' ) . click ( { force : true } )
118
- cy . get ( '.history .entry:nth-child(4) .action:nth-child(2)' ) . click ( { force : true } )
119
- cy . get ( '.history .entry' ) . should ( 'have.length' , 3 )
120
- cy . get ( '.history .entry:nth-child(3) ' )
124
+ cy . get ( '.history .entry[data-index="3"] .mutation-type' ) . click ( { force : true } )
125
+ cy . get ( '.history .entry[data-index="3"]' ) . find ( ' .action:nth-child(2)') . click ( { force : true } )
126
+ cy . get ( '.history .entry[data-active="true"] ' ) . should ( 'have.length' , 3 )
127
+ cy . get ( '.history .entry[data-index="2"] ' )
121
128
. should ( 'have.class' , 'inspected' )
122
129
. should ( 'have.class' , 'active' )
123
130
cy . get ( '.vuex-state-inspector' ) . then ( el => {
@@ -129,10 +136,10 @@ suite('vuex tab', () => {
129
136
} )
130
137
131
138
it ( 'should commit' , ( ) => {
132
- cy . get ( '.history .entry:nth-child(3) .mutation-type' ) . click ( { force : true } )
133
- cy . get ( '.history .entry:nth-child(3) .action:nth-child(1)' ) . click ( { force : true } )
134
- cy . get ( '.history .entry' ) . should ( 'have.length' , 1 )
135
- cy . get ( '.history .entry:nth-child(1) ' )
139
+ cy . get ( '.history .entry[data-index="2"] .mutation-type' ) . click ( { force : true } )
140
+ cy . get ( '.history .entry[data-index="2"] .action:nth-child(1)' ) . click ( { force : true } )
141
+ cy . get ( '.history .entry[data-active="true"] ' ) . should ( 'have.length' , 1 )
142
+ cy . get ( '.history .entry[data-index="0"] ' )
136
143
. should ( 'have.class' , 'inspected' )
137
144
. should ( 'have.class' , 'active' )
138
145
cy . get ( '.vuex-state-inspector' ) . then ( el => {
@@ -153,7 +160,9 @@ suite('vuex tab', () => {
153
160
. click ( { force : true } )
154
161
. click ( { force : true } )
155
162
} )
156
- cy . get ( '.history .entry:nth-child(4)' ) . click ( { force : true } )
163
+ cy . get ( '.history .entry[data-index="3"]' ) . click ( { force : true } )
164
+ cy . get ( '.recording-vuex-state' ) . should ( 'not.be.visible' )
165
+ cy . get ( '.loading-vuex-state' ) . should ( 'not.be.visible' )
157
166
cy . get ( '.vuex-state-inspector' ) . then ( el => {
158
167
expect ( el . text ( ) ) . to . include ( 'isPositive:false' )
159
168
} )
0 commit comments