2020-11-22 15:50:07 -05:00
|
|
|
/*
|
2022-09-16 05:03:29 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 15:50:07 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
2022-04-15 17:03:15 -04:00
|
|
|
import { AuthProviderType } from '../../src/api/config/types'
|
|
|
|
|
2021-03-09 17:00:14 -05:00
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
|
|
|
loadConfig(): Chainable<Window>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-18 16:17:36 -04:00
|
|
|
export const branding = {
|
2021-03-09 17:03:54 -05:00
|
|
|
name: 'DEMO Corp',
|
2022-09-16 05:03:29 -04:00
|
|
|
logo: 'public/img/demo.png'
|
2020-07-18 16:17:36 -04:00
|
|
|
}
|
|
|
|
|
2022-04-15 17:03:15 -04: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 17:00:14 -05:00
|
|
|
|
|
|
|
export const config = {
|
|
|
|
allowAnonymous: true,
|
2022-04-15 17:03:15 -04:00
|
|
|
allowRegister: true,
|
2021-03-09 17:00:14 -05:00
|
|
|
authProviders: authProviders,
|
|
|
|
branding: branding,
|
2022-04-15 17:03:15 -04:00
|
|
|
useImageProxy: false,
|
2021-05-01 17:01:42 -04:00
|
|
|
specialUrls: {
|
2021-03-09 17:00:14 -05:00
|
|
|
privacy: 'https://example.com/privacy',
|
|
|
|
termsOfUse: 'https://example.com/termsOfUse',
|
|
|
|
imprint: 'https://example.com/imprint'
|
|
|
|
},
|
|
|
|
version: {
|
2022-04-15 17:03:15 -04:00
|
|
|
major: 0,
|
|
|
|
minor: 0,
|
|
|
|
patch: 0,
|
|
|
|
preRelease: '',
|
|
|
|
commit: 'MOCK'
|
2021-03-09 17:00:14 -05:00
|
|
|
},
|
2022-04-15 17:03:15 -04:00
|
|
|
plantumlServer: 'http://mock-plantuml.local',
|
2022-09-16 05:03:29 -04:00
|
|
|
maxDocumentLength: 200
|
2021-03-09 17:00:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('loadConfig', (additionalConfig?: Partial<typeof config>) => {
|
2022-09-16 05:03:29 -04:00
|
|
|
return cy.intercept('api/private/config', {
|
2020-11-30 06:31:54 -05:00
|
|
|
statusCode: 200,
|
|
|
|
body: {
|
2021-03-09 17:00:14 -05:00
|
|
|
...config,
|
|
|
|
...additionalConfig
|
2020-07-16 05:22:53 -04:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2021-04-14 16:28:50 -04:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.loadConfig()
|
2021-10-09 13:09:29 -04:00
|
|
|
|
2022-09-16 05:03:29 -04:00
|
|
|
cy.intercept('GET', 'public/motd.md', {
|
2021-10-09 13:09:29 -04:00
|
|
|
body: '404 Not Found!',
|
|
|
|
statusCode: 404
|
|
|
|
})
|
2022-09-16 05:03:29 -04:00
|
|
|
cy.intercept('HEAD', 'public/motd.md', {
|
2021-10-09 13:09:29 -04:00
|
|
|
statusCode: 404
|
|
|
|
})
|
2021-04-14 16:28:50 -04:00
|
|
|
})
|