From 71b332bf27a977c45dbf2593907163f16c026e6a Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Tue, 11 Mar 2025 08:59:29 +0200 Subject: [PATCH] Location create --- .../locations/location_create.feature | 32 +++++++++---------- .../step_definitions/location_create.rb | 25 +++++++++++++++ 2 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 staff_features/locations/step_definitions/location_create.rb diff --git a/staff_features/locations/location_create.feature b/staff_features/locations/location_create.feature index b121a29..556fe3d 100644 --- a/staff_features/locations/location_create.feature +++ b/staff_features/locations/location_create.feature @@ -1,31 +1,31 @@ Feature: Location Create Background: Given an administrator user is logged in - Scenario: Simple Location is created - Given the user is on the New Location page + Scenario: Single Location is created + Given the New Location page is displayed When the user fills in 'Building' And the user fills in 'Barcode' And the user clicks on 'Save Location' Then the 'Location' created message is displayed - Scenario: Simple Location is not created because required field Building is missing - Given the user is on the New Location page + Scenario: Single Location is not created because required field Building is missing + Given the New Location page is displayed When the user clicks on 'Save Location' Then the following error message is displayed | Building - Property is required but was missing | - Scenario: Simple Location is not created because required field Barcode is missing - Given the user is on the New Location page + Scenario: Single Location is not created because required field Barcode is missing + Given the New Location page is displayed When the user fills in 'Building' And the user clicks on 'Save Location' Then the following error message is displayed | You must either specify a barcode, a classification, or both a coordinate 1 label and coordinate 1 indicator | Scenario: Batch Location is created - Given the user is on the New Batch Location page + Given the New Batch Location page is displayed When the user fills in 'Building' - And the user fills in 'Label' for 'Coordinate Range 1' - And the user fills in 'Range Start' for 'Coordinate Range 1' - And the user fills in 'Range End' for 'Coordinate Range 1' + And the user fills in Coordinate Range 1 Label with 'Test' + And the user fills in Coordinate Range 1 Range Start with '1' + And the user fills in Coordinate Range 1 Range End with '3' And the user clicks on 'Create Location' - Then the 'Batch Locations' created message is displayed + Then the '3 Locations' created message is displayed Scenario: Batch Location is not created because required fields are missing Given the user is on the New Batch Location page When the user clicks on 'Create Locations' @@ -33,10 +33,10 @@ Feature: Location Create | Building - Property is required but was missing | | Coordinate Range 1 - Property is required but was missing | Scenario: Number of Locations is previewed - Given the user is on the New Batch Location page + Given the New Batch Location page is displayed When the user fills in 'Building' - And the user fills in 'Label' for 'Coordinate Range 1' - And the user fills in 'Range Start' for 'Coordinate Range 1' - And the user fills in 'Range End' for 'Coordinate Range 1' + And the user fills in Coordinate Range 1 Label with 'Test' + And the user fills in Coordinate Range 1 Range Start with '1' + And the user fills in Coordinate Range 1 Range End with '3' And the user clicks on 'Preview Locations' - Then the Preview Locations modal with the number of Locations is displayed \ No newline at end of file + Then the Preview Locations modal with the number of Locations is displayed diff --git a/staff_features/locations/step_definitions/location_create.rb b/staff_features/locations/step_definitions/location_create.rb new file mode 100644 index 0000000..7b46919 --- /dev/null +++ b/staff_features/locations/step_definitions/location_create.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +Given 'the New Location page is displayed' do + visit "#{STAFF_URL}/locations/new" +end + +Given 'the New Batch Location page is displayed' do + visit "#{STAFF_URL}/locations/batch" +end + +When 'the user fills in Coordinate Range 1 Label with {string}' do |value| + fill_in 'location_batch_coordinate_1_range__label_', with: value +end + +When 'the user fills in Coordinate Range 1 Range Start with {string}' do |value| + fill_in 'location_batch_coordinate_1_range__start_', with: value +end + +When 'the user fills in Coordinate Range 1 Range End with {string}' do |value| + fill_in 'location_batch_coordinate_1_range__end_', with: value +end + +Then 'the Preview Locations modal with the number of Locations is displayed' do + expect(page).to have_css '#batchPreviewModal' +end