From c7bff78f3bb859017806a2aa4da4bb0a79a98bb8 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 3 Mar 2025 13:52:47 +0100 Subject: [PATCH] add first e2e feature --- cypress.config.ts | 1 + cypress/support/step_definitions/map.ts | 25 +++++++++++++++++++++++++ features/Map.feature | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 cypress/support/step_definitions/map.ts create mode 100644 features/Map.feature diff --git a/cypress.config.ts b/cypress.config.ts index 9a669680..11100b56 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -28,6 +28,7 @@ export default defineConfig({ specPattern: ['**/**/*.cy.{ts,tsx}'], }, e2e: { + baseUrl: 'http://localhost:5173', chromeWebSecurity: false, retries: 0, specPattern: 'features/**/*.feature', diff --git a/cypress/support/step_definitions/map.ts b/cypress/support/step_definitions/map.ts new file mode 100644 index 00000000..bee127e5 --- /dev/null +++ b/cypress/support/step_definitions/map.ts @@ -0,0 +1,25 @@ +import { Given, Then } from '@badeball/cypress-cucumber-preprocessor' + +Given('I am on the map page', () => { + cy.visit('/') +}) + +Then('the map component should be present', () => { + cy.get('.leaflet-tile-container') + .should('exist') + .children('.leaflet-tile-loaded') + .should('have.length.greaterThan', 0) + .and('be.visible') +}) + +Then('the search input control should be present', () => { + cy.get('.tw-input').should('be.visible') +}) + +Then('the geolocation control should be present', () => { + cy.get('div.tw-card:nth-child(2) > div:nth-child(1)').should('be.visible') +}) + +Then('the layers control should be present', () => { + cy.get('div.tw-bg-base-100:nth-child(1)').should('be.visible') +}) \ No newline at end of file diff --git a/features/Map.feature b/features/Map.feature new file mode 100644 index 00000000..c02662f8 --- /dev/null +++ b/features/Map.feature @@ -0,0 +1,20 @@ +Feature: Map + As a user + I want to have the leaflet map and its control elements available + To be able to interact with the map + + Scenario: Map Component + Given I am on the map page + Then the map component should be present + + Scenario: Search Control + Given I am on the map page + Then the search input control should be present + + Scenario: Geolocation Control + Given I am on the map page + Then the geolocation control should be present + + Scenario: Layers Control + Given I am on the map page + Then the layers control should be present \ No newline at end of file