fix(editor): make tests work with changed structure
This commit is contained in:
parent
c6b123734b
commit
803f9c81c2
@ -1,40 +0,0 @@
|
|||||||
import {createFakeUserAndLogin} from '../../support/authenticateUser'
|
|
||||||
|
|
||||||
import {TaskFactory} from '../../factories/task'
|
|
||||||
import {ProjectFactory} from '../../factories/project'
|
|
||||||
import {UserProjectFactory} from '../../factories/users_project'
|
|
||||||
import {BucketFactory} from '../../factories/bucket'
|
|
||||||
|
|
||||||
describe('Editor', () => {
|
|
||||||
createFakeUserAndLogin()
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
ProjectFactory.create(1)
|
|
||||||
BucketFactory.create(1)
|
|
||||||
TaskFactory.truncate()
|
|
||||||
UserProjectFactory.truncate()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Has a preview with checkable checkboxes', () => {
|
|
||||||
const tasks = TaskFactory.create(1, {
|
|
||||||
description: `# Test Heading
|
|
||||||
* Bullet 1
|
|
||||||
* Bullet 2
|
|
||||||
|
|
||||||
* [ ] Checklist
|
|
||||||
* [x] Checklist checked
|
|
||||||
`,
|
|
||||||
bucket_id: 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
|
||||||
cy.get('input[type=checkbox][data-checkbox-num=0]')
|
|
||||||
.click()
|
|
||||||
|
|
||||||
cy.get('.task-view .details.content.description h3 span.is-small.has-text-success')
|
|
||||||
.contains('Saved!')
|
|
||||||
.should('exist')
|
|
||||||
cy.get('.preview.content')
|
|
||||||
.should('contain', 'Test Heading')
|
|
||||||
})
|
|
||||||
})
|
|
@ -122,7 +122,7 @@ describe('Task', () => {
|
|||||||
const tasks = TaskFactory.create(1, {
|
const tasks = TaskFactory.create(1, {
|
||||||
id: 1,
|
id: 1,
|
||||||
index: 1,
|
index: 1,
|
||||||
description: 'Lorem ipsum dolor sit amet.'
|
description: 'Lorem ipsum dolor sit amet.',
|
||||||
})
|
})
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ describe('Task', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
index: 1,
|
index: 1,
|
||||||
done: true,
|
done: true,
|
||||||
done_at: new Date().toISOString()
|
done_at: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
@ -196,13 +196,13 @@ describe('Task', () => {
|
|||||||
it('Can edit the description', () => {
|
it('Can edit the description', () => {
|
||||||
const tasks = TaskFactory.create(1, {
|
const tasks = TaskFactory.create(1, {
|
||||||
id: 1,
|
id: 1,
|
||||||
description: 'Lorem ipsum dolor sit amet.'
|
description: 'Lorem ipsum dolor sit amet.',
|
||||||
})
|
})
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
cy.get('.task-view .details.content.description .editor button')
|
cy.get('.task-view .details.content.description .tiptap button.done-edit')
|
||||||
.click()
|
.click()
|
||||||
cy.get('.task-view .details.content.description .editor .vue-easymde .EasyMDEContainer .CodeMirror-scroll')
|
cy.get('.task-view .details.content.description .tiptap__editor .tiptap.ProseMirror')
|
||||||
.type('{selectall}New Description')
|
.type('{selectall}New Description')
|
||||||
cy.get('[data-cy="saveEditor"]')
|
cy.get('[data-cy="saveEditor"]')
|
||||||
.contains('Save')
|
.contains('Save')
|
||||||
@ -219,7 +219,7 @@ describe('Task', () => {
|
|||||||
})
|
})
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
cy.get('.task-view .comments .media.comment .editor .vue-easymde .EasyMDEContainer .CodeMirror-scroll')
|
cy.get('.task-view .comments .media.comment .tiptap__editor .tiptap.ProseMirror')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.type('{selectall}New Comment')
|
.type('{selectall}New Comment')
|
||||||
cy.get('.task-view .comments .media.comment .button:not([disabled])')
|
cy.get('.task-view .comments .media.comment .button:not([disabled])')
|
||||||
@ -227,7 +227,7 @@ describe('Task', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.get('.task-view .comments .media.comment .editor')
|
cy.get('.task-view .comments .media.comment .tiptap__editor')
|
||||||
.should('contain', 'New Comment')
|
.should('contain', 'New Comment')
|
||||||
cy.get('.global-notification')
|
cy.get('.global-notification')
|
||||||
.should('contain', 'Success')
|
.should('contain', 'Success')
|
||||||
@ -236,7 +236,7 @@ describe('Task', () => {
|
|||||||
it('Can move a task to another project', () => {
|
it('Can move a task to another project', () => {
|
||||||
const projects = ProjectFactory.create(2)
|
const projects = ProjectFactory.create(2)
|
||||||
BucketFactory.create(2, {
|
BucketFactory.create(2, {
|
||||||
project_id: '{increment}'
|
project_id: '{increment}',
|
||||||
})
|
})
|
||||||
const tasks = TaskFactory.create(1, {
|
const tasks = TaskFactory.create(1, {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -696,27 +696,39 @@ describe('Task', () => {
|
|||||||
const tasks = TaskFactory.create(1, {
|
const tasks = TaskFactory.create(1, {
|
||||||
id: 1,
|
id: 1,
|
||||||
description: `
|
description: `
|
||||||
This is a checklist:
|
<ul data-type="taskList">
|
||||||
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
|
||||||
* [ ] one item
|
<div><p>First Item</p></div>
|
||||||
* [ ] another item
|
</li>
|
||||||
* [ ] third item
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
|
||||||
* [ ] fourth item
|
<div><p>Second Item</p></div>
|
||||||
* [x] and this one is already done
|
</li>
|
||||||
`,
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
|
||||||
|
<div><p>Third Item</p></div>
|
||||||
|
</li>
|
||||||
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
|
||||||
|
<div><p>Fourth Item</p></div>
|
||||||
|
</li>
|
||||||
|
<li data-checked="true" data-type="taskItem"><label><input type="checkbox"><span></span></label>
|
||||||
|
<div><p>Fifth Item</p></div>
|
||||||
|
</li>
|
||||||
|
</ul>`,
|
||||||
})
|
})
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
cy.get('.task-view .checklist-summary')
|
cy.get('.task-view .checklist-summary')
|
||||||
.should('contain.text', '1 of 5 tasks')
|
.should('contain.text', '1 of 5 tasks')
|
||||||
cy.get('.editor .content ul > li input[type=checkbox]')
|
cy.get('.tiptap__editor ul > li input[type=checkbox]')
|
||||||
.eq(2)
|
.eq(2)
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.get('.editor .content ul > li input[type=checkbox]')
|
cy.get('.task-view .details.content.description h3 span.is-small.has-text-success')
|
||||||
|
.contains('Saved!')
|
||||||
|
.should('exist')
|
||||||
|
cy.get('.tiptap__editor ul > li input[type=checkbox]')
|
||||||
.eq(2)
|
.eq(2)
|
||||||
.should('be.checked')
|
.should('be.checked')
|
||||||
cy.get('.editor .content input[type=checkbox]')
|
cy.get('.tiptap__editor input[type=checkbox]')
|
||||||
.should('have.length', 5)
|
.should('have.length', 5)
|
||||||
cy.get('.task-view .checklist-summary')
|
cy.get('.task-view .checklist-summary')
|
||||||
.should('contain.text', '2 of 5 tasks')
|
.should('contain.text', '2 of 5 tasks')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user