mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 21:44:21 -04:00
Add new visit functions in e2e tests
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
566b3009b6
commit
ca5dae3f82
34 changed files with 88 additions and 56 deletions
|
@ -28,3 +28,4 @@ import './get-by-id'
|
|||
import './get-iframe-content'
|
||||
import './login'
|
||||
import './visit-test-editor'
|
||||
import './visit'
|
||||
|
|
|
@ -4,18 +4,8 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
declare namespace Cypress {
|
||||
interface Chainable {
|
||||
visitTestEditor(query?: string): Chainable<Cypress.AUTWindow>
|
||||
}
|
||||
}
|
||||
|
||||
export const testNoteId = 'test'
|
||||
|
||||
Cypress.Commands.add('visitTestEditor', (query?: string) => {
|
||||
return cy.visit(`/n/${testNoteId}${query ? `?${query}` : ''}`)
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.intercept(`/mock-backend/api/private/notes/${testNoteId}-get`, {
|
||||
content: '',
|
||||
|
|
35
cypress/support/visit.ts
Normal file
35
cypress/support/visit.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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', () => {
|
||||
return cy.visit('/', { retryOnNetworkFailure: true })
|
||||
})
|
||||
|
||||
Cypress.Commands.add('visitHistory', () => {
|
||||
return cy.visit(`/history`, { retryOnNetworkFailure: true })
|
||||
})
|
||||
|
||||
export enum PAGE_MODE {
|
||||
EDITOR = 'n',
|
||||
PRESENTATION = 'p',
|
||||
DOCUMENT_READ_ONLY = 's'
|
||||
}
|
||||
|
||||
Cypress.Commands.add('visitTestNote', (pageMode: PAGE_MODE = PAGE_MODE.EDITOR, query?: string) => {
|
||||
return cy.visit(`/${pageMode}/${testNoteId}${query ? `?${query}` : ''}`, { retryOnNetworkFailure: true })
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue