Skip to content

Commit dd67b4d

Browse files
author
Guillaume Chau
committed
test(e2e): fix
1 parent 0fb2dac commit dd67b4d

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

cypress/integration/vuex-tab.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ suite('vuex tab', () => {
1010
get('#counter p').contains('1')
1111
})
1212
cy.get('.vuex-tab').click()
13-
cy.get('.history .entry').should('have.length', 5)
13+
cy.get('.history .entry').should('have.length', 6)
1414
cy.get('[data-id="load-vuex-state"]').click()
1515
cy.get('.recording-vuex-state').should('not.be.visible')
1616
cy.get('.loading-vuex-state').should('not.be.visible')
1717
cy.get('.vuex-state-inspector').then(el => {
1818
expect(el.text()).to.include('type:"DECREMENT"')
1919
expect(el.text()).to.include('count:1')
2020
})
21-
cy.get('.history .entry').eq(4).should('have.class', 'inspected').should('have.class', 'active')
21+
cy.get('.history .entry').eq(5).should('have.class', 'inspected').should('have.class', 'active')
2222
})
2323

2424
it('should filter state & getters', () => {
@@ -41,7 +41,7 @@ suite('vuex tab', () => {
4141
cy.get('.history .entry[data-active="true"].active').should('have.length', 0)
4242

4343
cy.get('.left .search input').clear().type('/dec)/i')
44-
cy.get('.history .entry[data-active="true"]').should('have.length', 4)
44+
cy.get('.history .entry[data-active="true"]').should('have.length', 5)
4545
cy.get('.history .entry[data-active="true"].inspected').should('have.length', 0)
4646
cy.get('.history .entry[data-active="true"].active').should('have.length', 1)
4747

@@ -70,19 +70,19 @@ suite('vuex tab', () => {
7070
})
7171

7272
it('should time-travel', () => {
73-
cy.get('.history .entry[data-index="3"] .entry-actions .action-time-travel').click({ force: true })
74-
cy.get('.history .entry[data-index="3"]')
73+
cy.get('.history .entry[data-index="4"] .entry-actions .action-time-travel').click({ force: true })
74+
cy.get('.history .entry[data-index="4"]')
7575
.should('have.class', 'inspected')
7676
.should('have.class', 'active')
7777
cy.get('#target').iframe().then(({ get }) => {
7878
get('#counter p').contains('2')
7979
})
8080

81-
cy.get('.history .entry[data-index="2"] .mutation-type').click({ force: true })
82-
cy.get('.history .entry[data-index="2"]')
81+
cy.get('.history .entry[data-index="3"] .mutation-type').click({ force: true })
82+
cy.get('.history .entry[data-index="3"]')
8383
.should('have.class', 'inspected')
8484
.should('not.have.class', 'active')
85-
cy.get('.history .entry[data-index="3"]')
85+
cy.get('.history .entry[data-index="4"]')
8686
.should('not.have.class', 'inspected')
8787
.should('have.class', 'active')
8888
cy.get('.recording-vuex-state').should('not.be.visible')
@@ -95,11 +95,11 @@ suite('vuex tab', () => {
9595
cy.get('#target').iframe().then(({ get }) => {
9696
get('#counter p').contains('2')
9797
})
98-
cy.get('.history .entry[data-index="2"] .entry-actions .action-time-travel').click({ force: true })
99-
cy.get('.history .entry[data-index="2"]')
98+
cy.get('.history .entry[data-index="3"] .entry-actions .action-time-travel').click({ force: true })
99+
cy.get('.history .entry[data-index="3"]')
100100
.should('have.class', 'inspected')
101101
.should('have.class', 'active')
102-
cy.get('.history .entry[data-index="3"]')
102+
cy.get('.history .entry[data-index="4"]')
103103
.should('not.have.class', 'inspected')
104104
.should('not.have.class', 'active')
105105
cy.get('#target').iframe().then(({ get }) => {
@@ -117,8 +117,8 @@ suite('vuex tab', () => {
117117
cy.get('#target').iframe().then(({ get }) => {
118118
get('#counter p').contains('1')
119119
})
120-
cy.get('.history .entry[data-index="1"] .entry-actions .action-time-travel').click({ force: true })
121-
cy.get('.history .entry[data-index="1"]')
120+
cy.get('.history .entry[data-index="2"] .entry-actions .action-time-travel').click({ force: true })
121+
cy.get('.history .entry[data-index="2"]')
122122
.should('have.class', 'inspected')
123123
.should('have.class', 'active')
124124
cy.get('#target').iframe().then(({ get }) => {
@@ -127,10 +127,10 @@ suite('vuex tab', () => {
127127
})
128128

129129
it('should revert', () => {
130-
cy.get('.history .entry[data-index="4"] .mutation-type').click({ force: true })
131-
cy.get('.history .entry[data-index="4"]').find('.action-revert').click({ force: true })
132-
cy.get('.history .entry[data-active="true"]').should('have.length', 4)
133-
cy.get('.history .entry[data-index="3"]')
130+
cy.get('.history .entry[data-index="5"] .mutation-type').click({ force: true })
131+
cy.get('.history .entry[data-index="5"]').find('.action-revert').click({ force: true })
132+
cy.get('.history .entry[data-active="true"]').should('have.length', 5)
133+
cy.get('.history .entry[data-index="4"]')
134134
.should('have.class', 'inspected')
135135
.should('have.class', 'active')
136136
cy.get('.vuex-state-inspector').then(el => {
@@ -142,7 +142,7 @@ suite('vuex tab', () => {
142142
})
143143

144144
it('should commit', () => {
145-
cy.get('.history .entry[data-index="3"] .action-commit').click({ force: true })
145+
cy.get('.history .entry[data-index="4"] .action-commit').click({ force: true })
146146
cy.get('.history .entry[data-active="true"]').should('have.length', 1)
147147
cy.get('.history .entry[data-index="0"]')
148148
.should('have.class', 'inspected')
@@ -185,7 +185,7 @@ suite('vuex tab', () => {
185185
cy.get('#target').iframe().then(({ get }) => {
186186
get('.increment').click({ force: true })
187187
})
188-
cy.get('.history .entry').should('have.length', 5)
188+
cy.get('.history .entry[data-active="true"]').should('have.length', 4)
189189
})
190190

191191
it('should copy vuex state', () => {
@@ -200,9 +200,10 @@ suite('vuex tab', () => {
200200
cy.get('.import-state').should('be.visible')
201201
cy.get('.import-state textarea').clear().type('{{}invalid: json}')
202202
cy.get('.message.invalid-json').should('be.visible')
203-
cy.get('.import-state textarea').clear().type('{{}"count":42,"date":"[native Date Fri Dec 22 2017 10:12:04 GMT+0100 (CET)]","nested":{{}"foo":"meow"}}')
203+
cy.get('.import-state textarea').clear().type('{{}"count":42,"date":"[native Date Fri Dec 22 2017 10:12:04 GMT+0100 (CET)]","nested":{{}"foo":"meow"},"instant":{{}"hey":"hi"}}')
204204
cy.wait(500)
205205
cy.get('.message.invalid-json').should('not.be.visible')
206+
cy.wait(500)
206207
cy.get('.vuex-state-inspector').then(el => {
207208
expect(el.text()).to.include('count:42')
208209
expect(el.text()).to.include('date:' + new Date('Fri Dec 22 2017 10:12:04 GMT+0100 (CET)'))

shells/dev/target/NativeTypes.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ export default {
155155
},
156156
157157
setDisplay () {
158-
return Array.from(this.set)
158+
if (this.set) return Array.from(this.set)
159159
},
160160
161161
mapDisplay () {
162-
return [...this.map]
162+
if (this.map) return [...this.map]
163163
},
164164
165165
forceRefresh () {

0 commit comments

Comments
 (0)