mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-30 14:55:27 -04:00
added e2e tests (#298)
- added e2e tests for - banner - history - intro - language - link - added e2e workflow - added cypress badge to README
This commit is contained in:
parent
1a5d4f6db8
commit
f0fe7f5ac2
26 changed files with 1332 additions and 77 deletions
15
cypress/support/checkLinks.ts
Normal file
15
cypress/support/checkLinks.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
declare namespace Cypress {
|
||||
interface Chainable {
|
||||
/**
|
||||
* Custom command to check an external Link.
|
||||
* @example cy.get(a#extern).checkExternalLink('http://example.com')
|
||||
*/
|
||||
checkExternalLink (url: string): Chainable<Element>
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('checkExternalLink', { prevSubject: 'element' }, ($element: JQuery, url: string) => {
|
||||
cy.wrap($element).should('have.attr', 'href', url)
|
||||
.should('have.attr', 'target', '_blank')
|
||||
})
|
47
cypress/support/config.ts
Normal file
47
cypress/support/config.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
export const banner = {
|
||||
text: 'This is the mock banner call',
|
||||
timestamp: '2020-05-22T20:46:08.962Z'
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
cy.server()
|
||||
cy.route({
|
||||
url: '/api/v2/config',
|
||||
response: {
|
||||
allowAnonymous: true,
|
||||
authProviders: {
|
||||
facebook: true,
|
||||
github: true,
|
||||
twitter: true,
|
||||
gitlab: true,
|
||||
dropbox: true,
|
||||
ldap: true,
|
||||
google: true,
|
||||
saml: true,
|
||||
oauth2: true,
|
||||
email: true,
|
||||
openid: true
|
||||
},
|
||||
branding: {
|
||||
name: 'ACME Corp',
|
||||
logo: 'http://localhost:3000/acme.png'
|
||||
},
|
||||
banner: banner,
|
||||
customAuthNames: {
|
||||
ldap: 'FooBar',
|
||||
oauth2: 'Olaf2',
|
||||
saml: 'aufSAMLn.de'
|
||||
},
|
||||
specialLinks: {
|
||||
privacy: 'https://example.com/privacy',
|
||||
termsOfUse: 'https://example.com/termsOfUse',
|
||||
imprint: 'https://example.com/imprint'
|
||||
},
|
||||
version: {
|
||||
version: 'mock',
|
||||
sourceCodeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
issueTrackerUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
18
cypress/support/index.ts
Normal file
18
cypress/support/index.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
// ***********************************************************
|
||||
// This example support/index.ts is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
import './checkLinks'
|
||||
import './config'
|
||||
import './login'
|
15
cypress/support/login.ts
Normal file
15
cypress/support/login.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
declare namespace Cypress {
|
||||
interface Chainable {
|
||||
/**
|
||||
* Custom command to log the user out.
|
||||
* @example cy.logout()
|
||||
*/
|
||||
logout (): Chainable<Window>
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('logout', () => {
|
||||
cy.get('#dropdown-user').click()
|
||||
cy.get('.fa-sign-out').click()
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue