Skip to content

Commit 90a0dc4

Browse files
committed
chore: use an alter port for e2e test
1 parent cc27dcd commit 90a0dc4

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

cypress.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from 'cypress'
22

33
export default defineConfig({
44
e2e: {
5-
baseUrl: 'http://localhost:3030',
5+
baseUrl: 'http://localhost:3041',
66
chromeWebSecurity: false,
77
specPattern: 'cypress/e2e/**/*.spec.*',
88
supportFile: false,

cypress/downloads/downloads.html

-1.4 MB
Binary file not shown.

cypress/e2e/examples/basic.spec.ts

+26-24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Cypress.Commands.add('rightArrow', (n = 1) => {
1212
cy.get('body').wait(500).type('{rightarrow}'.repeat(n)).wait(500)
1313
})
1414

15+
const BASE = 'http://localhost:3041'
16+
1517
context('Basic', () => {
1618
beforeEach(() => {
1719
cy.visit('/')
@@ -26,13 +28,13 @@ context('Basic', () => {
2628
.type(`${no}`, { force: true })
2729
.type('{enter}', { force: true })
2830
.url()
29-
.should('eq', `http://localhost:3030/${no}`)
31+
.should('eq', `${BASE}/${no}`)
3032
.wait(500)
3133
}
3234

3335
it('basic nav', () => {
3436
cy.url()
35-
.should('eq', 'http://localhost:3030/1')
37+
.should('eq', `${BASE}/1`)
3638

3739
cy.contains('Global Footer')
3840
.should('exist')
@@ -41,7 +43,7 @@ context('Basic', () => {
4143

4244
cy.rightArrow()
4345
.url()
44-
.should('eq', 'http://localhost:3030/2')
46+
.should('eq', `${BASE}/2`)
4547

4648
cy.contains('Global Footer')
4749
.should('not.exist')
@@ -63,32 +65,32 @@ context('Basic', () => {
6365

6466
cy.get('body')
6567
.type('{DownArrow}')
66-
.url().should('eq', 'http://localhost:3030/6')
68+
.url().should('eq', `${BASE}/6`)
6769

6870
cy.rightArrow()
6971

7072
cy
7173
.url()
72-
.should('eq', 'http://localhost:3030/6?clicks=1')
74+
.should('eq', `${BASE}/6?clicks=1`)
7375

7476
cy.get('body')
7577
.type('{RightArrow}{RightArrow}{RightArrow}{RightArrow}{RightArrow}{RightArrow}')
76-
.url().should('eq', 'http://localhost:3030/7')
78+
.url().should('eq', `${BASE}/7`)
7779

7880
cy.get('body')
7981
.type('{LeftArrow}')
8082
.url()
81-
.should('eq', 'http://localhost:3030/6?clicks=6')
83+
.should('eq', `${BASE}/6?clicks=6`)
8284

8385
cy.get('body')
8486
.type('{DownArrow}')
8587
.url()
86-
.should('eq', 'http://localhost:3030/7')
88+
.should('eq', `${BASE}/7`)
8789

8890
cy.get('body')
8991
.type('{UpArrow}')
9092
.url()
91-
.should('eq', 'http://localhost:3030/6')
93+
.should('eq', `${BASE}/6`)
9294
})
9395

9496
it('named slots', () => {
@@ -103,13 +105,13 @@ context('Basic', () => {
103105

104106
cy
105107
.url()
106-
.should('eq', 'http://localhost:3030/9')
108+
.should('eq', `${BASE}/9`)
107109

108110
cy.rightArrow()
109111

110112
cy
111113
.url()
112-
.should('eq', 'http://localhost:3030/9?clicks=1')
114+
.should('eq', `${BASE}/9?clicks=1`)
113115

114116
cy.get('#slideshow .slidev-page-9 .cy-content .slidev-vclick-target:not(.slidev-vclick-hidden)')
115117
.should('have.text', 'CD')
@@ -127,19 +129,19 @@ context('Basic', () => {
127129

128130
cy
129131
.url()
130-
.should('eq', 'http://localhost:3030/9?clicks=4')
132+
.should('eq', `${BASE}/9?clicks=4`)
131133

132134
cy.rightArrow()
133135

134136
cy
135137
.url()
136-
.should('eq', 'http://localhost:3030/10')
138+
.should('eq', `${BASE}/10`)
137139

138140
cy.rightArrow()
139141

140142
cy
141143
.url()
142-
.should('eq', 'http://localhost:3030/10?clicks=1')
144+
.should('eq', `${BASE}/10?clicks=1`)
143145

144146
cy.get('#slideshow .slidev-page-10 .cy-content-hide .slidev-vclick-target:not(.slidev-vclick-hidden)')
145147
.should('have.text', 'BD')
@@ -158,13 +160,13 @@ context('Basic', () => {
158160

159161
cy
160162
.url()
161-
.should('eq', 'http://localhost:3030/10?clicks=4')
163+
.should('eq', `${BASE}/10?clicks=4`)
162164

163165
cy.rightArrow()
164166

165167
cy
166168
.url()
167-
.should('eq', 'http://localhost:3030/11')
169+
.should('eq', `${BASE}/11`)
168170
})
169171

170172
it('overview nav', () => {
@@ -173,30 +175,30 @@ context('Basic', () => {
173175
cy.get('body')
174176
.type('o{RightArrow}{RightArrow}{Enter}')
175177
.url()
176-
.should('eq', 'http://localhost:3030/4')
178+
.should('eq', `${BASE}/4`)
177179

178180
cy.get('body')
179181
.type('o{LeftArrow}{LeftArrow}{LeftArrow}{Enter}')
180182
.url()
181-
.should('eq', 'http://localhost:3030/1')
183+
.should('eq', `${BASE}/1`)
182184

183185
cy.get('body')
184186
.type('o{DownArrow}{DownArrow}{DownArrow}{Enter}')
185187
.url()
186-
.should('not.eq', 'http://localhost:3030/1')
188+
.should('not.eq', `${BASE}/1`)
187189

188190
cy.get('body')
189191
.type('o{UpArrow}{UpArrow}{UpArrow}{Enter}')
190192
.url()
191-
.should('eq', 'http://localhost:3030/1')
193+
.should('eq', `${BASE}/1`)
192194
})
193195

194196
it('deep nested lists', () => {
195197
goPage(11)
196198

197199
cy
198200
.url()
199-
.should('eq', 'http://localhost:3030/11')
201+
.should('eq', `${BASE}/11`)
200202

201203
cy.get('body')
202204
.type('{RightArrow}{RightArrow}{RightArrow}')
@@ -228,16 +230,16 @@ context('Basic', () => {
228230

229231
cy
230232
.url()
231-
.should('eq', 'http://localhost:3030/12')
233+
.should('eq', `${BASE}/12`)
232234

233235
cy.get('body')
234236
.type('{RightArrow}{RightArrow}{RightArrow}{RightArrow}{RightArrow}{RightArrow}')
235237
.url()
236-
.should('eq', 'http://localhost:3030/12?clicks=6') // we should still be on page 12
238+
.should('eq', `${BASE}/12?clicks=6`) // we should still be on page 12
237239

238240
cy.rightArrow()
239241
.url()
240-
.should('eq', 'http://localhost:3030/13')
242+
.should('eq', `${BASE}/13`)
241243

242244
cy.get('#slideshow .slidev-page-13 .cy-wrapdecorate > ul > .slidev-vclick-target.slidev-vclick-hidden')
243245
.should('have.text', 'AEFZ')

cypress/fixtures/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"scripts": {
4-
"dev": "nodemon -w '../../../packages/slidev/dist/*.js' --exec 'slidev --log=info'",
4+
"dev": "nodemon -w '../../../packages/slidev/dist/*.js' --exec 'slidev --log=info --port=3041'",
55
"build": "slidev build",
66
"export": "slidev export"
77
},

packages/client/logic/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function useRouteQuery<T extends string | string[]>(
2222
router[unref(mode) as 'replace' | 'push']({
2323
query: {
2424
...router.currentRoute.value.query,
25-
[name]: v === defaultValue ? undefined : v,
25+
[name]: `${v}` === defaultValue ? undefined : v,
2626
},
2727
})
2828
})

0 commit comments

Comments
 (0)