diff --git a/src/main/java/com/dougnoel/sentinel/steps/CsvSteps.java b/src/main/java/com/dougnoel/sentinel/steps/CsvSteps.java
index 21cfb018..800698e5 100644
--- a/src/main/java/com/dougnoel/sentinel/steps/CsvSteps.java
+++ b/src/main/java/com/dougnoel/sentinel/steps/CsvSteps.java
@@ -371,4 +371,33 @@ public static void verifyNumberOfRows(int numRows){
assertEquals(errorMessage, numRows, file.getNumberOfDataRows());
}
+ /**
+ * Stores the value of a specific row and column cell within a CSV file with a given name.
+ * Used for storing a CSV cell value that will not be modified for later comparison.
+ *
+ * Gherkin Examples:
+ *
+ * - I store the cell value in the last row of the name column in the csv as last name entry
+ * - I store the cell value in the 4th row of the 1st column in the csv as comment entry
+ *
+ * @param rowNum String the row of the cell. Can contain an ordinal such as 1st, 3rd, 4th, or last
+ * @param column String the column of the cell. Can contain the column name or it's ordinal form
+ * @param storageKey String the name to store the value as
+ */
+ @Then("^I store the cell value in the (la|\\d+)(?:st|nd|rd|th) row of the (.*?) column in the (?:csv|CSV) as (.*?)$")
+ public static void storeCsvValue(String rowNum, String column, String storageKey) {
+ CsvFile file = (CsvFile) FileManager.getCurrentTestFile();
+ int rowIndex = rowNum.equals("la") ? file.getNumberOfDataRows() : Integer.parseInt(rowNum);
+
+ String storageValue;
+ String firstColumnCharacter = column.substring(0, 1);
+ if(StringUtils.isNumeric(firstColumnCharacter)){
+ storageValue = file.readCellData(SentinelStringUtils.parseOrdinal(column), rowIndex);
+ }
+ else{
+ storageValue = file.readCellData(column, rowIndex);
+ }
+
+ Configuration.update(storageKey, storageValue);
+ }
}
\ No newline at end of file
diff --git a/src/test/java/features/386 CSV Steps.feature b/src/test/java/features/386 CSV Steps.feature
index 7223aff7..4ccb27a2 100644
--- a/src/test/java/features/386 CSV Steps.feature
+++ b/src/test/java/features/386 CSV Steps.feature
@@ -1,6 +1,6 @@
#author: sampacos
-@386 @csv @525
+@386 @csv @525 @555
Feature: Verify and Edit CSVs
@386A @csv
@@ -79,4 +79,21 @@ Feature: Verify and Edit CSVs
And I delete the 2nd row entry in the CSV file
Then I verify the CSV has 2 data rows
And I verify the comment column of the csv does not have the text me
- And I verify the 5th column of the csv does not have the text now
\ No newline at end of file
+ And I verify the 5th column of the csv does not have the text now
+
+ @555A @csv
+ Scenario: Store and verify the value of a CSV file
+ Given I navigate to the Downloads Test Page
+ When I verify that by clicking the csv download link a new file is downloaded with the extension csv
+ And I find and open the last downloaded csv file with 1 header row
+ And I store the cell value in the last row of the name column in the csv as originalFinalName
+ And I store the cell value in the 1st row of the name column in the csv as originalFirstName
+ Then I verify the name column of the csv contains the same text used for the originalFinalName
+ And I verify the name column of the csv does not contain the text change original final name
+ And I verify the name column of the csv does not contain the text change original first name
+ When I set the value in the last row of the name column to change original final name in the CSV file
+ And I set the value in the 1st row of the name column to change original first name in the CSV file
+ Then I verify the name column of the csv contains the text change original final name
+ And I verify the name column of the csv contains the text change original first name
+ And I verify the name column of the csv does not contain the same text used for the originalFinalName
+ And I verify the name column of the csv does not contain the same text used for the originalFirstName
\ No newline at end of file