mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-01 05:02:27 -05:00
test(opengraph): add e2e test for opengraph metadata
Since mocking next/head for component tests seems not to work that easily, we decided to go with e2e tests. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
09c2eaba9d
commit
ada2dce9c2
1 changed files with 26 additions and 0 deletions
26
frontend/cypress/e2e/opengraph.spec.ts
Normal file
26
frontend/cypress/e2e/opengraph.spec.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
describe('Opengraph metadata', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visitTestNote()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('includes the note title if not overridden', () => {
|
||||||
|
cy.setCodemirrorContent('---\ntitle: Test title\n---')
|
||||||
|
cy.get('meta[property="og:title"]').should('have.attr', 'content', 'Test title')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('includes the note title if overridden', () => {
|
||||||
|
cy.setCodemirrorContent('---\ntitle: Test title\nopengraph:\n title: Overridden title\n---')
|
||||||
|
cy.get('meta[property="og:title"]').should('have.attr', 'content', 'Overridden title')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('includes custom opengraph tags', () => {
|
||||||
|
cy.setCodemirrorContent('---\nopengraph:\n image: https://dummyimage.com/48\n---')
|
||||||
|
cy.get('meta[property="og:image"]').should('have.attr', 'content', 'https://dummyimage.com/48')
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in a new issue