Skip to content

Commit

Permalink
Merge pull request #505 from jhedstrom/504-gherkin-lint
Browse files Browse the repository at this point in the history
Add gherkin-lint to the build process.
  • Loading branch information
jhedstrom committed Sep 4, 2018
2 parents d8fcc7c + a9e16b9 commit c4cee77
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 88 deletions.
1 change: 1 addition & 0 deletions .gherkin-lintignore
@@ -0,0 +1 @@
features/i18n/*/*.feature
36 changes: 36 additions & 0 deletions .gherkin-lintrc
@@ -0,0 +1,36 @@
{
"no-files-without-scenarios" : "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-dupe-scenario-names": "on",
"no-dupe-feature-names": "on",
"no-partially-commented-tag-lines": "on",
"indentation": [
"on", {
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4
}
],
"no-trailing-spaces": "on",
"new-line-at-eof": ["on", "yes"],
"no-multiple-empty-lines": "on",
"no-empty-file": "on",
"no-scenario-outlines-without-examples": "on",
"name-length": [
"on", {
"Feature": 100,
"Scenario": 120,
"Step": "off"
}
],
"no-restricted-tags": ["on", {"tags": ["@watch", "@wip"]}],
"use-and": "on",
"no-duplicate-tags": "on",
"no-superfluous-tags": "on",
"no-homogenous-tags": "off",
"one-space-between-tags": "on"
}
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,4 +4,5 @@ composer.lock
vendor
/drupal*
behat.yml
/package-lock.json
/node_modules
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -43,6 +43,7 @@
"parallel-lint src spec features fixtures",
"phpcs --standard=./phpcs-ruleset.xml -p",
"phpcs --standard=./phpcs-drupal-ruleset.xml -p",
"npm test",
"phpspec run -f pretty --no-interaction"
]
},
Expand Down
45 changes: 10 additions & 35 deletions features/api.feature
@@ -1,5 +1,5 @@
@api
Feature: DrupalContext
Feature: DrupalContext general testing
In order to prove the Drupal context is working properly
As a developer
I need to use the step definitions of this context
Expand All @@ -13,33 +13,19 @@ Feature: DrupalContext
Then I should see the text "Member for"

@drushTest @d7
Scenario: Target links within table rows
Scenario: Target links within table rows for Drush and Drupal 7
Given I am logged in as a user with the "administrator" role
When I am at "admin/structure/types"
And I click "manage fields" in the "Article" row
Then I should be on "admin/structure/types/manage/article/fields"
And I should see text matching "Add new field"

@d8
Scenario: Target links within table rows
Given I am logged in as a user with the "administrator" role
When I am at "admin/structure/types"
And I click "Manage fields" in the "Article" row
Then I should be on "admin/structure/types/manage/article/fields"
And I should see text matching "Add field"

@drushTest @d7
Scenario: Find a heading in a region
Scenario: Find a heading in a region for Drupal 7
Given I am not logged in
When I am on the homepage
Then I should see the heading "User login" in the "left sidebar" region

@d8
Scenario: Find a heading in a region
Given I am not logged in
When I am on the homepage
Then I should see the heading "Search" in the "left sidebar" region

@drushTest @d7 @d8
Scenario: Clear cache
Given the cache has been cleared
Expand Down Expand Up @@ -104,7 +90,7 @@ Feature: DrupalContext
Then I should see the link "Joe User"

@d7
Scenario: Create users with roles
Scenario: Create users with roles for Drupal 7
Given users:
| name | mail | roles |
| Joe User | joe@example.com | administrator |
Expand All @@ -114,17 +100,6 @@ Feature: DrupalContext
Then I should see the text "administrator" in the "Joe User" row
And I should not see the text "administrator" in the "Jane User" row

@d8
Scenario: Create users with roles
Given users:
| name | mail | roles |
| Joe User | joe@example.com | administrator |
| Jane User | jane@example.com | |
And I am logged in as a user with the "administrator" role
When I visit "admin/people"
Then I should see the text "Administrator" in the "Joe User" row
And I should not see the text "administrator" in the "Jane User" row

@d7 @d8
Scenario: Login as a user created during this scenario
Given users:
Expand All @@ -140,7 +115,7 @@ Feature: DrupalContext
Then I should see the heading "My tag"

@d7
Scenario: Create many terms
Scenario: Create many terms for Drupal 7
Given "tags" terms:
| name |
| Tag one |
Expand All @@ -151,7 +126,7 @@ Feature: DrupalContext
And I should see "Tag two"

@d8
Scenario: Create many terms
Scenario: Create many terms for Drupal 8
Given "tags" terms:
| name |
| Tag one |
Expand All @@ -162,7 +137,7 @@ Feature: DrupalContext
And I should see "Tag two"

@d7
Scenario: Create terms using vocabulary title rather than machine name.
Scenario: Create terms using vocabulary title rather than machine name for Drupal 7.
Given "Tags" terms:
| name |
| Tag one |
Expand All @@ -173,7 +148,7 @@ Feature: DrupalContext
And I should see "Tag two"

@d8
Scenario: Create terms using vocabulary title rather than machine name.
Scenario: Create terms using vocabulary title rather than machine name for Drupal 8.
Given "Tags" terms:
| name |
| Tag one |
Expand Down Expand Up @@ -248,7 +223,7 @@ Feature: DrupalContext
Then I should see the link "Joe User"

@d7
Scenario: Term hooks are functioning
Scenario: Term hooks are functioning for Drupal 7
Given "tags" terms:
| Label |
| Tag one |
Expand All @@ -259,7 +234,7 @@ Feature: DrupalContext
And I should see "Tag two"

@d8
Scenario: Term hooks are functioning
Scenario: Term hooks are functioning for Drupal 8
Given "tags" terms:
| Label |
| Tag one |
Expand Down
6 changes: 3 additions & 3 deletions features/api_background.feature
@@ -1,5 +1,5 @@
@d6 @d7 @d8 @api
Feature: DrupalContext
Feature: DrupalContext with background steps
Test DrupalContext in combination with Backgrounds

Background:
Expand All @@ -8,12 +8,12 @@ Feature: DrupalContext
| Tag one |
| Tag two |

Given users:
And users:
| name |
| User one |
| User two |

Given "article" content:
And "article" content:
| title |
| Node one |
| Node two |
Expand Down
36 changes: 18 additions & 18 deletions features/blackbox.feature
Expand Up @@ -68,21 +68,21 @@ Feature: Test DrupalContext
And I should see the "div" element with the "class" attribute set to "class3" in the "left header" region

Scenario: Error messages
Given I am on "user.html"
When I press "Log in"
Then I should see the error message "Password field is required"
And I should not see the error message "Sorry, unrecognized username or password"
And I should see the following error messages:
| error messages |
| Username or email field is required. |
| Password field is required |
And I should not see the following error messages:
| error messages |
| Sorry, unrecognized username or password |
| Unable to send e-mail. Contact the site administrator if the problem persists |

@javascript
Scenario: Zombie driver is functional
Given I am on the homepage
When I click "Download & Extend"
Then I should see the link "Distributions"
Given I am on "user.html"
When I press "Log in"
Then I should see the error message "Password field is required"
And I should not see the error message "Sorry, unrecognized username or password"
And I should see the following error messages:
| error messages |
| Username or email field is required. |
| Password field is required |
And I should not see the following error messages:
| error messages |
| Sorry, unrecognized username or password |
| Unable to send e-mail. Contact the site administrator if the problem persists |

@javascript
Scenario: Zombie driver is functional
Given I am on the homepage
When I click "Download & Extend"
Then I should see the link "Distributions"
11 changes: 2 additions & 9 deletions features/d6.feature
Expand Up @@ -3,40 +3,34 @@ Feature: Environment check

Scenario: Frontpage
Given I am not logged in
And I am on the homepage
And I am on the homepage
Then I should see "User login"

Scenario: assertAnonymousUser
Given I am an anonymous user

@api
Scenario: assertAuthenticatedByRole
Given I am logged in as a user with the "authenticated" role

@api
Scenario: assertAuthenticatedByRoleWithGivenFields
Given I am logged in as a user with the "authenticated" role and I have the following fields:
| name | test |

@api
Scenario: createNode
Given I am viewing a story with the title "test"
Then I should see "test"

@api
Scenario: createNodes
Given article content:
| title | author | status | created |
| My title | Joe Editor | 1 | 2014-10-17 8:00am |
When I am viewing a content with the title "My title"
Then I should see "My title"

@api
Scenario: createTerm
Given I am viewing a tags term with the name "example tag"
Then I should see "example tag"

@api
Scenario: createUsers
Given I am logged in as a user with the "administer users" permission
And users:
Expand All @@ -45,9 +39,8 @@ Feature: Environment check
| user bar | baz@bar.com |
When I visit "admin/user/user"
Then I should see "user foo"
And I should see "user bar"
And I should see "user bar"

@api
Scenario: create node with terms.
Given tags terms:
| name |
Expand Down
10 changes: 5 additions & 5 deletions features/d8.feature
@@ -1,22 +1,22 @@
@d8 @api
Feature: DrupalContext
Feature: DrupalContext for Drupal 8
In order to prove the Drupal context is working properly for Drupal 8
As a developer
I need to use the step definitions of this context

Scenario: Create and log in as a user
Scenario: Create and log in as a user for Drupal 8
Given I am logged in as a user with the "authenticated user" role
When I click "My account"
Then I should see the text "Member for"

Scenario: Target links within table rows
Scenario: Target links within table rows for Drupal 8
Given I am logged in as a user with the "administrator" role
When I am at "admin/structure/types"
And I click "Manage fields" in the "Article" row
Then I should be on "admin/structure/types/manage/article/fields"
And I should see the link "Add field"

Scenario: Create users with roles
Scenario: Create users with roles for Drupal 8
Given users:
| name | mail | roles |
| Joe User | joe@example.com | Administrator |
Expand All @@ -26,7 +26,7 @@ Feature: DrupalContext
Then I should see the text "Administrator" in the "Joe User" row
And I should not see the text "administrator" in the "Jane Doe" row

Scenario: Find a heading in a region
Scenario: Find a heading in a region for Drupal 8
Given I am not logged in
When I am on the homepage
Then I should see the heading "Search" in the "left sidebar" region
Expand Down
12 changes: 6 additions & 6 deletions features/drush.feature
Expand Up @@ -7,15 +7,15 @@ Feature: Drush-specific steps
Scenario: drush command with text matching: drush output correct status
Given I run drush "st"
Then drush output should contain "Drupal version"
Then drush output should contain "Site URI"
Then drush output should match "/.*Site\sURI\s+:.*/"
Then drush output should contain "Database driver"
Then drush output should contain "Successful"
Then drush output should not contain "NonExistantWord"
And drush output should contain "Site URI"
And drush output should match "/.*Site\sURI\s+:.*/"
And drush output should contain "Database driver"
And drush output should contain "Successful"
And drush output should not contain "NonExistantWord"

