describe('Bookmarks', () => {
  beforeEach(() => {
    // todo: mock all the graphql queries and mutations
    cy.exec('python ../server/manage.py prepare_bookmarks_for_cypress');

    cy.viewport('macbook-15');
    cy.apolloLogin('rachel.green', 'test');
  });

  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();
  });
});
