fix: make tests work again with new selectors

This commit is contained in:
kolaente 2022-07-21 00:50:03 +02:00
parent 0a914e37ed
commit 7d61635182
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -11,7 +11,7 @@ describe('List View Gantt', () => {
const tasks = TaskFactory.create(1) const tasks = TaskFactory.create(1)
cy.visit('/lists/1/gantt') cy.visit('/lists/1/gantt')
cy.get('.gantt-chart .tasks') cy.get('#g-gantt-rows-container')
.should('not.contain', tasks[0].title) .should('not.contain', tasks[0].title)
}) })
@ -23,7 +23,7 @@ describe('List View Gantt', () => {
cy.visit('/lists/1/gantt') cy.visit('/lists/1/gantt')
cy.get('.gantt-chart .months') cy.get('.g-timeunits-container')
.should('contain', format(now, 'MMMM')) .should('contain', format(now, 'MMMM'))
.should('contain', format(nextMonth, 'MMMM')) .should('contain', format(nextMonth, 'MMMM'))
}) })
@ -36,14 +36,13 @@ describe('List View Gantt', () => {
}) })
cy.visit('/lists/1/gantt') cy.visit('/lists/1/gantt')
cy.get('.gantt-chart .tasks') cy.get('#g-gantt-rows-container')
.should('not.be.empty') .should('not.be.empty')
cy.get('.gantt-chart .tasks')
.should('contain', tasks[0].title) .should('contain', tasks[0].title)
}) })
it('Shows tasks with no dates after enabling them', () => { it('Shows tasks with no dates after enabling them', () => {
TaskFactory.create(1, { const tasks = TaskFactory.create(1, {
start_date: null, start_date: null,
end_date: null, end_date: null,
}) })
@ -53,13 +52,15 @@ describe('List View Gantt', () => {
.contains('Show tasks which don\'t have dates set') .contains('Show tasks which don\'t have dates set')
.click() .click()
cy.get('.gantt-chart .tasks') cy.get('#g-gantt-rows-container')
.should('not.be.empty') .should('not.be.empty')
cy.get('.gantt-chart .tasks .task.nodate') .should('contain', tasks[0].title)
.should('exist')
}) })
it('Drags a task around', () => { it('Drags a task around', () => {
cy.intercept('**/api/v1/tasks/*')
.as('taskUpdate')
const now = new Date() const now = new Date()
TaskFactory.create(1, { TaskFactory.create(1, {
start_date: formatISO(now), start_date: formatISO(now),
@ -67,10 +68,11 @@ describe('List View Gantt', () => {
}) })
cy.visit('/lists/1/gantt') cy.visit('/lists/1/gantt')
cy.get('.gantt-chart .tasks .task') cy.get('#g-gantt-rows-container .g-gantt-row .g-gantt-row-bars-container div .g-gantt-bar')
.first() .first()
.trigger('mousedown', {which: 1}) .trigger('mousedown', {which: 1})
.trigger('mousemove', {clientX: 500, clientY: 0}) .trigger('mousemove', {clientX: 500, clientY: 0})
.trigger('mouseup', {force: true}) .trigger('mouseup', {force: true})
cy.wait('@taskUpdate')
}) })
}) })