返回 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 [['history', ''], ['hash', '#/']] as const) {
9 it(`keeps slide navigation relative to the router base (${routerMode} mode)`, () => {
10 // Building the fixture inside the task can take a while, especially on CI
11 cy.task<string>('startBasePathServer', routerMode, { timeout: 300_000 }).then((url) => {
12 cy.visit(`${url}${slidePath}1`)
13 cy.get('#page-root > #slide-container > #slide-content')
14 cy.get('body').wait(500).type('{rightarrow}')
15 cy.url().should('eq', `${url}${slidePath}2`)
16 })
17 })
18 }
19 })
20
20 lines TYPESCRIPT