Scenario: drush command with arguments: re-enable toolbar
Given I run drush "en" "toolbar -y"
And I run drush "en" "toolbar -y"
And I run drush "en" "toolbar -y"
Then drush output should contain "toolbar is already enabled."

Scenario: Create and view a node with fields using the Drush driver
Expand Down
2 changes: 1 addition & 1 deletion features/field_handlers.feature
Expand Up @@ -134,7 +134,7 @@ Feature: FieldHandlers
But I should not see the link "Tag three"
And I should see "Page one"
And I should see "Page two"
But I should not see "Page three"
And I should not see "Page three"
And I should see "Belgium"
And I should see "Brussel"
And I should see "1000"
Expand Down
1 change: 0 additions & 1 deletion features/mail.feature
Expand Up @@ -49,7 +49,6 @@ Feature: MailContext
| subject |
| test 1 |


Scenario: No mail is sent
Then no mail has been sent

Expand Down
4 changes: 2 additions & 2 deletions features/messages.feature
Expand Up @@ -7,13 +7,13 @@ Feature: Ensure that messages are working properly on local installs
Given I am on "/user/login"
When I fill in "a fake user" for "Username"
And I fill in "a fake password" for "Password"
When I press "Log in"
And I press "Log in"
Then I should see the error message "Unrecognized username or password"

@javascript
Scenario: JS messages
Given I am on "/user/login"
When I fill in "a fake user" for "Username"
And I fill in "a fake password" for "Password"
When I press "Log in"
And I press "Log in"
Then I should see the error message "Unrecognized username or password"

0 comments on commit c4cee77

Please sign in to comment.