Skip to content

Commit

Permalink
MDL-66109 behat: Fix Example usage in feature files
Browse files Browse the repository at this point in the history
The gherkin-lint package now understands the use of "Examples" and
requries that their indentation be correct and consistent.

This change sets the indentatation for these to:

    "Examples": 4,
    "example": 6,

This is in-line with the examples given in the offical Cucumber/Gherkin
documentation at
https://cucumber.io/docs/gherkin/reference/#scenario-outline whereby the
Examples and individual rows of the Examples table are children of the
Scenario outline.

This is contrary to the default for Gherkin-lint which places them as
top-level nodes with an indentatio of 0, and 2 respectively.
  • Loading branch information
andrewnicols committed May 11, 2020
1 parent bf6630a commit 149d80e
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 91 deletions.
2 changes: 2 additions & 0 deletions .gherkin-lintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4,
"given": 4,
"and": 4
Expand Down
48 changes: 24 additions & 24 deletions course/tests/behat/category_resort.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Feature: Test we can resort categories in the management interface.
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |

Scenario Outline: Test bulk sorting current category.
Given the following "categories" exist:
Expand All @@ -52,12 +52,12 @@ Feature: Test we can resort categories in the management interface.
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |

Scenario Outline: Test resorting subcategories.
Given the following "categories" exist:
Expand All @@ -79,12 +79,12 @@ Feature: Test we can resort categories in the management interface.
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |

@javascript
Scenario Outline: Test resorting subcategories with JS enabled.
Expand All @@ -109,12 +109,12 @@ Feature: Test we can resort categories in the management interface.
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |

# The scenario below this is the same but with JS enabled.
Scenario: Test moving categories up and down by one.
Expand Down
44 changes: 22 additions & 22 deletions course/tests/behat/course_category_management_listing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ Feature: Course category management interface performs as expected
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |

@javascript
Scenario Outline: Sub categories are displayed correctly when resorted
Expand All @@ -289,12 +289,12 @@ Feature: Course category management interface performs as expected
And I should see category listing <cat1> before <cat2>
And I should see category listing <cat2> before <cat3>

Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |
Examples:
| sortby | cat1 | cat2 | cat3 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |

@javascript
Scenario Outline: Test courses are displayed correctly after being resorted.
Expand Down Expand Up @@ -330,16 +330,16 @@ Feature: Course category management interface performs as expected
And I should see course listing <course1> before <course2>
And I should see course listing <course2> before <course3>

Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |
Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |

@javascript
Scenario: Test course pagination
Expand Down
40 changes: 20 additions & 20 deletions course/tests/behat/course_resort.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ Feature: Test we can resort course in the management interface.
And I should see course listing <course1> before <course2>
And I should see course listing <course2> before <course3>

Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |
Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |

@javascript
Scenario Outline: Resort courses with JavaScript enabled.
Expand Down Expand Up @@ -90,16 +90,16 @@ Feature: Test we can resort course in the management interface.
And I should see course listing <course1> before <course2>
And I should see course listing <course2> before <course3>

Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |
Examples:
| sortby | course1 | course2 | course3 |
| "Sort by Course full name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
| "Sort by Course full name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
| "Sort by Course short name ascending" | "Extended social studies" | "Applied sciences" | "Social studies" |
| "Sort by Course short name descending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
| "Sort by Course ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
| "Sort by Course time created ascending" | "Social studies" | "Applied sciences" | "Extended social studies" |
| "Sort by Course time created descending" | "Extended social studies" | "Applied sciences" | "Social studies" |

Scenario: Test moving courses up and down by one.
Given the following "categories" exist:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Converting rubric score to grades
As a teacher
I need to be able to use different grade settings

Scenario Outline:
Scenario Outline: Convert rubric scores to grades.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
Expand Down
12 changes: 6 additions & 6 deletions grade/tests/behat/grade_override_letter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ Feature: Grade letters can be overridden
| <high6> | <low6> | <letter6> |

Examples:
| l1 | b1 | l2 | b2 | l3 | b3 | l4 | b4 | l5 | b5 | l6 | b6 | l7 | b7 | l8 | b8 | l9 | b9 | high1 | low1 | letter1 | high2 | low2 | letter2 | high3 | low3 | letter3 | high4 | low4 | letter4 | high5 | low5 | letter5 | high6 | low6 | letter6 |
| Z | 95 | Y | 85 | X | 75 | W | 65 | V | 55 | U | 45 | | | | | | | 100.00 % | 95.00 % | Z | 94.99 % | 85.00 % | Y | 84.99 % | 75.00 % | X | 74.99 % | 65.00 % | W | 64.99 % | 55.00 % | V | 54.99 % | 45.00 % | U |
| 5 | 100 | 4 | 80 | 3 | 60 | 2 | 40 | 1 | 20 | 0 | 0 | | | | | | | 100.00 % | 100.00 % | 5 | 99.99 % | 80.00 % | 4 | 79.99 % | 60.00 % | 3 | 59.99 % | 40.00 % | 2 | 39.99 % | 20.00 % | 1 | 19.99 % | 0.00 % | 0 |
| A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | | | | | | | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | | | | | A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | A | 95.25 | B | 76.75 | C | 50.01 | | | | | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| l1 | b1 | l2 | b2 | l3 | b3 | l4 | b4 | l5 | b5 | l6 | b6 | l7 | b7 | l8 | b8 | l9 | b9 | high1 | low1 | letter1 | high2 | low2 | letter2 | high3 | low3 | letter3 | high4 | low4 | letter4 | high5 | low5 | letter5 | high6 | low6 | letter6 |
| Z | 95 | Y | 85 | X | 75 | W | 65 | V | 55 | U | 45 | | | | | | | 100.00 % | 95.00 % | Z | 94.99 % | 85.00 % | Y | 84.99 % | 75.00 % | X | 74.99 % | 65.00 % | W | 64.99 % | 55.00 % | V | 54.99 % | 45.00 % | U |
| 5 | 100 | 4 | 80 | 3 | 60 | 2 | 40 | 1 | 20 | 0 | 0 | | | | | | | 100.00 % | 100.00 % | 5 | 99.99 % | 80.00 % | 4 | 79.99 % | 60.00 % | 3 | 59.99 % | 40.00 % | 2 | 39.99 % | 20.00 % | 1 | 19.99 % | 0.00 % | 0 |
| A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | | | | | | | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | | | | | A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | A | 95.25 | B | 76.75 | C | 50.01 | | | | | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |

Scenario: I delete a grade letter
Given I set the following fields to these values:
Expand Down
Loading

0 comments on commit 149d80e

Please sign in to comment.