diff --git a/cypress/e2e/dashboard.cy.ts b/cypress/e2e/dashboard.cy.ts deleted file mode 100644 index 4b7270c..0000000 --- a/cypress/e2e/dashboard.cy.ts +++ /dev/null @@ -1,53 +0,0 @@ -// // cypress/integration/example_spec.js -// Cypress.on('uncaught:exception', (err) => { -// // return false to prevent the error from failing this test -// if (err.message.includes('Hydration')) { -// return false; -// } -// }); - -Cypress.on("uncaught:exception", (err) => { - // Cypress and React Hydrating the document don't get along - // for some unknown reason. Hopefully, we figure out why eventually - // so we can remove this. - // https://github.com/remix-run/remix/issues/4822#issuecomment-1679195650 - // https://github.com/cypress-io/cypress/issues/27204 - if ( - /hydrat/i.test(err.message) || - /Minified React error #418/.test(err.message) || - /Minified React error #423/.test(err.message) - ) { - return false - } -}); - -describe('Dashboard Tests', () => { - beforeEach(() => { - cy.visit('http://localhost:3000'); - }); - - it('should display the main header and footer', () => { - cy.get('header').should('exist'); - cy.get('footer').should('contain', 'Footer from root'); - }); - - it('loads and displays the display name', () => { - // Assuming your API returns a displayName that's visible in the navbar or somewhere on the page - cy.contains('Mocked User'); // Replace 'YourDisplayNameHere' with the actual displayName - }); - - it('navigates to different sections via the app bar', () => { - cy.get('.navds-stack > [href="/contact"] > .navds-link-panel__content').click(); - cy.url().should('include', '/contact'); - - cy.get('.breadcrumbs > [href="/"]').click(); - - cy.get('.navds-stack > [href="/organization"] > .navds-link-panel__content').click(); - cy.url().should('include', '/organization'); - - cy.get('.breadcrumbs > [href="/"]').click(); - - }); - -}); - diff --git a/cypress/e2e/spec.cy.ts b/cypress/e2e/spec.cy.ts deleted file mode 100644 index 85be4d3..0000000 --- a/cypress/e2e/spec.cy.ts +++ /dev/null @@ -1,39 +0,0 @@ -// // cypress/integration/example_spec.js -// Cypress.on('uncaught:exception', (err) => { -// // return false to prevent the error from failing this test -// if (err.message.includes('Hydration')) { -// return false; -// } -// }); - -Cypress.on("uncaught:exception", (err) => { - // Cypress and React Hydrating the document don't get along - // for some unknown reason. Hopefully, we figure out why eventually - // so we can remove this. - // https://github.com/remix-run/remix/issues/4822#issuecomment-1679195650 - // https://github.com/cypress-io/cypress/issues/27204 - if ( - /hydrat/i.test(err.message) || - /Minified React error #418/.test(err.message) || - /Minified React error #423/.test(err.message) - ) { - return false - } -}); - -describe('My First Test', () => { - it('Visits the app', () => { - cy.visit('http://localhost:3000/'); - cy.get('img').should('be.visible'); - cy.get('.grid > .navds-stack > :nth-child(1)').should('be.visible'); - cy.get(':nth-child(1) > .navds-label').should('contain', 'Meny'); - cy.wait(1000); - cy.get('.grid > .navds-stack > :nth-child(2)').should('be.visible'); - cy.get('.grid > .navds-stack > :nth-child(3)').should('be.visible'); - cy.get('.navds-stack > [href="/contact"] > .navds-link-panel__content > .navds-link-panel__title').should('contain', 'Contacts'); - - cy.get('.navds-stack > [href="/contact"]').click(); - - }); -}); - diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 02e4254..0000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/cypress/mocks/browser.tsx b/cypress/mocks/browser.tsx deleted file mode 100644 index d14e4e5..0000000 --- a/cypress/mocks/browser.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import {setupWorker} from "msw/browser"; -import {handlers} from "./handlers"; - -export const worker = setupWorker(...handlers); diff --git a/cypress/mocks/handlers.tsx b/cypress/mocks/handlers.tsx deleted file mode 100644 index 969a6f9..0000000 --- a/cypress/mocks/handlers.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { http, HttpResponse } from 'msw'; - -export const handlers = [ - http.get('http://localhost:8081/api/contacts', () => { - return HttpResponse.json([ - { - "dn": "cn=2d9b5ef8-3d9d-4f7a-8e5f-abc14fd72719,ou=contacts,o=galaxy", - "nin": "2d9b5ef8-3d9d-4f7a-8e5f-abc14fd72719", - "firstName": "Luke", - "lastName": "Skywalker", - "mail": "luke.skywalker@rebelalliance.org", - "mobile": "94736283", - "technical": ["pilot", "jedi"], - "legal": ["rebel"], - "supportId": null, - "roles": ["Jedi Knight", "Commander"] - }, - { - "dn": "cn=4e3f6c2d-6e8f-4e07-b2d5-df56c8a8a117,ou=contacts,o=galaxy", - "nin": "4e3f6c2d-6e8f-4e07-b2d5-df56c8a8a117", - "firstName": "Leia", - "lastName": "Organa", - "mail": "leia.organa@rebelalliance.org", - "mobile": "95847295", - "technical": ["diplomat", "leader"], - "legal": ["princess", "rebel"], - "supportId": null, - "roles": ["Princess", "General"] - }, - { - "dn": "cn=5a8d0e47-7e6d-4a83-9c8d-eda214f9d47b,ou=contacts,o=galaxy", - "nin": "5a8d0e47-7e6d-4a83-9c8d-eda214f9d47b", - "firstName": "Han", - "lastName": "Solo", - "mail": "han.solo@millenniumfalcon.org", - "mobile": "95273829", - "technical": ["pilot", "smuggler"], - "legal": ["rebel"], - "supportId": null, - "roles": ["Captain", "General"] - }, - { - "dn": "cn=7bd1c386-fbe8-4f90-8d2e-22f2075a8b50,ou=contacts,o=galaxy", - "nin": "7bd1c386-fbe8-4f90-8d2e-22f2075a8b50", - "firstName": "Chewbacca", - "lastName": "", - "mail": "chewbacca@kashyyyk.org", - "mobile": "95648392", - "technical": ["co-pilot", "mechanic"], - "legal": ["rebel"], - "supportId": null, - "roles": ["First Mate", "Mechanic"] - }, - { - "dn": "cn=9f8b1c2e-f47d-4a4e-8cbe-df2c8a8d4557,ou=contacts,o=galaxy", - "nin": "9f8b1c2e-f47d-4a4e-8cbe-df2c8a8d4557", - "firstName": "Obi-Wan", - "lastName": "Kenobi", - "mail": "obiwan.kenobi@jediorder.org", - "mobile": "94473829", - "technical": ["jedi", "pilot"], - "legal": ["jedi"], - "supportId": null, - "roles": ["Jedi Master", "General"] - } - ] - ); - }), - - http.get('http://localhost:8081/api/me', () => { - return HttpResponse.json({ - fullName: 'Mocked User' - } ); - }), - - http.get('http://localhost:8081/api/organisations', () => { - return HttpResponse.json([{ - "dn": "ou=jenniferabc,ou=organisations,o=fint", - "name": "Test Org A", - "orgNumber": "123456", - "displayName": "jennifertestb", - "components": [], - "legalContact": null, - "techicalContacts": [], - "k8sSize": null, - "customer": false, - "primaryAssetId": "jenniferabc" - }, - { - "dn": "ou=fridiks_no,ou=organisations,o=fint", - "name": "fridiks_no", - "orgNumber": "931388975", - "displayName": "Frid IKS", - "components": [ - "ou=administrasjon_organisasjon,ou=components,o=fint", - "ou=administrasjon_kodeverk,ou=components,o=fint", - "ou=administrasjon_fullmakt,ou=components,o=fint", - "ou=administrasjon_personal,ou=components,o=fint" - ], - "legalContact": "cn=28086339155,ou=contacts,o=fint", - "techicalContacts": [], - "k8sSize": null, - "customer": false, - "primaryAssetId": "fridiks.no" - }] ); - }), -]; diff --git a/cypress/mocks/node.tsx b/cypress/mocks/node.tsx deleted file mode 100644 index 5e236e0..0000000 --- a/cypress/mocks/node.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import {setupServer} from "msw/node"; -import {handlers} from "./handlers"; - -export const server = setupServer(...handlers); diff --git a/cypress/mocks/orginzation-list.json b/cypress/mocks/orginzation-list.json deleted file mode 100644 index ab8f361..0000000 --- a/cypress/mocks/orginzation-list.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "dn": "ou=jenniferabc,ou=organisations,o=fint", - "name": "Test Org A", - "orgNumber": "123456", - "displayName": "jennifertestb", - "components": [], - "legalContact": null, - "techicalContacts": [], - "k8sSize": null, - "customer": false, - "primaryAssetId": "jenniferabc" - }, - { - "dn": "ou=fridiks_no,ou=organisations,o=fint", - "name": "fridiks_no", - "orgNumber": "931388975", - "displayName": "Frid IKS", - "components": [ - "ou=administrasjon_organisasjon,ou=components,o=fint", - "ou=administrasjon_kodeverk,ou=components,o=fint", - "ou=administrasjon_fullmakt,ou=components,o=fint", - "ou=administrasjon_personal,ou=components,o=fint" - ], - "legalContact": "cn=28086339155,ou=contacts,o=fint", - "techicalContacts": [], - "k8sSize": null, - "customer": false, - "primaryAssetId": "fridiks.no" - } -] diff --git a/cypress/screenshots/spec.cy.ts/My First Test -- Visits the app (failed).png b/cypress/screenshots/spec.cy.ts/My First Test -- Visits the app (failed).png deleted file mode 100644 index c7e8bfc..0000000 Binary files a/cypress/screenshots/spec.cy.ts/My First Test -- Visits the app (failed).png and /dev/null differ diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts deleted file mode 100644 index 98bde71..0000000 --- a/cypress/support/commands.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// Cypress.on('uncaught:exception', (err, runnable) => { -// // Returning false prevents Cypress from failing the test -// return false; -// }); -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- 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 -// } -// } -// } - diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts deleted file mode 100644 index f80f74f..0000000 --- a/cypress/support/e2e.ts +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file