diff --git a/cypress/e2e/test_simulator_to_url_parameters.cy.ts b/cypress/e2e/test_simulator_to_url_parameters.cy.ts index eabb66b..4ec0b96 100644 --- a/cypress/e2e/test_simulator_to_url_parameters.cy.ts +++ b/cypress/e2e/test_simulator_to_url_parameters.cy.ts @@ -1,23 +1,23 @@ describe("simulator loads", () => { it("successfully loads the home page", () => { - cy.visit("/"); + cy.visit("/#/"); cy.contains("h4", " Remote freelancer from Portugal 🇵🇹"); }); }); describe("pass income to url parameters", () => { it("successfully uses income from simulator", () => { - cy.visit("/"); + cy.visit("/#/"); cy.get('[data-cy="income"]').type("50000"); cy.url().should("include", "?income=50000"); }); it("doesn't update the url if wrong format passed", () => { - cy.visit("/"); + cy.visit("/#/"); cy.get('[data-cy="income"]').type("dummyval"); cy.url().should("not.include", "dummyval"); }); it("doesn't update the url if income is 0", () => { - cy.visit("/"); + cy.visit("/#/"); cy.get('[data-cy="income"]').type("0"); cy.url().should("not.include", "0"); }); @@ -25,7 +25,7 @@ describe("pass income to url parameters", () => { describe("pass incomeFrequency to url parameters", () => { it("successfully uses incomeFrequency from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="frequency-dropdown"]>input').click(); cy.contains("Day").click(); cy.url().should("include", "incomeFrequency=day"); @@ -34,7 +34,7 @@ describe("pass incomeFrequency to url parameters", () => { describe("pass displayFrequency to url parameters", () => { it("successfully uses displayFrequency from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="frequency-button"]').contains("Day").click(); cy.url().should("include", "displayFrequency=day"); }); @@ -42,28 +42,28 @@ describe("pass displayFrequency to url parameters", () => { describe("pass nrMonthsDisplay to url parameters", () => { it("successfully uses nrMonthsDisplay from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="nr-months-display"] input:first-of-type') .invoke("val", "") .type("13"); cy.url().should("include", "nrMonthsDisplay=13"); }); it("successfully uses nrMonthsDisplay from simulator when using decrease button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get( '[data-cy="nr-months-display"] [data-cy="counter-decrease"]', ).click(); cy.url().should("include", "nrMonthsDisplay=11"); }); it("successfully uses nrMonthsDisplay from simulator when using increase button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get( '[data-cy="nr-months-display"] [data-cy="counter-increase"]', ).click(); cy.url().should("include", "nrMonthsDisplay=13"); }); it("doesn't update nrMonthsDisplay if incorrect from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="nr-months-display"] input:first-of-type') .invoke("val", "") .type("-1"); @@ -73,12 +73,12 @@ describe("pass nrMonthsDisplay to url parameters", () => { describe("pass ssDiscount to url parameters", () => { it("successfully uses ssDiscount from simulator when using decrease button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="ss-discount"] [data-cy="counter-decrease"]').click(); cy.url().should("include", "ssDiscount=-0.05"); }); it("successfully uses ssDiscount from simulator when using increase button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="ss-discount"] [data-cy="counter-increase"]').click(); cy.url().should("include", "ssDiscount=0.05"); }); @@ -86,24 +86,24 @@ describe("pass ssDiscount to url parameters", () => { describe("pass expenses to url parameters", () => { it("successfully uses expenses from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="expenses"] input:first-of-type') .invoke("val", "") .type("3500"); cy.url().should("include", "expenses=3500"); }); it("successfully uses expenses from simulator when using decrease button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="expenses"] [data-cy="counter-decrease"]').click(); cy.url().should("include", "expenses=2400"); }); it("successfully uses expenses from simulator when using increase button", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="expenses"] [data-cy="counter-increase"]').click(); cy.url().should("include", "expenses=2600"); }); it("doesn't update expenses if incorrect from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="expenses"] input:first-of-type') .invoke("val", "") .type("adadsads"); @@ -113,7 +113,7 @@ describe("pass expenses to url parameters", () => { describe("pass currentTaxRankYear to url parameters", () => { it("successfully uses currentTaxRankYear from simulator", () => { - cy.visit("/?income=50000"); + cy.visit("/#/?income=50000"); cy.get('[data-cy="tax-rank-years-dropdown"]>input').click(); cy.contains("2024").click(); cy.url().should("include", "currentTaxRankYear=2024"); @@ -122,26 +122,26 @@ describe("pass currentTaxRankYear to url parameters", () => { describe("pass ssFirstYear to url parameters", () => { it("successfully uses true ssFirstYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').click(); cy.url().should("include", "ssFirstYear=true"); }); it("successfully uses false ssFirstYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').click().click(); cy.url().should("include", "ssFirstYear=false"); }); }); describe("pass firstYear to url parameters", () => { it("successfully uses true firstYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').click(); cy.url().should("include", "firstYear=true"); }); it("successfully uses false firstYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').click().click(); cy.url().should("include", "firstYear=false"); }); @@ -149,13 +149,13 @@ describe("pass firstYear to url parameters", () => { describe("pass secondYear to url parameters", () => { it("successfully uses true secondYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').click(); cy.url().should("include", "secondYear=true"); }); it("successfully uses false secondYear from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').click().click(); cy.url().should("include", "secondYear=false"); }); @@ -163,13 +163,13 @@ describe("pass secondYear to url parameters", () => { describe("pass rnh to url parameters", () => { it("successfully uses true rnh from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="rnh"] input:first-of-type').click(); cy.url().should("include", "rnh=true"); }); it("successfully uses false rnh from simulator", () => { - cy.visit("/?income=50000"); // change URL to match your dev URL + cy.visit("/#/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="rnh"] input:first-of-type').click().click(); cy.url().should("include", "rnh=false"); }); diff --git a/cypress/e2e/test_url_parameters_to_simulator.cy.ts b/cypress/e2e/test_url_parameters_to_simulator.cy.ts index 1559dc8..503783f 100644 --- a/cypress/e2e/test_url_parameters_to_simulator.cy.ts +++ b/cypress/e2e/test_url_parameters_to_simulator.cy.ts @@ -6,6 +6,8 @@ describe("simulator loads", () => { }); describe("pass income through url parameters", () => { + + it("successfully uses income from url", () => { cy.visit("/?income=50000"); // change URL to match your dev URL cy.get('[data-cy="income"]').should("have.value", "50 000"); @@ -37,14 +39,14 @@ describe("pass displayFrequency through url parameters", () => { cy.visit("/?income=50000&displayFrequency=day"); // change URL to match your dev URL cy.get('[data-cy="frequency-button"].bg-secondary').should( "have.text", - "Day", + "Day" ); }); it("doesn't update displayFrequency if incorrect from url", () => { cy.visit("/?income=50000&displayFrequency=dummyval"); // change URL to match your dev URL cy.get('[data-cy="frequency-button"].bg-secondary').should( "have.text", - "Month", + "Month" ); }); }); @@ -54,14 +56,14 @@ describe("pass nrMonthsDisplay through url parameters", () => { cy.visit("/?income=50000&nrMonthsDisplay=13"); // change URL to match your dev URL cy.get('[data-cy="nr-months-display"] input:first-of-type').should( "have.value", - "13", + "13" ); }); it("doesn't update nrMonthsDisplay if incorrect from url", () => { cy.visit("/?income=50000&nrMonthsDisplay=-1"); // change URL to match your dev URL cy.get('[data-cy="nr-months-display"] input:first-of-type').should( "have.value", - "12", + "12" ); }); }); @@ -82,7 +84,7 @@ describe("pass expenses through url parameters", () => { cy.visit("/?income=50000&expenses=1534"); // change URL to match your dev URL cy.get('[data-cy="expenses"] input:first-of-type').should( "have.value", - "1 534", + "1 534" ); }); @@ -90,7 +92,7 @@ describe("pass expenses through url parameters", () => { cy.visit("/?income=50000&expenses=0"); // change URL to match your dev URL cy.get('[data-cy="expenses"] input:first-of-type').should( "have.value", - "0", + "0" ); }); @@ -98,7 +100,7 @@ describe("pass expenses through url parameters", () => { cy.visit("/?income=50000&expenses=-1534"); // change URL to match your dev URL cy.get('[data-cy="expenses"] input:first-of-type').should( "have.value", - "0", + "0" ); }); }); @@ -108,7 +110,7 @@ describe("pass currentTaxRankYear through url parameters", () => { cy.visit("/?income=50000¤tTaxRankYear=2024"); // change URL to match your dev URL cy.get('[data-cy="tax-rank-years-dropdown"] input:first-of-type').should( "have.value", - "2024", + "2024" ); }); @@ -116,7 +118,7 @@ describe("pass currentTaxRankYear through url parameters", () => { cy.visit("/?income=50000¤tTaxRankYear=2025"); // change URL to match your dev URL cy.get('[data-cy="tax-rank-years-dropdown"] input:first-of-type').should( "have.value", - "2023", + "2023" ); }); @@ -124,7 +126,7 @@ describe("pass currentTaxRankYear through url parameters", () => { cy.visit("/?income=50000¤tTaxRankYear=dummyval"); // change URL to match your dev URL cy.get('[data-cy="tax-rank-years-dropdown"] input:first-of-type').should( "have.value", - "2023", + "2023" ); }); }); @@ -134,7 +136,7 @@ describe("pass ssFirstYear through url parameters", () => { cy.visit("/?income=50000&ssFirstYear=true"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').should( "have.value", - "true", + "true" ); }); @@ -142,7 +144,7 @@ describe("pass ssFirstYear through url parameters", () => { cy.visit("/?income=50000&ssFirstYear=false"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -150,7 +152,7 @@ describe("pass ssFirstYear through url parameters", () => { cy.visit("/?income=50000&ssFirstYear=yes"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -158,7 +160,7 @@ describe("pass ssFirstYear through url parameters", () => { cy.visit("/?income=50000&ssFirstYear=1"); // change URL to match your dev URL cy.get('[data-cy="ss-first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); }); @@ -168,7 +170,7 @@ describe("pass firstYear through url parameters", () => { cy.visit("/?income=50000&firstYear=true"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').should( "have.value", - "true", + "true" ); }); @@ -176,7 +178,7 @@ describe("pass firstYear through url parameters", () => { cy.visit("/?income=50000&firstYear=false"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -184,7 +186,7 @@ describe("pass firstYear through url parameters", () => { cy.visit("/?income=50000&firstYear=yes"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -192,7 +194,7 @@ describe("pass firstYear through url parameters", () => { cy.visit("/?income=50000&firstYear=1"); // change URL to match your dev URL cy.get('[data-cy="first-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); }); @@ -202,7 +204,7 @@ describe("pass secondYear through url parameters", () => { cy.visit("/?income=50000&secondYear=true"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').should( "have.value", - "true", + "true" ); }); @@ -210,7 +212,7 @@ describe("pass secondYear through url parameters", () => { cy.visit("/?income=50000&secondYear=false"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -218,7 +220,7 @@ describe("pass secondYear through url parameters", () => { cy.visit("/?income=50000&secondYear=yes"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); @@ -226,7 +228,7 @@ describe("pass secondYear through url parameters", () => { cy.visit("/?income=50000&secondYear=1"); // change URL to match your dev URL cy.get('[data-cy="second-year"] input:first-of-type').should( "have.value", - "false", + "false" ); }); }); diff --git a/src/router/index.ts b/src/router/index.ts index 9e42b66..32d2896 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory } from "vue-router"; +import { createRouter, createWebHashHistory } from "vue-router"; import Simulator from "@/views/SimulatorView.vue"; import About from "@/views/AboutView.vue"; @@ -16,7 +16,7 @@ const routes = [ ]; const router = createRouter({ - history: createWebHistory(), + history: createWebHashHistory(), routes, linkActiveClass: "hover:text-neutral-600 decoration-neutral-600", linkExactActiveClass: "underline underline-offset-8",