-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from kartAI/feat/22-3d-tiltaksvisning-page
feat/22 3d tiltaksvisning page
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const external_component_url = "https://byggesak3d.norkart.no/view/bf204afe-e50e-4ac6-8839-ebd9406167ac"; | ||
const BASE_URL = "http://localhost:3000/"; | ||
const PAGE_URL = BASE_URL + "tiltaksvisning"; | ||
|
||
|
||
describe('Iframe Tests', () => { | ||
beforeEach(() => { | ||
// Intercept the GET request for the iframe's src URL and alias it as 'iframeLoad' | ||
cy.intercept('GET', `${external_component_url}*`).as('iframeLoad'); | ||
|
||
// Visit the target page after setting up the intercept | ||
cy.visit(PAGE_URL); | ||
}); | ||
|
||
it('should load the iframe without errors', () => { | ||
let timeout = 10_000; | ||
cy.get('[data-cy="tiltaksvisning"]', { timeout: timeout }) | ||
.should('exist') | ||
.and('have.attr', 'src', external_component_url) | ||
.and('be.visible') | ||
.as('embedding'); | ||
|
||
// Wait for the iframe's network request to complete and assert the response status | ||
cy.wait('@iframeLoad', { timeout: timeout }) | ||
.its('response.statusCode') | ||
.should('eq', 200); | ||
|
||
cy.get('@embedding').should('be.visible'); | ||
}); | ||
}); | ||
|
||
|
||
describe("The page must ", () => { | ||
it("should load the title", () => { | ||
cy.visit(PAGE_URL) | ||
cy.get('[data-cy="title"]') | ||
.should("exist") | ||
.and("contain.text", "3D tiltaksvisning") | ||
.and('be.visible') | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
|
||
interface IframeProps { | ||
src: string; | ||
title?: string; | ||
width?: string | number; | ||
height?: string | number; | ||
frameBorder?: number; | ||
allowFullScreen?: boolean; | ||
} | ||
|
||
const EmbeddedFrame: React.FC<IframeProps> = ({ | ||
src, | ||
title = 'Embedded Frame', | ||
width = '90%', | ||
height = '600vh', | ||
allowFullScreen = false, | ||
...props | ||
}) => { | ||
return ( | ||
<iframe | ||
src={src} | ||
title={title} | ||
width={width} | ||
height={height} | ||
allowFullScreen={allowFullScreen} | ||
|
||
{...props} | ||
></iframe> | ||
); | ||
}; | ||
|
||
export default EmbeddedFrame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import EmbeddedFrame from "../_components/EmbeddedFrame"; | ||
|
||
|
||
export default async function Home() { | ||
return ( | ||
<div> | ||
<h1 data-cy="title">3D tiltaksvisning</h1> | ||
<EmbeddedFrame data-cy="tiltaksvisning" src="https://byggesak3d.norkart.no/view/bf204afe-e50e-4ac6-8839-ebd9406167ac" title="3D tiltaksvisning" /> | ||
</div> | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters