Skip to content

Commit

Permalink
e2e fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Arnauer committed Mar 30, 2022
1 parent 854f1aa commit ca01236
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions e2e-test/cypress/integration/documents_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@ let projectId;
let subprojectId;
let workflowitemId;
let baseUrl, apiRoute;
let isExternalStorageEnabled = false;

// Actual file in fixture folder
const fileName = "documents_test.json";

describe("Attaching a document to a workflowitem.", function () {
describe("Attaching a document to a workflowitem.", function() {
before(() => {
baseUrl = Cypress.env("API_BASE_URL") || `${Cypress.config("baseUrl")}/test`;
apiRoute = baseUrl.toLowerCase().includes("test") ? "/test/api" : "/api";
cy.login();
cy.getVersion().then(data => {
if (data.storage && data.storage.release) {
isExternalStorageEnabled = true;
}
});
cy.createProject("documents test project", "workflowitem documents test", [])
.then(({ id }) => {
projectId = id;
Expand All @@ -34,7 +28,7 @@ describe("Attaching a document to a workflowitem.", function () {
});
});

beforeEach(function () {
beforeEach(function() {
cy.login();
cy.visit(`/projects/${projectId}/${subprojectId}`);
});
Expand All @@ -60,7 +54,7 @@ describe("Attaching a document to a workflowitem.", function () {
return cy.get("[data-test=workflowitemDocumentFileName]").should("contain", fileName);
};

it("A document can be validated.", function () {
it("A document can be validated.", function() {
cy.intercept(apiRoute + "/workflowitem.update*").as("update");
cy.intercept(apiRoute + "/subproject.viewDetails*").as("viewDetails");
cy.intercept(apiRoute + "/workflowitem.validate*").as("validate");
Expand Down Expand Up @@ -97,7 +91,7 @@ describe("Attaching a document to a workflowitem.", function () {
.should("contain", "Identical");
});

it("Validation of wrong document fails.", function () {
it("Validation of wrong document fails.", function() {
cy.intercept(apiRoute + "/workflowitem.update*").as("update");
cy.intercept(apiRoute + "/subproject.viewDetails*").as("viewDetails");
cy.intercept(apiRoute + "/workflowitem.validate*").as("validate");
Expand Down Expand Up @@ -135,7 +129,7 @@ describe("Attaching a document to a workflowitem.", function () {
.should("contain", "Different");
});

it("The filename and document name are shown correctly", function () {
it("The filename and document name are shown correctly", function() {
cy.intercept(apiRoute + "/workflowitem.update*").as("update");
cy.intercept(apiRoute + "/subproject.viewDetails*").as("viewDetails");
cy.intercept(apiRoute + "/workflowitem.validate*").as("validate");
Expand All @@ -161,7 +155,7 @@ describe("Attaching a document to a workflowitem.", function () {
// Check document name
cy.get("[data-test=workflowitemDocumentFileName]")
.should("be.visible")
.first()
.contains(fileName);

});
});

0 comments on commit ca01236

Please sign in to comment.