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

Commit

Permalink
#7 - First basic features in Gherkin
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Sokolowska committed Mar 21, 2022
1 parent e1072aa commit a301f3b
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 0 deletions.
14 changes: 14 additions & 0 deletions features/admin_panel/access_to_admin_panel.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Access to admin panel
In order to managing app
As an admin user
I want to see admin panel

Scenario: I have access to admin panel
Given I am logged in as an admin user
When I get to admin panel route
Then I should see admin panel page

Scenario: Unauthorized access
Given I am not logged in as an admin user
When I get to admin panel route
Then I should see "You do not have access"
27 changes: 27 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,27 @@
Feature:
In order to add user to admin panel
As an admin user
I want to send email to user with invitation link

Background:
Given I logged in as an admin user
And I am on the page with invitation form

Scenario Outline: Successfully send invitation
Given invited user is not an admin yet
When I fill "email" with <email>
And I send the form
Then I should see "Successfully send invitation"
And invited user should get an invitation link on <email>
Examples:
| email |
| firstuser@example.com |

Scenario Outline: Invited user already are admin
Given user with <email> already are admin user
When I fill "email" with <email>
And I send the form
Then I should see message "This user already are admin user"
Examples:
| email |
| existingadmin@example.com |
29 changes: 29 additions & 0 deletions features/admin_panel/creating_new_admin.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: Creating new admin user
In order to have access to admin panel
As a invited user
I want to be able to creating account with admin privileges

Background:
Given there are invited users:
| email |
| user@example.com |

Scenario: Invited user already have account
Given I get to authentication route by invitation link
When I log in as "[email protected]"
Then I become admin user

Scenario Outline: Successfully created an account
Given I get to authentication route by invitation link
When I fill "email" with <email>
And I fill "password" with <password>>
And I fill "name" with <name>
Then I create new account with email <email>
And I become admin user
Examples:
| email | password | name |
| user@example.com | validpassword | newadmin |
Scenario: Invitation is expired
Given Invitation was send more than 7 days ago
When I get to authentication route by invitation link
Then I should see message "Your invitation is expired"
34 changes: 34 additions & 0 deletions features/admin_panel/meetup_crud.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Feature: Meetup CRUD operations
In order to managing meetups
As a admin user
I want to be able to use CRUD operations for 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 I am logged in as admin

Scenario Outline: Creating new meetup
Given I am on the create meetup page with meetup id <id>
When I fill the "title" with <title>
And I fill the "date" with <date>
And I fill the "place" with <place>
And I fill the "language" with <language>
Then New meetup with matching data should be created
And I should see message "Meetup was created"
Examples:
| title | date | place | language |
| test meetup | 2023-02-02 10:10:10 | test place | pl |

Scenario Outline: Updating meetup
Given I am on the update meetup page
When I change the "title" with <title>
And I change the "date" with <date>
And I change the "place" with <place>
And I change the "language" with <language>
Then I should see updating meetup with matching data
And I should see message "Meetup was updated"
Examples:
| id | title | date | place | language |
| 1 | updated meetup | 2024-02-02 10:10:10 | updated place | en |
30 changes: 30 additions & 0 deletions features/admin_panel/organization_crud.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Feature: Organization CRUD operations
In order to managing organizations
As a admin user
I want to be able to use CRUD operations for organization

Background:
Given there are following organization
| id | name | description |
| 1 | example organization | existing organization |
And I am logged in as admin

Scenario Outline: Creating new organization
Given I am on the create organization page
When I fill the "name" with <name>
And I fill the "description" with <description>
Then New organization with matching data should be created
And I should see message "Organization was created"
Examples:
| name | description |
| test organization | new organization |

Scenario Outline: Updating organization
Given I am on the update organization page with organization id equals <id>
When I change the "name" with <name>
And I change the "description" with <description>
Then I should see updating organization with matching data
And I should see message "Organization was updated"
Examples:
| id | name | description |
| 1 | updated organization | updated organization |
30 changes: 30 additions & 0 deletions features/admin_panel/speakers_crud.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Feature: Speaker CRUD operations
In order to managing speakers
As a admin user
I want to be able to use CRUD operations for speakers

