Skip to content

Commit

Permalink
fix notebook test
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Oct 11, 2023
1 parent 5f3da5e commit 84e17e6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cypress/e2e/notebooks.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ describe('Notebooks', () => {

cy.fixture('api/notebooks/notebook.json').then((notebook) => {
cy.intercept('GET', /api\/projects\/\d+\/notebooks\/.*\//, { body: notebook }).as('loadNotebook')
// this means saving doesn't work but so what?
cy.intercept('PATCH', /api\/projects\/\d+\/notebooks\/.*\//, (req, res) => {
res.reply(req.body)
// bounce the notebook patch back as if it succeeded,
// this means saving doesn't work in Cypress but so what?
cy.intercept('PATCH', /api\/projects\/\d+\/notebooks\/.*\//, (req) => {
req.reply(req.body)
}).as('patchNotebook')
})

Expand All @@ -42,12 +43,13 @@ describe('Notebooks', () => {

it('Insertion suggestions can be dismissed', () => {
cy.visit(urls.notebook('h11RoiwV'))
cy.get('.node-ph-replay-timestamp').click()
cy.get('.NotebookEditor').type('{enter}')

cy.get('.NotebookRecordingTimestamp--preview').should('exist')
cy.get('.NotebookRecordingTimestamp.opacity-50').should('exist')

cy.get('.NotebookEditor').type('{esc}')
cy.get('.NotebookFloatingButton .LemonButton').should('exist')
cy.get('.NotebookRecordingTimestamp.opacity-50').should('not.exist')
})

it('Can comment on a recording', () => {
Expand All @@ -66,8 +68,8 @@ describe('Notebooks', () => {
cy.get('li').contains('Notebooks').should('exist').click()
cy.get('[data-attr="new-notebook"]').click()
// we don't actually get a new notebook because the API is mocked
// so, "exit" the timestamp block we start in
cy.get('.NotebookEditor').type('{esc}{enter}{enter}')
// so, we need to clear the text
cy.get('.NotebookEditor').type('{selectAll}{backSpace}{enter}')
})

it('Can add a number list', () => {
Expand All @@ -84,7 +86,7 @@ describe('Notebooks', () => {

it('Can add bold', () => {
cy.get('.NotebookEditor').type('**bold**')
cy.get('.NotebookEditor p').last().should('contain.html', '<strong>bold</strong>')
cy.get('.NotebookEditor p').first().should('contain.html', '<strong>bold</strong>')
})

it('Can add bullet list', () => {
Expand Down

0 comments on commit 84e17e6

Please sign in to comment.