Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2785] Provide cypress tests for Gantt
It also consumes gant-task-react 0.4.4 version and bring some minor changes. Bug: #2785 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
- Loading branch information
Showing
21 changed files
with
1,149 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
integration-tests/cypress/e2e/project/gantt/gantt-task.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { Details } from '../../../workbench/Details'; | ||
import { GanttTestHelper } from '../../../workbench/GanttTestHelper'; | ||
|
||
describe('Verify the Gantt Task actions', () => { | ||
let studioProjectId: string = ''; | ||
let taskProjectId: string = ''; | ||
before(() => { | ||
// We create the Gantt View from the stereotype before executing the tests | ||
new GanttTestHelper().initGanttView().then((projectId) => { | ||
studioProjectId = projectId; | ||
}); | ||
|
||
new GanttTestHelper() | ||
.createTaskProjectAndGanttRepresentation('Project Dev', 'New Gantt Representation') | ||
.then((projectId) => { | ||
taskProjectId = projectId; | ||
}); | ||
}); | ||
after(() => { | ||
cy.deleteProject(studioProjectId); | ||
cy.deleteProject(taskProjectId); | ||
}); | ||
|
||
beforeEach(() => { | ||
new GanttTestHelper().openGanttRepresentation(taskProjectId, 'Project Dev', 'New Gantt Representation'); | ||
}); | ||
|
||
it('can select a task and see its attributes in Details', () => { | ||
const ganttHelper = new GanttTestHelper(); | ||
ganttHelper.getTask('Specification').click(); | ||
const details = new Details(); | ||
details.getTextField('Name').should('have.value', 'Specification'); | ||
details.getTextField('Description').should('have.value', 'Description of the Specification'); | ||
details.getTextField('Progress').should('have.value', '50'); | ||
details.getDetailsView().findByTestId('Compute Start/End Dynamically').should('not.exist'); | ||
// details.getCheckBox('Compute Start/End Dynamically').should('not.exist'); | ||
|
||
ganttHelper.getProjectTask('Development').click(); | ||
details.getCheckBox('Compute Start/End Dynamically').should('exist'); | ||
}); | ||
|
||
it('can change task characteristics from detail with effect in gantt', () => { | ||
const ganttHelper = new GanttTestHelper(); | ||
const details = new Details(); | ||
ganttHelper.getTask('Specification').click(); | ||
|
||
details.getTextField('Name').type('Renamed{Enter}'); | ||
ganttHelper.getTask('Specification').should('not.exist'); | ||
ganttHelper.getTask('SpecificationRenamed').should('exist'); | ||
|
||
ganttHelper.checkSVGAttributeInTask(ganttHelper.getTask('SpecificationRenamed'), 'rect', 'width', '82.5'); | ||
details.getTextField('End Time').type('{selectall}{backspace}2023-12-13T17:30:00Z{Enter}'); | ||
ganttHelper.checkSVGAttributeInTask(ganttHelper.getTask('SpecificationRenamed'), 'rect', 'width', '142.5'); | ||
}); | ||
|
||
it('can create and delete a new task', () => { | ||
const ganttHelper = new GanttTestHelper(); | ||
ganttHelper.getTask('Front').click(); | ||
ganttHelper.getGanttRepresentation().getByTestId('create-task').click(); | ||
ganttHelper.getTask('New Task').should('exist'); | ||
|
||
ganttHelper.getTask('New Task').click(); | ||
ganttHelper.getGanttRepresentation().getByTestId('delete-task').click(); | ||
ganttHelper.getTask('New Task').should('not.exist'); | ||
}); | ||
}); |
209 changes: 209 additions & 0 deletions
209
integration-tests/cypress/e2e/project/gantt/gantt.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { Explorer } from '../../../workbench/Explorer'; | ||
import { GanttTestHelper } from '../../../workbench/GanttTestHelper'; | ||
|
||
describe('Verify the Gantt Representation', () => { | ||
let studioProjectId: string = ''; | ||
before(() => { | ||
// We create the Gantt View from the stereotype before executing the tests | ||
new GanttTestHelper().initGanttView().then((projectId) => { | ||
studioProjectId = projectId; | ||
}); | ||
}); | ||
after(() => { | ||
// We delete the created studio once all tests have been executed | ||
cy.deleteProject(studioProjectId); | ||
}); | ||
|
||
context('We new verify the Gantt Creation, Deletion and renaming', () => { | ||
let taskProjectId: string; | ||
before(() => { | ||
new GanttTestHelper() | ||
.createTaskProjectAndGanttRepresentation('Project Dev', 'New Gantt Representation') | ||
.then((projectId) => { | ||
taskProjectId = projectId; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
new GanttTestHelper().openGanttRepresentation(taskProjectId, 'Project Dev', 'New Gantt Representation'); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteProject(taskProjectId); | ||
}); | ||
|
||
it('can create the Gantt Representation', () => { | ||
new Explorer().getSelectedTreeItems().contains('New Gantt Representation').should('exist'); | ||
new GanttTestHelper().getGanttRepresentation().should('exist'); | ||
}); | ||
|
||
it('can verify the Gantt Representation on the Dev project', () => { | ||
new Explorer().getSelectedTreeItems().contains('New Gantt Representation').should('exist'); | ||
|
||
const gantt = new GanttTestHelper(); | ||
//We verify that all tasks are present. | ||
const taskTitles: string[] = ['Idea', 'Specification', 'Front', 'Back', 'Review']; | ||
taskTitles.forEach((title) => { | ||
gantt.getTask(title).should('exist'); | ||
}); | ||
const projectTitles: string[] = ['Development', 'Code Development']; | ||
projectTitles.forEach((title) => { | ||
gantt.getProjectTask(title).should('exist'); | ||
}); | ||
gantt.getMilestone('Release').should('exist'); | ||
}); | ||
|
||
it('can rename the Gantt Representation', () => { | ||
const explorer = new Explorer(); | ||
explorer.getTreeItemByLabel('New Gantt Representation').should('exist'); | ||
new GanttTestHelper().getGanttRepresentation().should('exist'); | ||
explorer.rename('New Gantt Representation', 'renamed'); | ||
explorer.getTreeItemByLabel('New Gantt Representation').should('not.exist'); | ||
explorer.getTreeItemByLabel('renamed').should('exist'); | ||
|
||
cy.getByTestId('representation-tab-renamed').should('exist'); | ||
explorer.rename('renamed', 'New Gantt Representation'); | ||
}); | ||
|
||
it('can remove the Gantt Representation', () => { | ||
const explorer = new Explorer(); | ||
explorer.getTreeItemByLabel('New Gantt Representation').should('exist'); | ||
new GanttTestHelper().getGanttRepresentation().should('exist'); | ||
explorer.delete('New Gantt Representation'); | ||
explorer.getTreeItemByLabel('New Gantt Representation').should('not.exist'); | ||
cy.getByTestId('representation-area').find('h5').should('have.text', 'The Gantt does not exist anymore'); | ||
}); | ||
}); | ||
|
||
context('We verify the Gantt table columns', () => { | ||
let taskProjectId: string; | ||
before(() => { | ||
new GanttTestHelper() | ||
.createTaskProjectAndGanttRepresentation('Project Dev', 'New Gantt Representation') | ||
.then((projectId) => { | ||
taskProjectId = projectId; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
new GanttTestHelper().openGanttRepresentation(taskProjectId, 'Project Dev', 'New Gantt Representation'); | ||
}); | ||
|
||
after(() => { | ||
console.log('cy.deleteProject(taskProjectId)'); | ||
cy.deleteProject(taskProjectId); | ||
}); | ||
it('can display the table columns', () => { | ||
const ganttHelper = new GanttTestHelper(); | ||
const columnTitles = ['Name', 'Date of start', 'Date of start', 'Progress']; | ||
columnTitles.forEach((title) => { | ||
ganttHelper.getColumnHeader(title).should('exist'); | ||
}); | ||
ganttHelper.getGanttRepresentation().findByTestId('display-task-list-columns').click(); | ||
columnTitles.forEach((title) => { | ||
ganttHelper.getColumnHeader(title).should('not.exist'); | ||
}); | ||
ganttHelper.getGanttRepresentation().findByTestId('display-task-list-columns').click(); | ||
columnTitles.forEach((title) => { | ||
ganttHelper.getColumnHeader(title).should('exist'); | ||
}); | ||
|
||
//hide one column | ||
ganttHelper.getGanttRepresentation().findByTestId('columns-select').click(); | ||
cy.getByTestId('columnType-From').click(); | ||
ganttHelper.getColumnHeader('Date of start').should('not.exist'); | ||
cy.getByTestId('columnType-From').click(); | ||
ganttHelper.getColumnHeader('Date of start').should('exist'); | ||
cy.get('body').click(0, 0); | ||
|
||
// hide all columns | ||
ganttHelper.getGanttRepresentation().findByTestId('display-task-list-columns').click(); | ||
columnTitles.forEach((title) => { | ||
ganttHelper.getColumnHeader(title).should('not.exist'); | ||
}); | ||
ganttHelper.getGanttRepresentation().findByTestId('display-task-list-columns').click(); | ||
columnTitles.forEach((title) => { | ||
ganttHelper.getColumnHeader(title).should('exist'); | ||
}); | ||
ganttHelper.getGanttRepresentation().findByTestId('columns-select').click(); | ||
cy.getByTestId('columnType-From').click(); | ||
cy.get('body').click(0, 0); | ||
ganttHelper.getGanttRepresentation().findByTestId('display-task-list-columns').click(); | ||
ganttHelper.getColumnHeader('Date of start').should('not.exist'); | ||
}); | ||
|
||
it('can change the columns width', () => { | ||
const ganttHelper = new GanttTestHelper(); | ||
|
||
ganttHelper.getColumnHeader('Name').then((header) => { | ||
expect(header.width()).eq(200); | ||
}); | ||
ganttHelper | ||
.getGanttRepresentation() | ||
.findByTestId('table-column-header-resize-handle-Name') | ||
.trigger('mousedown') | ||
.trigger('mousemove', { clientX: 450 }) | ||
.trigger('mouseup'); | ||
|
||
ganttHelper.getColumnHeader('Name').then((header) => { | ||
expect(header.width()).eq(140); | ||
}); | ||
ganttHelper.getColumnHeader('Date of start').then((header) => { | ||
expect(header.width()).eq(140); | ||
}); | ||
}); | ||
}); | ||
|
||
context('We verify the Gantt toolbar', () => { | ||
let taskProjectId: string; | ||
before(() => { | ||
new GanttTestHelper() | ||
.createTaskProjectAndGanttRepresentation('Project Dev', 'New Gantt Representation') | ||
.then((projectId) => { | ||
taskProjectId = projectId; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
new GanttTestHelper().openGanttRepresentation(taskProjectId, 'Project Dev', 'New Gantt Representation'); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteProject(taskProjectId); | ||
}); | ||
|
||
it('can change the zoom level', () => { | ||
cy.getByTestId('zoom-level').get('input').should('have.value', 'Day'); | ||
cy.getByTestId('representation-area').findByTestId('zoom-level').click(); | ||
cy.getByTestId('zoom-level-Hour').click(); | ||
cy.getByTestId('zoom-level-Hour').should('exist'); | ||
cy.getByTestId('fit-to-screen').click(); | ||
cy.getByTestId('zoom-level').get('input').should('have.value', 'Day'); | ||
}); | ||
|
||
it('can share the representation', () => { | ||
cy.getByTestId('representation-area').findByTestId('share').click(); | ||
|
||
cy.url().then((url) => { | ||
cy.window().then((win) => { | ||
win.navigator.clipboard.readText().then((text) => { | ||
expect(text).to.eq(url); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.