2020-11-22 20:50:07 +00:00
|
|
|
/*
|
2022-09-16 09:03:29 +00:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
2022-04-15 21:03:15 +00:00
|
|
|
import { AuthProviderType } from '../../src/api/config/types'
|
|
|
|
|
2021-03-09 22:00:14 +00:00
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
|
|
|
loadConfig(): Chainable<Window>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-18 20:17:36 +00:00
|
|
|
export const branding = {
|
2021-03-09 22:03:54 +00:00
|
|
|
name: 'DEMO Corp',
|
2023-08-12 18:07:38 +00:00
|
|
|
logo: '/public/img/demo.png'
|
2020-07-18 20:17:36 +00:00
|
|
|
}
|
|
|
|
|
2022-04-15 21:03:15 +00:00
|
|
|
export const authProviders = [
|
|
|
|
{
|
|
|
|
type: AuthProviderType.FACEBOOK
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.GITHUB
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.TWITTER
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.DROPBOX
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.GOOGLE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.LOCAL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.LDAP,
|
|
|
|
identifier: 'test-ldap',
|
|
|
|
providerName: 'Test LDAP'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.OAUTH2,
|
|
|
|
identifier: 'test-oauth2',
|
|
|
|
providerName: 'Test OAuth2'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.SAML,
|
|
|
|
identifier: 'test-saml',
|
|
|
|
providerName: 'Test SAML'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: AuthProviderType.GITLAB,
|
|
|
|
identifier: 'test-gitlab',
|
|
|
|
providerName: 'Test GitLab'
|
|
|
|
}
|
|
|
|
]
|
2021-03-09 22:00:14 +00:00
|
|
|
|
|
|
|
export const config = {
|
|
|
|
allowAnonymous: true,
|
2022-04-15 21:03:15 +00:00
|
|
|
allowRegister: true,
|
2021-03-09 22:00:14 +00:00
|
|
|
authProviders: authProviders,
|
|
|
|
branding: branding,
|
2022-04-15 21:03:15 +00:00
|
|
|
useImageProxy: false,
|
2021-05-01 21:01:42 +00:00
|
|
|
specialUrls: {
|
2021-03-09 22:00:14 +00:00
|
|
|
privacy: 'https://example.com/privacy',
|
|
|
|
termsOfUse: 'https://example.com/termsOfUse',
|
|
|
|
imprint: 'https://example.com/imprint'
|
|
|
|
},
|
|
|
|
version: {
|
2022-04-15 21:03:15 +00:00
|
|
|
major: 0,
|
|
|
|
minor: 0,
|
|
|
|
patch: 0,
|
|
|
|
preRelease: '',
|
|
|
|
commit: 'MOCK'
|
2021-03-09 22:00:14 +00:00
|
|
|
},
|
2022-04-15 21:03:15 +00:00
|
|
|
plantumlServer: 'http://mock-plantuml.local',
|
2022-09-16 09:03:29 +00:00
|
|
|
maxDocumentLength: 200
|
2021-03-09 22:00:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('loadConfig', (additionalConfig?: Partial<typeof config>) => {
|
2023-08-12 18:07:38 +00:00
|
|
|
return cy.intercept('/api/private/config', {
|
2020-11-30 11:31:54 +00:00
|
|
|
statusCode: 200,
|
|
|
|
body: {
|
2021-03-09 22:00:14 +00:00
|
|
|
...config,
|
|
|
|
...additionalConfig
|
2020-07-16 09:22:53 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2021-04-14 20:28:50 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.loadConfig()
|
2021-10-09 17:09:29 +00:00
|
|
|
|
2023-08-12 18:07:38 +00:00
|
|
|
cy.intercept('GET', '/public/motd.md', {
|
2021-10-09 17:09:29 +00:00
|
|
|
body: '404 Not Found!',
|
|
|
|
statusCode: 404
|
|
|
|
})
|
2023-08-12 18:07:38 +00:00
|
|
|
cy.intercept('HEAD', '/public/motd.md', {
|
2021-10-09 17:09:29 +00:00
|
|
|
statusCode: 404
|
|
|
|
})
|
2021-04-14 20:28:50 +00:00
|
|
|
})
|