Skip to content

Commit

Permalink
Merge pull request #45 from TDT4290-group-4/37-test-sprint-1-code
Browse files Browse the repository at this point in the history
37 test sprint 1 code
  • Loading branch information
kleinc authored Oct 27, 2025
2 parents 9186fa3 + 9311ba8 commit 1315491
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ dist-ssr
*.sw?

# Point cloud data
/public/pointclouds/
/public/pointclouds/

# Cypress screenshots
/cypress/screenshots/
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,19 @@ This application is built using Potree as a package, meaning that the potree bui
### Updating Potree version

To update the version of Potree that this application uses you must make a build from the official potree app and replace the build folder here with the new one. There is no guarantee that Molloy Explorer is compatible with other versions of potree. Make sure that everything works on the development server before applying this to the production server.

## Cypress Testing

### Run Development Server

```bash
npm run dev
```

### Run Cypress tests

Then in a new terminal run the tests:

```bash
npm run test
```
3 changes: 2 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export default defineConfig({
setupNodeEvents(on, config) {
// implement node event listeners here
}
}
},
trashAssetsBeforeRuns: false
})
2 changes: 1 addition & 1 deletion cypress/e2e/filtering.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
describe('Accepted filtering', () => {
it('test accepted filter button', function () {
cy.visit('http://localhost:5173/#')
cy.get('#doAcceptedFilter').click()
cy.get('#doAcceptedFiltering').click()
})
})

Expand Down
11 changes: 2 additions & 9 deletions cypress/e2e/globeRendering.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Globe Rendering and Interaction Test', () => {
it('Check that the globe is rendered correctly', () => {
it('Check that the viewer is rendered correctly', () => {
cy.visit('http://localhost:5173/#')
cy.wait(6000)

Expand All @@ -12,18 +12,11 @@ describe('Globe Rendering and Interaction Test', () => {
})
})

it('Render the globe and test interactions', () => {
it('Render the globe and test interactions with the globe', () => {
cy.visit('http://localhost:5173/#')
cy.wait(6000)

cy.window({ timeout: 20000 }).its('cesiumViewer').should('exist')
cy.get('#cesiumContainer').should('exist')
})

it('Test interactions', () => {
cy.visit('http://localhost:5173/#')
cy.wait(500)
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
})
})
56 changes: 56 additions & 0 deletions cypress/e2e/measurementTool.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
describe('Measurement tool', () => {
it('Places the measurement point', () => {
cy.visit('http://localhost:5173/#')

cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()

// Verify measurement was created
cy.get('#scene_object_properties').should('be.visible')
cy.get('#g_point_body').children().should('have.length.at.least', 1)
})

it('Delete measurement point', function () {
cy.visit('http://localhost:5173/#')

cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#scene_object_properties [name="remove"]').click()
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#g_point_body button.m-row-delete').click()
})

it('Copy measurement point positions', function () {
cy.visit('http://localhost:5173/#')
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#scene_object_properties [name="copy"]').click()
})

it('Switch between measurement points', function () {
cy.visit('http://localhost:5173/#')
// Create three point measurements
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
// Switch between the created points
cy.get('#g_point_body span[title="Point #2"]').click()
cy.get('#g_point_body div:nth-child(1)').click()
cy.get('#g_point_body span[title="Point #3"]').click()
})

it('Open and close List of Measurements ', function () {
cy.visit('http://localhost:5173/#')

cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#tools img[data-i18n="[title]tt.point_measurement"]').click()
cy.get('#potree_render_area canvas[tabindex="2222"]').click()
cy.get('#measurement_items span.m-group-title').click()
cy.get('#measurement_items span.m-group-title').click()
})
})
25 changes: 25 additions & 0 deletions cypress/e2e/shadedLighting.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe('Shaded Lighting', () => {
it('Toggle the EDL checkbox on and off', () => {
cy.visit('http://localhost:5173/#')
cy.get('#chkEDLEnabled').uncheck().should('not.be.checked')
cy.get('#chkEDLEnabled').check().should('be.checked')
})

it('Change radius', function () {
cy.visit('http://localhost:5173/#')
cy.get('div.potree_container').click()
cy.get('#sldEDLRadius span.ui-corner-all').click()
})

it('Change strength', function () {
cy.visit('http://localhost:5173/#')
cy.get('#sldEDLStrength span.ui-corner-all').click()
cy.get('#sldEDLStrength span.ui-corner-all').click()
})

it('Change opacity', function () {
cy.visit('http://localhost:5173/#')
cy.get('#sldEDLOpacity span.ui-corner-all').click()
cy.get('#sldEDLOpacity span.ui-corner-all').click()
})
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "vite build",
"preview": "vite preview",
"format": "prettier --write .",
"format:check": "prettier --check ."
"format:check": "prettier --check .",
"test": "cypress run --browser chrome"
},
"dependencies": {
"cors": "^2.8.5",
Expand Down

0 comments on commit 1315491

Please sign in to comment.