Skip to content

Conversation

@ismailsunni
Copy link
Contributor

@ismailsunni ismailsunni commented Nov 26, 2025

Some changes for fixing the tests:

  • Use ComputedRef as the parameter for useFieldValidation to maintain reactivity
  • Handling the KML and GPX more properly: attributions, kmlName, hasWarning
  • Prioritize errors from parsing
  • Fix intercepts, wrong layer menu id, etc

Test link

@github-actions github-actions bot added the bug label Nov 26, 2025
@ismailsunni ismailsunni changed the title Fix pb 2026 fix import tool file PB-2026: Fix import tool file Nov 26, 2025
@cypress
Copy link

cypress bot commented Nov 26, 2025

web-mapviewer    Run #6210

Run Properties:  status check errored Errored #6210  •  git commit 8fe2055b9c: PB-2026: Simplify error handling when importing KML file.
Project web-mapviewer
Branch Review fix-pb-2026-fix-import-tool-file
Run status status check errored Errored #6210
Run duration 27m 09s
Commit git commit 8fe2055b9c: PB-2026: Simplify error handling when importing KML file.
Committer Ismail Sunni
View all properties for this run ↗︎

Test results
Tests that failed  Failures 31
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 21
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 155
View all changes introduced in this branch ↗︎

Tests for review

Failed  drawing.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  legacyParamImport.cy.ts • 10 failed tests • e2e/chrome/mobile

View Output

Test Artifacts
Test on legacy param import > Layers import > Combines all old layers_*** params into the new one Test Replay Screenshots
Test on legacy param import > Layers import > is able to import an external KML from a legacy param Test Replay Screenshots
Test on legacy param import > Layers import > is able to import an external KML from a legacy adminId query param Test Replay Screenshots
Test on legacy param import > Layers import > don't keep KML adminId in URL after import Test Replay Screenshots
Test on legacy param import > Layers import > is able to import an external KML from a legacy adminId query param with other layers Test Replay Screenshots
Test on legacy param import > Layers import > doesn't show encoding in the search bar when serving a swisssearch legacy url Test Replay Screenshots
Test on legacy param import > Layers import > External WMS layer Test Replay Screenshots
Test on legacy param import > Layers import > External WMTS layer Test Replay Screenshots
Test on legacy param import > 3D import > transfers camera parameter from legacy URL to the new URL only heading Test Replay Screenshots
Test on legacy param import > Extra Parameter Imports > shows the compare slider at the correct position Test Replay Screenshots
Failed  timeSlider.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  3d/layers.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  layers.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots

The first 5 failed specs are shown, see all 16 specs in Cypress Cloud.

@ismailsunni ismailsunni force-pushed the fix-pb-2026-fix-import-tool-file branch 6 times, most recently from b0e473a to abde6f8 Compare December 1, 2025 04:05
@ismailsunni ismailsunni requested a review from Copilot December 1, 2025 04:06
@ismailsunni ismailsunni changed the title PB-2026: Fix import tool file PB-2064: Fix import tool file Dec 1, 2025
@ismailsunni ismailsunni marked this pull request as ready for review December 1, 2025 04:09
@ismailsunni ismailsunni requested a review from pakb December 1, 2025 04:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issues with the import tool file functionality, including improvements to layer ID handling, validation reactivity, error message prioritization, and test stability.

Key changes:

  • Added KML| and GPX| prefixes to layer IDs throughout the application for consistent layer identification
  • Refactored validation composable to use ComputedRef<props> for better reactivity
  • Improved error prioritization in file parsers to show more specific errors (OutOfBounds, Empty, UnknownProjection) over generic errors

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/viewer/tests/cypress/tests-e2e/importToolFile.cy.ts Updated test expectations to match new layer ID format with KML| and GPX| prefixes; improved test stability with proper wait conditions; refactored 3D test into separate skipped test; added profile intercept constant
packages/viewer/src/utils/composables/useFieldValidation.ts Changed props parameter from object to ComputedRef for proper reactivity; updated to emit full ValidationResult object instead of boolean; removed unused toRef import
packages/viewer/src/utils/components/TextInput.vue Converted validationProps to computed ref for consistency with updated composable
packages/viewer/src/utils/components/TextAreaInput.vue Converted validationProps to computed ref for consistency with updated composable
packages/viewer/src/utils/components/FileInput.vue Converted validationProps to computed ref; updated default prop values and parameter handling; added computedRequired usage
packages/viewer/src/utils/components/EmailInput.vue Converted validationProps to computed ref for consistency with updated composable
packages/viewer/src/modules/menu/components/advancedTools/ImportFile/parser/index.ts Implemented error prioritization logic to show specific errors (OutOfBounds, Empty, UnknownProjection) before generic InvalidFileContentError
packages/viewer/src/modules/menu/components/advancedTools/ImportFile/parser/KMLParser.class.ts Added KML name parsing and proper layer initialization with name, hasWarning, and isLoading properties
packages/viewer/src/modules/menu/components/advancedTools/ImportFile/parser/GPXParser.class.ts Added gpxFileUrl parameter to layer creation for proper GPX layer initialization
packages/viewer/src/modules/menu/components/advancedTools/ImportFile/ImportFileOnlineTab.vue Fixed loading state handling by removing delayed timeout and setting state immediately; reordered props for clarity
packages/viewer/src/modules/menu/components/advancedTools/ImportFile/ImportFileLocalTab.vue Added validMarker prop to FileInput for consistent validation feedback
packages/layers/src/utils/layerUtils.ts Added automatic attribution generation based on file source (local files use filename, URLs use hostname); improved isLocalFile detection; added error handling for URL parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

cy.reload()
cy.waitMapIsReady()

// TODO(IS): We shoudl check for warnings about missing local files, but it needs to be fixed first (related to url)
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "shoudl" should be "should"

Suggested change
// TODO(IS): We shoudl check for warnings about missing local files, but it needs to be fixed first (related to url)
// TODO(IS): We should check for warnings about missing local files, but it needs to be fixed first (related to url)

Copilot uses AI. Check for mistakes.
@sommerfe sommerfe force-pushed the feat-PB-1383-pinia-store branch 2 times, most recently from a1cccff to 9e6d8d7 Compare December 2, 2025 08:43
@ismailsunni ismailsunni force-pushed the fix-pb-2026-fix-import-tool-file branch 2 times, most recently from 4d63ddb to 327e625 Compare December 8, 2025 12:35
Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there might be some conflicting changes with something I've worked on on the report a problem fix, I'll double check that and come with a solution

@sommerfe sommerfe force-pushed the fix-pb-2026-fix-import-tool-file branch from 327e625 to f9cd5c5 Compare December 10, 2025 15:34
@ismailsunni ismailsunni force-pushed the fix-pb-2026-fix-import-tool-file branch from 8fe2055 to 313b278 Compare December 15, 2025 04:32
- Add validation checks before store assertions for non-CORS GPX import
- Handle menu re-renders after layer removal with stabilization waits
- Add conditional warning window handling
- Move profile intercept setup before interactions
When importing a KML file that is outside the extent, the parser was
showing "Invalid file" error instead of the correct "out of bounds" error.

The issue occurred because parseAll() threw the first rejected error from
any parser, which was typically InvalidFileContentError from parsers that
couldn't handle the file format. However, the KML parser correctly
identified the file as KML and threw a more specific OutOfBoundsError.

Fixed by prioritizing specific errors (OutOfBounds, Empty, UnknownProjection)
over generic InvalidFileContentError, ensuring users see the most relevant
error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants