Skip to content

Commit

Permalink
behat: activate js tests (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil committed May 7, 2020
1 parent 6ba123d commit fe374e4
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 93 deletions.
1 change: 1 addition & 0 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ default:
- App\Tests\Behat\UserPlanningContext
- Behat\MinkExtension\Context\MinkContext
- PantherExtension\Context\PantherContext
- PantherExtension\Context\WaitContext:
extensions:
PantherExtension\Extension\PantherExtension: ~
Behat\MinkExtension:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/symfony-extension": "^2.1",
"friendsofphp/php-cs-fixer": "^2.16",
"guikingone/panther-extension": "^0.3.1",
"guikingone/panther-extension": "^0.4.0",
"hautelook/alice-bundle": "^2.7",
"mheap/phpunit-github-actions-printer": "^1.2",
"phpstan/phpstan-doctrine": "^0.12.8",
Expand Down
16 changes: 9 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions features/organization/assets.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Feature:
When I go to "/organizations/202/assets"
Then the response status code should be 403

# todo: add some properties in asset_type fixtures
Scenario Outline: As an authenticated parent organization, I can add an asset on my organization or children organizations
Given I am authenticated as "<login>"
When I go to "/organizations/203/assets"
Expand Down Expand Up @@ -84,7 +83,7 @@ Feature:
And the "commissionable_asset_name" field should contain "new name"
Examples:
| login |
# todo: there is a bug when using parent organization
# todo: there is a bug when using parent organization: https://github.com/crf-devs/resop/issues/360
# | DT75 |
| UL 01-02 |

Expand All @@ -110,19 +109,19 @@ Feature:
And I press "Je me connecte"
Then I should be on "/organizations/"

# @javascript
# Scenario: As a parent organization, I can delete an asset from my organization or children organizations
# Given I am authenticated as "DT75"
# And I go to "/organizations/203/assets"
# Then I should be on "/organizations/203/assets/"
# And I should see "75012"
# When I follow "Supprimer"
# And I wait for the element "#modal-delete-asset" to load
# Then I should see "Vous êtes sur le point de supprimer le véhicule VPSP - 75012"
# When I press "Supprimer"
# Then I should be on "/organizations/203/assets/"
# And I should see "Le véhicule a été supprimé avec succès."
# And I should not see "75012"
@javascript
Scenario: As a parent organization, I can delete an asset from my organization or children organizations
Given I am authenticated as "DT75"
And I go to "/organizations/203/assets"
Then I should be on "/organizations/203/assets/"
And I should see "75012"
When I follow "Supprimer"
And I wait for "#delete-item-modal" to be visible
Then I should see "Vous êtes sur le point de supprimer le véhicule suivant et toutes ses disponibilités : VPSP - 75012"
When I press "Supprimer"
Then I should be on "/organizations/203/assets/"
And I should see "Le véhicule a été supprimé avec succès."
And I should not see "75012"

#https://github.com/crf-devs/resop/issues/348
# Scenario: As a parent organization, I cannot directly delete an asset from my organization
Expand Down
4 changes: 2 additions & 2 deletions features/organization/forecast.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Feature:
Given I am authenticated as "DT75"
And I am on "/organizations/forecast"
When I click on "#availableRange"
Then the ".daterangepicker" should be visible
Then I wait for ".daterangepicker" to be visible
When I click on ".daterangepicker .left table tbody td[data-title=r1c0]"
And I click on ".daterangepicker .left table tbody td[data-title=r1c6]"
And I press "Valider"
Then the ".daterangepicker" should not be visible
Then I wait for ".daterangepicker" to be invisible
When I press "Calculer"
Then I should be on "/organizations/forecast"
And I should not see "Choisissez une plage horaire pour calculer les équipages possibles."
Expand Down
103 changes: 51 additions & 52 deletions features/organization/mission_type.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ Feature:
And I should not see "Mission type DT77 1"
And I should not see "Mission type DT77 2"

# @javascript
# Scenario: As an organization, I can create a mission type
# Given I am authenticated as "DT75"
# And I am on "/organizations/mission_type/"
# When I follow "Ajouter un nouveau type de mission"
# Then I should be on "/organizations/mission_type/new"
# When I press "Ajouter un type de bénévole"
# And I press "Ajouter un type de véhicule"
# And I fill in the following:
# | mission_type[name] | mission type name |
# | mission_type[minimumAvailableHours] | 2 |
# | mission_type[userSkillsRequirement][0][skill] | ci_bspp |
# | mission_type[userSkillsRequirement][0][number] | 3 |
# | mission_type[assetTypesRequirement][0][type] | VPSP |
# | mission_type[assetTypesRequirement][0][number] | 4 |
# And I press "Enregistrer"
# Then I should be on "/organizations/mission_type/"
# And I should see "mission type name"
# When I follow the last "Modifier"
# Then the "mission_type_name" field should contain "mission type name"
# And the "mission_type_minimumAvailableHours" field should contain "2"
# And the "mission_type_userSkillsRequirement_0_skill" field should contain "ci_bspp"
# And the "mission_type_userSkillsRequirement_0_number" field should contain "3"
# And the "mission_type_assetTypesRequirement_0_type" field should contain "302"
# And the "mission_type_assetTypesRequirement_0_number" field should contain "4"
@javascript
Scenario: As an organization, I can create a mission type
Given I am authenticated as "DT75"
And I am on "/organizations/mission_type/"
When I follow "Ajouter un nouveau type de mission"
Then I should be on "/organizations/mission_type/new"
When I press "Ajouter un type de bénévole"
And I press "Ajouter un type de véhicule"
And I fill in the following:
| mission_type[name] | mission type name |
| mission_type[minimumAvailableHours] | 2 |
| mission_type[userSkillsRequirement][0][skill] | ci_bspp |
| mission_type[userSkillsRequirement][0][number] | 3 |
| mission_type[assetTypesRequirement][0][type] | VPSP |
| mission_type[assetTypesRequirement][0][number] | 4 |
And I press "Enregistrer"
Then I should be on "/organizations/mission_type/"
And I should see "mission type name"
When I follow the last "Modifier"
Then the "mission_type_name" field should contain "mission type name"
And the "mission_type_minimumAvailableHours" field should contain "2"
And the "mission_type_userSkillsRequirement_0_skill" field should contain "ci_bspp"
And the "mission_type_userSkillsRequirement_0_number" field should contain "3"
And the "mission_type_assetTypesRequirement_0_type" field should contain "302"
And the "mission_type_assetTypesRequirement_0_number" field should contain "4"

@javascript
Scenario: As an organization, I cannot create a mission type with duplicate requirements
Expand Down Expand Up @@ -71,39 +71,38 @@ Feature:
And I should see "Au moins une compétence de bénévole est dupliquée"
And I should see "Au moins un type de véhicule est dupliqué"

# # todo: this form has a buggy behavior: https://github.com/crf-devs/resop/issues/361
# @javascript
# Scenario: As an organization, I can edit a mission type
# Given I am authenticated as "DT75"
# And I am on "/organizations/mission_type/"
# When I follow "Modifier"
# Then I should be on "/organizations/mission_type/751/edit"
# When I fill in the following:
# | mission_type[name] | mission type name |
# | mission_type[userSkillsRequirement][0][skill] | ci_bspp |
# And I press "delete_mission_type_userSkillsRequirement_1"
# And I press "Enregistrer"
# Then I should be on "/organizations/mission_type/"
# And I should see "mission type name"
# When I follow "Modifier"
# And I should see "CI Réseau BSPP"
@javascript
Scenario: As an organization, I can edit a mission type
Given I am authenticated as "DT75"
And I am on "/organizations/mission_type/"
When I follow "Modifier"
Then I should be on "/organizations/mission_type/751/edit"
When I fill in the following:
| mission_type[name] | mission type name |
| mission_type[userSkillsRequirement][0][skill] | ci_bspp |
And I press "delete_mission_type_userSkillsRequirement_1"
And I press "Enregistrer"
Then I should be on "/organizations/mission_type/"
And I should see "mission type name"
When I follow "Modifier"
And I should see "CI Réseau BSPP"

Scenario: As an organization, I cannot edit a mission type of another organization
Given I am authenticated as "DT75"
And I am on "/organizations/mission_type/771/edit"
Then the response status code should be 403

# @javascript
# Scenario: As an organization, I can delete a mission type
# Given I am authenticated as "DT75"
# And I am on "/organizations/mission_type/"
# When I press "Supprimer"
# Then I should see "Vous êtes sur le point de supprimer le type de mission : Mission type DT75 1"
# When I press "Supprimer"
# Then the response status code should be 200
# And I should be on "/organizations/mission_type/"
# And I should not see "Le type de mission a été supprimé avec succès "
# And I should not see "Mission type DT75 1"
@javascript
Scenario: As an organization, I can delete a mission type
Given I am authenticated as "DT75"
And I am on "/organizations/mission_type/"
When I follow "Supprimer"
And I wait for "#delete-item-modal" to be visible
Then I should see "Vous êtes sur le point de supprimer l'élément : Mission type DT75 1."
When I press "Supprimer"
Then I should be on "/organizations/mission_type/"
And I should see "Le type de mission a été supprimé avec succès "
And I should not see "Mission type DT75 1"

Scenario: As an organization, I cannot delete a mission type of another organization
Given I am authenticated as "DT75"
Expand Down
32 changes: 16 additions & 16 deletions features/organization/users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ Feature:
Given I am authenticated as "DT75"
When I go to "/organizations/204/users/103/edit"
Then the response status code should be 403
#
# @javascript
# Scenario Outline: As an admin of an organization, I can delete a user from my organization or children organizations
# Given I am authenticated as "<login>"
# When I go to "/organizations/3/users"
# And I press "Supprimer"
# Then I should see "Vous êtes sur le point de supprimer le bénévole : Jill DOE ( 990003A ) et toutes ses disponibilités."
# When I press "Supprimer"
# Then I should be on "/organizations/3/users"
# And the response status code should be 200
# And I should see "Le bénévole a été supprimé avec succès."
# And I should not see "[email protected]"
# Examples:
# | login |
# | [email protected] |
# | [email protected] |

@javascript
Scenario Outline: As an organization, I can delete a user from my organization or children organizations
Given I am authenticated as "<login>"
When I go to "/organizations/203/users"
And I follow "Supprimer"
And I wait for "#delete-item-modal" to be visible
Then I should see "Vous êtes sur le point de supprimer le bénévole suivant et toutes ses disponibilités : Jane DOE ( 990002A )."
When I press "Supprimer"
Then I should be on "/organizations/203/users/"
And I should see "Le bénévole a été supprimé avec succès."
And I should not see "[email protected]"
Examples:
| login |
| DT75 |
| UL 01-02 |
#
# Scenario: As an admin of an organization, I cannot directly delete a user from my organization
# Given I am authenticated as "[email protected]"
Expand Down

0 comments on commit fe374e4

Please sign in to comment.