diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts
index 17161e3..242a593 100644
--- a/frontend/cypress.config.ts
+++ b/frontend/cypress.config.ts
@@ -1,9 +1,20 @@
import { defineConfig } from "cypress";
+import { plugin } from "./cypress/plugins/index";
export default defineConfig({
- e2e: {
- setupNodeEvents(on, config) {
- // implement node event listeners here
- },
+ viewportHeight: 1300,
+ viewportWidth: 1800,
+ requestTimeout: 10000,
+ defaultCommandTimeout: 10000,
+ video: false,
+ retries: {
+ runMode: 2,
},
-});
+ e2e: {
+ //@ts-ignore
+ setupNodeEvents(on, config) {
+ return plugin(on, config);
+ },
+ baseUrl: "http://localhost:5173",
+ },
+});
\ No newline at end of file
diff --git a/frontend/cypress/e2e/testspec.cy.ts b/frontend/cypress/e2e/testspec.cy.ts
deleted file mode 100644
index 3e895b7..0000000
--- a/frontend/cypress/e2e/testspec.cy.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { slowCypressDown } from 'cypress-slow-down'
-
-// Notat: Husk å kjør opp frontend før tester
-
-slowCypressDown() // gjør at testene ikke kjører dritfort
-
-describe('Landingsside loader ordentlig', () => {
- context('Resolution er 1080p', () => {
- beforeEach(() => {
- cy.viewport(1920, 1080)
- })
-
- it('passes', () => {
- cy.visit('http://localhost:5173/')
- })
- })
-})
-
-describe('Klarer å navigere frem og tilbake til/fra "Meld inn feil"-side', () => {
- context('Går til "Meld inn feil"-siden', () => {
- beforeEach(() => {
- cy.viewport(1920, 1080)
- })
-
- it('passes', () => {
- cy.visit('http://localhost:5173/')
-
- cy.contains('Meld inn feil').click()
- })
- })
-
- context('Går tilbake til hovedsiden', () => {
- beforeEach(() => {
- cy.viewport(1920, 1080)
- })
-
- it('passes', () => {
- cy.visit('http://localhost:5173/nyfeil')
-
- cy.contains('Gå tilbake til hovedmenyen').click()
- })
- })
-})
\ No newline at end of file
diff --git a/frontend/cypress/plugins/index.ts b/frontend/cypress/plugins/index.ts
new file mode 100644
index 0000000..24d03c5
--- /dev/null
+++ b/frontend/cypress/plugins/index.ts
@@ -0,0 +1,34 @@
+///
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+export const plugin: Cypress.PluginConfig = (on: Cypress.PluginEvents) => {
+ // `on` is used to hook into various events Cypress emits
+ // `config` is the resolved Cypress config
+ on("task", {
+ log(message: string) {
+ console.log(message);
+
+ return null;
+ },
+ table(message: string) {
+ console.table(message);
+
+ return null;
+ },
+ });
+ };
\ No newline at end of file
diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts
index 698b01a..5bbc609 100644
--- a/frontend/cypress/support/commands.ts
+++ b/frontend/cypress/support/commands.ts
@@ -1,3 +1,5 @@
+import 'cypress-axe'
+
///
// ***********************************************
// This example commands.ts shows you how to
@@ -24,14 +26,19 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
-//
-// declare global {
-// namespace Cypress {
-// interface Chainable {
-// login(email: string, password: string): Chainable
-// drag(subject: string, options?: Partial): Chainable
-// dismiss(subject: string, options?: Partial): Chainable
-// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable
-// }
-// }
-// }
\ No newline at end of file
+
+Cypress.Commands.add("checkPageA11y", () => {
+ cy.injectAxe();
+ cy.configureAxe({
+ rules: [
+ // {
+ // id: "svg-img-alt",
+ // enabled: false,
+ // },
+ //Skrur av fordi checkA11y ikke vet at div er en gyldig children av -elementer
+ ],
+ });
+ cy.checkA11y(
+ undefined
+ );
+ });
\ No newline at end of file
diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts
index f80f74f..05caa4c 100644
--- a/frontend/cypress/support/e2e.ts
+++ b/frontend/cypress/support/e2e.ts
@@ -17,4 +17,12 @@
import './commands'
// Alternatively you can use CommonJS syntax:
-// require('./commands')
\ No newline at end of file
+// require('./commands')
+
+declare global {
+ namespace Cypress {
+ interface Chainable {
+ checkPageA11y(): Chainable>;
+ }
+ }
+}
\ No newline at end of file