mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-16 16:14:43 -04:00
Update dependency cypress to v10 (#2095)
* Update dependency cypress to v10 * Migrate cypress files Signed-off-by: Renovate Bot <bot@renovateapp.com> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e93607c96e
commit
040e11924f
34 changed files with 57 additions and 45 deletions
96
cypress/e2e/signInButton.spec.ts
Normal file
96
cypress/e2e/signInButton.spec.ts
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { AuthProvider } from '../../src/api/config/types'
|
||||
import { AuthProviderType } from '../../src/api/config/types'
|
||||
|
||||
const initLoggedOutTestWithCustomAuthProviders = (cy: Cypress.cy, enabledProviders: AuthProvider[]) => {
|
||||
cy.loadConfig({
|
||||
authProviders: enabledProviders
|
||||
})
|
||||
cy.visitHome()
|
||||
cy.logout()
|
||||
}
|
||||
|
||||
describe('When logged-in, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
cy.visitHome()
|
||||
cy.getByCypressId('sign-in-button').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('When logged-out ', () => {
|
||||
describe('and no auth-provider is enabled, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [])
|
||||
cy.getByCypressId('sign-in-button').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('and an interactive auth-provider is enabled, ', () => {
|
||||
it('sign-in button points to login route: internal', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [
|
||||
{
|
||||
type: AuthProviderType.LOCAL
|
||||
}
|
||||
])
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
||||
it('sign-in button points to login route: ldap', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [
|
||||
{
|
||||
type: AuthProviderType.LDAP,
|
||||
identifier: 'cy-ldap',
|
||||
providerName: 'cy LDAP'
|
||||
}
|
||||
])
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
|
||||
describe('and only one one-click auth-provider is enabled, ', () => {
|
||||
it('sign-in button points to auth-provider', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [
|
||||
{
|
||||
type: AuthProviderType.GITHUB
|
||||
}
|
||||
])
|
||||
cy.getByCypressId('sign-in-button')
|
||||
.should('be.visible')
|
||||
// The absolute URL is used because it is defined as API base URL absolute.
|
||||
.should('have.attr', 'href', '/auth/github')
|
||||
})
|
||||
})
|
||||
|
||||
describe('and multiple one-click auth-providers are enabled, ', () => {
|
||||
it('sign-in button points to login route', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [
|
||||
{
|
||||
type: AuthProviderType.GITHUB
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.GOOGLE
|
||||
}
|
||||
])
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
|
||||
describe('and one-click- as well as interactive auth-providers are enabled, ', () => {
|
||||
it('sign-in button points to login route', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, [
|
||||
{
|
||||
type: AuthProviderType.GITHUB
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.LOCAL
|
||||
}
|
||||
])
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue