Add cypress test
This commit is contained in:
parent
3dc778d41b
commit
c2ead4c78d
|
|
@ -0,0 +1,39 @@
|
|||
describe('Survey', () => {
|
||||
beforeEach(() => {
|
||||
cy.exec("python ../server/manage.py prepare_bookmarks_for_cypress");
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
cy.startGraphQLCapture();
|
||||
cy.login('rahel.cueni', 'test', true);
|
||||
cy.get('body').contains('Neues Wissen erwerben');
|
||||
});
|
||||
|
||||
it('should bookmark content block', () => {
|
||||
cy.visit('/module/lohn-und-budget/');
|
||||
|
||||
cy.get('.content-component').contains('Das folgende Interview').parent().parent().as('interviewContent');
|
||||
|
||||
cy.get('@interviewContent').within(() => {
|
||||
cy.get('.bookmark-actions__bookmark').click();
|
||||
cy.get('.bookmark-actions__add-note').click();
|
||||
});
|
||||
|
||||
cy.get('[data-cy=bookmark-note]').within(() => {
|
||||
cy.get('.skillbox-input').type('Hallo Velo');
|
||||
});
|
||||
|
||||
cy.get('[data-cy=modal-save-button]').click();
|
||||
|
||||
cy.get('@interviewContent').within(() => {
|
||||
cy.get('.bookmark-actions__edit-note').click();
|
||||
|
||||
});
|
||||
|
||||
cy.get('[data-cy=bookmark-note]').within(() => {
|
||||
cy.get('.skillbox-input').clear().type('Hello Bike');
|
||||
});
|
||||
|
||||
cy.get('[data-cy=modal-save-button]').click();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="bookmark-actions">
|
||||
<a class="bookmark-actions__action" @click="$emit('bookmark')"
|
||||
<a class="bookmark-actions__action bookmark-actions__bookmark" @click="$emit('bookmark')"
|
||||
:class="{'bookmark-actions__action--bookmarked': bookmarked}">
|
||||
<bookmark-icon :bookmarked="bookmarked"></bookmark-icon>
|
||||
</a>
|
||||
<a class="bookmark-actions__action" v-if="bookmarked && !note" @click="$emit('add-note')">
|
||||
<a class="bookmark-actions__action bookmark-actions__add-note" v-if="bookmarked && !note" @click="$emit('add-note')">
|
||||
<add-note-icon></add-note-icon>
|
||||
</a>
|
||||
<a class="bookmark-actions__action bookmark-actions__action--noted" @click="$emit('edit-note')" v-if="note">
|
||||
<a class="bookmark-actions__action bookmark-actions__edit-note bookmark-actions__action--noted" @click="$emit('edit-note')" v-if="note">
|
||||
<note-icon></note-icon>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<modal :hide-header="true" :small="true">
|
||||
<modal-input v-on:input="localNote.text = $event"
|
||||
placeholder="Notiz erfassen"
|
||||
data-cy="bookmark-note"
|
||||
:value="localNote.text"
|
||||
></modal-input>
|
||||
<div slot="footer">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
from django.core.management import BaseCommand
|
||||
|
||||
from notes.models import ContentBlockBookmark, ModuleBookmark, ChapterBookmark
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write("Preparing bookmarks")
|
||||
ContentBlockBookmark.objects.all().delete()
|
||||
ModuleBookmark.objects.all().delete()
|
||||
ChapterBookmark.objects.all().delete()
|
||||
Loading…
Reference in New Issue