Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

#7 - behat tests #45

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
17 changes: 17 additions & 0 deletions features/admin_panel/access_to_admin_panel.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Access to the admin panel

Scenario: Successfully have access to admin panel
Given the administrator is logged in
When the administrator is on the admin panel route
Then the administrator should see the admin panel page

Scenario: Attempt to get to admin panel as authenticated non-administrator user
Given the user is logged in
But the user is not an administrator
When the user is on the admin panel route
Then the user should see "You are not allowed to access this page"

Scenario: Attempt to get to admin panel as unauthenticated user
Given the user is logged in
When the user is on the admin panel route
Then the user should be redirected to the login page
35 changes: 35 additions & 0 deletions features/admin_panel/adding_user_to_admin_panel.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Feature: Adding a user to admin panel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be good to add unhappy paths scenarios (what happen if email will be empty or invalid).


Background:
Given the administrator is logged in
And the administrator is on the page with invitation form

Scenario Outline: Successfully send invitation to unregistered user
Given the invited user doesn't have an account
When the administrator fills in "email" with "<email>"
And the administrator sends the form
Then the administrator should see "Successfully send invitation"
And the invited user should get an invitation link on "<email>"
Examples:
| email |
| [email protected] |
mtracz marked this conversation as resolved.
Show resolved Hide resolved

Scenario Outline: The invited user is already an administrator
Given the user with "<email>" email address is already an administrator
When the administrator fills in "email" with "<email>"
And the administrator sends the form
Then the administrator should see the message "This user is already an administrator"
Examples:
| email |
| [email protected] |

Scenario Outline: Successfully send invitation to already registered user
Given There is a user with "<email>" email address
And the invited user is not an administrator yet
When the administrator fills in "email" with "<email>"
And the administrator sends the form
Then the administrator should see "Successfully send invitation"
And invited user should get an invitation link on "<email>"
Examples:
| email |
| [email protected] |
24 changes: 24 additions & 0 deletions features/admin_panel/creating_new_admin.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Creating a admin user

Background:
Given there are invited users:
| email |
| [email protected] |

Scenario: The invited user already have account
Given the invited user is on the authentication route by invitation link
When the invited user logs in as "<email>"
Then the invited user becomes admin user

Scenario Outline: Successfully created an account
Given the invited user is on the authentication route by invitation link
When the invited user registers with "<email>" email addrress
Then new administrator with email "<email>" should be created
Examples:
| email |
| [email protected] |

Scenario: The invitation has expired
Given the invitation was send more than 7 days ago
When the invited user is on the authentication route by invitation link
Then the invited user should see message "Your invitation is expired"
28 changes: 28 additions & 0 deletions features/admin_panel/meetup/create.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Feature: Creating a meetup

Background:
Given the administrator is logged in
And the administrator is on the create meetup page

Scenario Outline: Successfully creating a meetup
When the administrator fills in "title" with "<title>"
And the administrator fills in "date" with "<date>"
And the administrator fills in "place" with "<place>"
And the administrator fills in "language" with "<language>"
And the administrator submits the form
Then the meetup with following data should be created:
| title | <title> |
| date | <date> |
| place | <place> |
| language | <language> |
And the administrator should see the message "Meetup succesfully created"
Examples:
| title | date | place | language |
| test meetup | 2023-02-02 10:10:10 | test place | pl |

Scenario: Attempt to create a meetup without credentials
When the administrator sends the form
Then the administrator should see the message "Title field is required"
And the administrator should see the message "Date field are required"
And the administrator should see the message "Place field are required"
And the administrator should see the message "Language field are required"
15 changes: 15 additions & 0 deletions features/admin_panel/meetup/delete.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Deleting a meetup

Background:
Given there are following meetups:
| id | title | date | place | language |
| 1 | example meetup | 2023-01-01 10:10:10 | example place | pl |
And the administrator is logged in

Scenario Outline: Successfully deleting a meetup
Given the administrator is on the deleting meetup page with meetup id <id>
Anna-Sokolowska marked this conversation as resolved.
Show resolved Hide resolved
When the administrator clicks on the delete meetup button
Then the administrator should see the message "Meetup successfully deleted"
Examples:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need table "examples", if we have only one example?

| id |
| 1 |
24 changes: 24 additions & 0 deletions features/admin_panel/meetup/show.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Showing a meetup

Background:
Given there are following meetups
| id | title | date | place | language |
| 1 | example meetup | 2023-01-01 10:10:10 | example place | pl |
And the administrator is logged in

Scenario Outline: Successfully showing a meetup
Given the administrator is on the showing meetup page with meetup id "<id>"
Then the administrator should see "title" with "<title>"
And the administrator should see "date" with "<date>"
And the administrator should see "place" with "<place>"
And the administrator should see "language" with "<language>"
Examples:
| id | title | date | place | language |
| 1 | example meetup | 2023-01-01 10:10:10 | example place | pl |

Scenario Outline: Attempt to show a meetup which does not exist
When the administrator get to the show meetup page with id equals "<id>
Anna-Sokolowska marked this conversation as resolved.
Show resolved Hide resolved
Then the administrator should see the message "Page not found"
Examples:
| id |
| 999 |
65 changes: 65 additions & 0 deletions features/admin_panel/meetup/update.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Feature: Updating a meetup

Background:
Given there are following meetups
| id | title | date | place | language |
| 1 | example meetup | 2023-01-01 10:10:10 | example place | pl |
And the administrator is logged in

Scenario Outline: Successfully updating a meetup title
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator fills in "title" with "<title>"
And the administrator sends the form
Then the administrator should see message "Meetup successfully updated"
And the administrator should see "title" matches "<title>"
Examples:
| id | title |
| 1 | updated meetup |

