Skip to content

Commit

Permalink
Merge pull request #527 from openkfw/refactor-budget-file
Browse files Browse the repository at this point in the history
Refactor budget.js with Redux
  • Loading branch information
Stezido authored Oct 7, 2020
2 parents 1e55888 + 69473bf commit f155aba
Show file tree
Hide file tree
Showing 19 changed files with 1,150 additions and 500 deletions.
37 changes: 23 additions & 14 deletions e2e-test/cypress/integration/currencies_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ import { languages } from "../support/helper";
import { currencies } from "../support/helper";
import { toAmountString } from "../support/helper";

const currenciesArray = Object.keys(currencies);
const standardBudget = [
{
organization: "Test",
value: "12345",
currencyCode: "EUR"
}
];

describe("Describe Currencies", function() {
let baseUrl, apiRoute;
const currenciesArray = Object.keys(currencies);
const standardBudget = [
{
organization: "Test",
value: "12345",
currencyCode: "EUR"
}
];

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

beforeEach(function() {
cy.login();
cy.server();
cy.route("GET", apiRoute + "/project.list*").as("listProjects");
cy.visit(`/projects`);
});

Expand All @@ -22,7 +30,7 @@ describe("Describe Currencies", function() {
cy.get("[data-test=creation-dialog]").should("be.visible");

// Type in organization name to activate currency dropdown
cy.get("[data-test=organizationinput").type("Test");
cy.get("[data-test=organization-input").type("Test");

cy.get("[data-test=dropdown-currencies]").should("be.visible");
cy.get("[data-test=dropdown-currencies-click]").click();
Expand All @@ -38,7 +46,7 @@ describe("Describe Currencies", function() {
cy.get("[data-test=creation-dialog]").should("be.visible");

// Type in organization name to activate currency dropdown
cy.get("[data-test=organizationinput").type("Test");
cy.get("[data-test=organization-input").type("Test");

cy.get("[data-test=dropdown-currencies]").should("be.visible");
cy.get("[data-test=dropdown-currencies-click]").click();
Expand All @@ -52,19 +60,20 @@ describe("Describe Currencies", function() {
});

it("Sets the currency of a new project to EUR and checks if the Euro sign is displayed", function() {
cy.createProject("project budget test project", "project budget test", standardBudget);
cy.visit("/projects").wait("@listProjects");
cy.get("[data-test*=project-card]")
.last()
.find("[data-test=project-budget]")
.should("contain", currencies.EUR.symbol);
});

it("Checking format for Value and currency Symbol of all languages", function() {
cy.visit(`/`);
cy.createProject("project budget test project", "project budget test", standardBudget);
cy.visit("/projects").wait("@listProjects");
languages.forEach(languageElement => {
cy.login("mstein", "test", { language: languageElement });
cy.visit(`/projects`);

//get last Project (standardBudget)
cy.get("[data-test*=project-card]")
.last()
.find("[data-test=project-budget]")
Expand Down
Loading

0 comments on commit f155aba

Please sign in to comment.