Background:
Given there are following speakers
| id | name | description |
| 1 | example speaker | existing speaker |
And I am logged in as admin

Scenario Outline: Creating new organization
Given I am on the create speaker page
When I fill the "name" with <name>
And I fill the "description" with <description>
Then New speaker with matching data should be created
And I should see message "Speaker was created"
Examples:
| name | description |
| test speaker | new speaker |

Scenario Outline: Updating speaker
Given I am on the update speaker page with speaker id equals <id>
When I change the "name" with <name>
And I change the "description" with <description>
Then I should see updating speaker with matching data
And I should see message "Speaker was updated"
Examples:
| id | name | description |
| 1 | updated speaker | updated speaker |
30 changes: 30 additions & 0 deletions features/authentication/login.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Feature: Logging to app

Background:
Given there are following users:
| email | password |
| existinguser@example.com | correctpassword |

Scenario Outline: attempt to log in with correct credentials
When I fill "email" with <email>
And I fill "password" with <password>
Then I have successfully logged in
Examples:
| email | password |
| existinguser@example.com | correctpassword |

Scenario Outline: attempt to log in with wrong password
When I fill "email" with <email>
And I fill "password" with <password>
Then I should see message "bad credentials"
Examples:
| email | password |
| existinguser@example.com | wrongpassword |

Scenario Outline: attempt to log in as unregistered user
When I fill "email" with <email>
And I fill "password" with <password>
Then I should see message "bad credentials"
Examples:
| email | password |
| nonexistinguser@example.com | password |
19 changes: 19 additions & 0 deletions features/authentication/register.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Register to app

Scenario Outline: Register with valid data
When I fill "email" with <email>
And I fill "password" with <password>
And I fill "name" with <name>
Then I have successfully sign up
And I should get an email on <email>
Examples:
| email | password | name |
| existinguser@example.com | correctpassword | existinguser |

Scenario: Register using existing email
Given there are following users
| email | password |
| existinguser@example.com | password |
When I fill "email" with "[email protected]"
And I fill "password" with "password"
Then I should see message "User with this email actually exist"
56 changes: 56 additions & 0 deletions features/meetup/meetup_crud.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Feature: Meetup CRUD operations
In order to managing meetup
As a meetup organizer without admin privileges
I want to be able to use CRUD operations for meetup

Background:
Given there are following meetups
| organizer_id | title | date | place | language |
| 1 | my meetup | 2023-01-01 10:10:10 | place | pl |
| 2 | foreign meetup | 2023-01-01 10:10:10 | place | pl |
And I am logged in as user with id equals "1"
And I am not an admin user

Scenario Outline: Creating new meetup
Given I am on the create meetup page
When I fill the "title" with <title>
And I fill the "date" with <date>
And I fill the "place" with <place>
And I fill the "language" with <language>
And I submit form
Then New meetup with matching data should be created
And Organizer id should be 1
And I should see message "Meetup was created"
Examples:
| title | date | place | language |
| test meetup | 2023-02-02 10:10:10 | test place | pl |

Scenario Outline: Updating meetup as organizer
Given I get to the update meetup page with organizer id equals <id>
When I change the "title" with <title>
And I change the "date" with <date>
And I change the "place" with <place>
And I change the "language" with <language>
And I submit form
Then I should see updating meetup with matching data
And I should see message "Meetup was updated"
Examples:
| id | organizer_id | title | date | place | language |
| 1 | 1 | updated meetup | 2024-02-02 10:10:10 | updated place | en |

Scenario: Updating meetup as not an organizer
When I get to the update meetup page with organizer id equals "2"
Then I should see "You do not have access"

Scenario Outline: Show meetup
When I am on the show meetup page with <id>
Then I should see meetup details
Examples:
| id | organizer_id | title | date | place | language |
| 1 | 1 | my meetup | 2023-01-01 10:10:10 | place | pl |
| 2 | 2 | foreign meetup | 2023-01-01 10:10:10 | place | pl |

Scenario: Deleting meetup as organizer
Given I get to the meetup page with organizer id equals "1"
When I click for delete meetup
Then I should see message "Meetup was deleted"

0 comments on commit a301f3b

Please sign in to comment.