Scenario Outline: Successfully updating a meetup date
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator fills in "date" with "<date>"
And the administrator sends the form
Then the administrator should see message "Meetup successfully updated"
And the administrator should see "date" matches "<date>"
Examples:
| id | date |
| 1 | 2024-02-02 10:10:10 |

Scenario Outline: Successfully updating a meetup place
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator fills in "place" with "<place>"
And the administrator sends the form
Then the administrator should see message "Meetup successfully updated"
And the administrator should see "place" matches "<place>"
Examples:
| id | place |
| 1 | updated place |

Scenario Outline: Successfully updating a meetup language
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator fills in "language" with "<language>"
And the administrator sends the form
Then the administrator should see message "Meetup successfully updated"
And the administrator should see "language" matches "<language>"
Examples:
| id | language |
| 1 | en |

Scenario Outline: Attempt to update a meetup without credentials
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator sends the form
Then the administrator should see the message "Title field is required"
And the administrator should see the message "Date field are required"
And the administrator should see the message "Place field are required"
And the administrator should see the message "Language field are required"
Examples:
| id |
| 1 |

Scenario Outline: Attempt to update a meetup which does not exist
When the administrator get to the update meetup page with id equals "<id>"
Then the administrator should see the message "Page not found"
Examples:
| id |
| 999 |
22 changes: 22 additions & 0 deletions features/admin_panel/organization/create.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Creating an organization

Background:
Given the administrator is logged in
And the administrator is on the create organization page

Scenario Outline: Successfully creating an organization
When the administrator fills in "name" with "<name>"
And the administrator fills in "description" with "<description>"
And the administrator sends the form
Then the organization with following data should be created:
| name | <name> |
| description | <description> |

And the administrator should see the message "Organization successfully created"
Examples:
| name | description |
| test organization | new organization |

Scenario: Attempt to create an organization without credentials
When the administrator sends the form
Then the administrator should see the message "Name field is required"
15 changes: 15 additions & 0 deletions features/admin_panel/organization/delete.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Deleting an organization

Background:
Given there are following organizations:
| id | name | description |
| 1 | example organization | existing organization |
And the administrator is logged in

Scenario Outline: Successfully deleting an organization
Given the administrator is on the deleting organization page with organization id <id>
When the administrator clicks on the delete organization button
Then the administrator should see the message "Organization successfully deleted"
Examples:
| id |
| 1 |
22 changes: 22 additions & 0 deletions features/admin_panel/organization/show.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Showing an organization

Background:
Given there are following organizations:
| id | name | description |
| 1 | example organization | existing organization |
And the administrator is logged in

Scenario Outline: Successfully showing an organization
Given the administrator is on the showing organization page with organization id <id>
Then the administrator should see "name" with "<name>"
And the administrator should see "description" with "<description>"
Examples:
| id | name | description |
| 1 | example organization | existing organization |

Scenario Outline: Attempt to show an organization which does not exist
When the administrator get to the show organization page with id equals "<id>
Then the administrator should see the message "Page not found"
Examples:
| id |
| 999 |
32 changes: 32 additions & 0 deletions features/admin_panel/organization/update.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Updating an organization

Background:
Given there are following organizations:
| id | name | description |
| 1 | example organization | existing organization |
And the administrator is logged in

Scenario Outline: Successfully updating an organization name
Given the administrator is on the update meetup page with id equals "<id>"
When the administrator fills in "name" with "<name>"
And the administrator sends the form
Then the administrator should see the message "Organization successfully updated"
And the administrator should see "name" matches "<name>"
Examples:
| id | name |
| 1 | updated organization |

Scenario Outline: Attempt to update an organization without credentials
Given the administrator is on the update organization page with id equals "<id>"
When the administrator sends the form
Then the administrator should see the message "Name field is required"
Examples:
| id |
| 1 |

Scenario Outline: Attempt to update an organization which does not exist
When the administrator get to the update organization page with id equals "<id>"
Then the administrator should see the message "Page not found"
Examples:
| id |
| 999 |
21 changes: 21 additions & 0 deletions features/admin_panel/speakers/create.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Creating a speaker

Background:
Given the administrator is logged in
And the administrator is on the create speaker page

Scenario Outline: Successfully creating a speaker
When the administrator fills in "name" with "<name>"
And the administrator fills in "description" with "<description>"
And the administrator submits the form
Then the speaker with following data should be created:
| name | <name> |
| description | <description> |
And the administrator should see the message "Speaker successfully created"
Examples:
| name | description |
| test speaker | new speaker |

Scenario: Attempt to create a speaker without credentials
When the administrator sends the form
Then the administrator should see the message "name field is required"
15 changes: 15 additions & 0 deletions features/admin_panel/speakers/delete.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Deleting a speaker

Background:
Given there are following speakers:
| id | name | description |
| 1 | example speaker | existing speaker |
And the administrator is logged in

Scenario Outline: Successfully deleting a speaker
Given the administrator is on the deleting speaker page with meetup id <id>
When the administrator clicks on the delete speaker button
Then the administrator should see the message "Speaker successfully deleted"
Examples:
| id |
| 1 |
22 changes: 22 additions & 0 deletions features/admin_panel/speakers/show.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Showing a speaker

Background:
Given there are following speakers
| id | name | description |
| 1 | example speaker | existing speaker |
And the administrator is logged in

Scenario Outline: Successfully showing a speaker
Given the administrator is on the showing speaker page with speaker id <id>
Then the administrator should see "name" with "<name>"
And the administrator should see "description" with "<description>"
Examples:
| id | name | description |
| 1 | example speaker | existing speaker |

Scenario Outline: Attempt to show a speaker which does not exist
When the administrator get to the show speaker page with id equals "<id>"
Then the administrator should see the message "Page not found"
Examples:
| id |
| 999 |
Loading