2022-01-30 15:46:43 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { testNoteId } from './visit-test-editor'
|
|
|
|
|
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
|
|
|
visitTestNote(pageMode?: PAGE_MODE, query?: string): Chainable<Cypress.AUTWindow>
|
|
|
|
|
|
|
|
visitHome(): Chainable<Cypress.AUTWindow>
|
|
|
|
|
|
|
|
visitHistory(): Chainable<Cypress.AUTWindow>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('visitHome', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
return cy.visit('/', { retryOnNetworkFailure: true, retryOnStatusCodeFailure: true })
|
2022-01-30 15:46:43 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
Cypress.Commands.add('visitHistory', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
return cy.visit(`/history`, { retryOnNetworkFailure: true, retryOnStatusCodeFailure: true })
|
2022-01-30 15:46:43 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
export enum PAGE_MODE {
|
|
|
|
EDITOR = 'n',
|
|
|
|
PRESENTATION = 'p',
|
|
|
|
DOCUMENT_READ_ONLY = 's'
|
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('visitTestNote', (pageMode: PAGE_MODE = PAGE_MODE.EDITOR, query?: string) => {
|
2022-02-13 06:14:01 -05:00
|
|
|
return cy.visit(`/${pageMode}/${testNoteId}${query ? `?${query}` : ''}`, {
|
|
|
|
retryOnNetworkFailure: true,
|
|
|
|
retryOnStatusCodeFailure: true
|
|
|
|
})
|
2022-01-30 15:46:43 -05:00
|
|
|
})
|