返回 slidev
base-path.spec.ts
根目录 / cypress / e2e / examples / base-path.spec.ts
1 context('Base path deployment', () => {
2 after(() => {
3 cy.task('stopBasePathServer')
4 })
5
6 // `history` (#2629) and `hash` (#2622) both regressed in 52.16.0: navigation
7 // duplicated the `--base` into the pushed path. Guard both router modes.
8 for (const [routerMode, slidePath] of [
9 ['history', ''],
10 ['hash', '#/'],
11 ] as const) {
12 it(`keeps slide navigation relative to the router base (${routerMode} mode)`, () => {
13 // Building the fixture inside the task can take a while, especially on CI
14 cy.task<string>('startBasePathServer', routerMode, { timeout: 300_000 }).then((url) => {
15 cy.visit(`${url}${slidePath}1`)
16 cy.get('#page-root > #slide-container > #slide-content')
17 cy.get('body').wait(500).type('{rightarrow}')
18 cy.url().should('eq', `${url}${slidePath}2`)
19 })
20 })
21 }
22 })
23
23 lines TYPESCRIPT