Add frontend test for instrument page and fix query bug

This commit is contained in:
Ramon Wenger 2021-11-11 13:59:37 +01:00
parent fa469bf570
commit 7a850b3a94
3 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,27 @@
describe('Instruments Page', () => {
beforeEach(() => {
cy.setup();
});
it('opens the instruments page', () => {
cy.mockGraphqlOps({
operations: {
MeQuery: {},
InstrumentQuery: {
instrument: {
title: 'A Guitar',
intro: 'Money for Nothing',
contents: ''
// id: ID!
// bookmarks: [InstrumentBookmarkNode]
// type: InstrumentTypeNode
}
},
},
});
cy.visit('instrument/blabliblablub');
cy.getByDataCy('instrument-title').should('exist').should('contain', 'A Guitar');
cy.getByDataCy('instrument-intro').should('exist').should('contain', 'Money for Nothing');
});
});

View File

@ -10,6 +10,11 @@ fragment InstrumentParts on InstrumentNode {
text
}
}
type
type {
id
name
category
type
}
contents
}

View File

@ -1,9 +1,12 @@
<template>
<div class="instrument">
<h1 class="instrument__title">{{ instrument.title }}</h1>
<h1
class="instrument__title"
data-cy="instrument-title">{{ instrument.title }}</h1>
<div
class="instrument__intro intro"
data-cy="instrument-intro"
v-html="instrument.intro"/>
<content-component