Skip to content

Commit

Permalink
e2e: add suproject_view_details spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pheolink committed Feb 3, 2021
1 parent 3c20f4b commit b5c87ff
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions e2e-test/cypress/integration/suproject_view_details.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
describe("Workflowitem create", function() {
let projectId;
let subprojectId;
let baseUrl, apiRoute;
const today = new Date().toISOString();;

before(() => {
baseUrl = Cypress.env("API_BASE_URL") || `${Cypress.config("baseUrl")}/test`;
apiRoute = baseUrl.toLowerCase().includes("test") ? "/test/api" : "/api";
});
before(() => {
cy.login();

cy.createProject("workflowitem create test project", "workflowitem create test", [])
.then(({ id }) => {
projectId = id;
return cy.createSubproject(projectId, "workflowitem create test", "EUR");
})
.then(({ id }) => {
subprojectId = id;
});
});

beforeEach(function() {
cy.login();
cy.visit(`/projects/${projectId}/${subprojectId}`);
});

it("If documents array is empty, the attachedFile icon badge is not displayed", function() {
// Create a workflow item
cy.createWorkflowitem(projectId, subprojectId, "workflowitem assign test", {
amountType: "N/A",
documents: [],
}).then(({ id }) => {
let workflowitemId = id;
// Check if attach file icon badge is NOT displayed
cy.get(`[data-test^='attachment-file-badge-show-${workflowitemId}']`).should("not.be.visible");
});
});

it("If documents array is not empty, the attachedFile icon badge is displayed", function() {
// Create a workflow item
cy.createWorkflowitem(projectId, subprojectId, "workflowitem assign test", {
amountType: "N/A",
documents: [
{
"id": "classroom-contract",
"base64": "dGVzdCBiYXNlNjRTdHJpbmc=",
"fileName": "test-document"
}
],
}).then(({ id }) => {
let workflowitemId = id;
// Check if attach file icon badge is NOT displayed
cy.get(`[data-test^='attachment-file-badge-show-${workflowitemId}']`).should("be.visible");
});
});
});

0 comments on commit b5c87ff

Please sign in to comment.