From 34f377385e26af10d116c64d5e2a82b221d66e17 Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Fri, 19 May 2023 12:21:07 +0300 Subject: [PATCH] Fix the "Not Found" view and implement an e2e test ref #250 --- cypress/integration/basic.spec.ts | 30 +++++++++++++++++++++++++++++ cypress/integration/example.spec.ts | 8 -------- src/views/NotFoundView.vue | 17 +++++++++------- 3 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 cypress/integration/basic.spec.ts delete mode 100644 cypress/integration/example.spec.ts diff --git a/cypress/integration/basic.spec.ts b/cypress/integration/basic.spec.ts new file mode 100644 index 00000000..72da38db --- /dev/null +++ b/cypress/integration/basic.spec.ts @@ -0,0 +1,30 @@ +// https://docs.cypress.io/api/introduction/api.html + +describe("Basic test", () => { + it("visits the app root url", () => { + cy.visit("/"); + cy.contains("h2", "Scale data"); + }); +}); + +describe("404 page", () => { + it("creates an octaplex", () => { + cy.visit("/non-existing-page"); + cy.contains("h2", "Not found"); + cy.get("a") + .last() + .click() + .then(() => { + cy.get("button") + .first() + .click() + .then(() => { + cy.contains("h2", "Scale data"); + cy.get("#scale-name").should( + "have.value", + "The Octaplex (3 5 7 11)" + ); + }); + }); + }); +}); diff --git a/cypress/integration/example.spec.ts b/cypress/integration/example.spec.ts deleted file mode 100644 index ece8f5e8..00000000 --- a/cypress/integration/example.spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -// https://docs.cypress.io/api/introduction/api.html - -describe("Basic test", () => { - it("visits the app root url", () => { - cy.visit("/"); - cy.contains("h2", "Scale data"); - }); -}); diff --git a/src/views/NotFoundView.vue b/src/views/NotFoundView.vue index 92c7c17e..1bf783de 100644 --- a/src/views/NotFoundView.vue +++ b/src/views/NotFoundView.vue @@ -4,7 +4,6 @@ */ import OctaplexPortal from "@/components/modals/generation/SummonOctaplex.vue"; -import type { Synth } from "@/synth"; import { encodeQuery } from "@/url-encode"; import type { Scale } from "scale-workshop-core"; import { nextTick, ref } from "vue"; @@ -28,7 +27,11 @@ const props = defineProps<{ equaveShift: number; degreeShift: number; - synth: Synth; + waveform: string; + attackTime: number; + decayTime: number; + sustainLevel: number; + releaseTime: number; }>(); const emit = defineEmits(["update:scale", "update:scaleName"]); @@ -56,11 +59,11 @@ function openTheGates(scale: Scale) { equaveShift: props.equaveShift, degreeShift: props.degreeShift, - waveform: props.synth.waveform, - attackTime: props.synth.attackTime, - decayTime: props.synth.decayTime, - sustainLevel: props.synth.sustainLevel, - releaseTime: props.synth.releaseTime, + waveform: props.waveform, + attackTime: props.attackTime, + decayTime: props.decayTime, + sustainLevel: props.sustainLevel, + releaseTime: props.releaseTime, }; const query = encodeQuery(state) as LocationQuery;