refactored "I navigated to page" step

This commit is contained in:
Ulf Gebhardt 2021-04-11 17:59:23 +02:00
parent 61e4db2819
commit 28d03d2f64
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
13 changed files with 26 additions and 29 deletions

View File

@ -11,8 +11,8 @@ Feature: Notification for a mention
Scenario: Mention another user, re-login as this user and see notifications
Given I am logged in as "wolle-aus-hamburg"
And I navigate to page "landing"
And I navigate to page "post/create"
And I navigate to page "/"
And I navigate to page "/post/create"
And I start to write a new post with the title "Hey Matt" beginning with:
"""
Big shout to our fellow contributor
@ -20,7 +20,7 @@ Feature: Notification for a mention
And mention "@matt-rider" in the text
And I click on "save button"
And I am logged in as "matt-rider"
And I navigate to page "landing"
And I navigate to page "/"
And see 1 unread notifications in the top menu
And open the notification menu and click on the first item
Then I am on page "/post/.*/hey-matt"

View File

@ -17,7 +17,7 @@ Feature: Comments on post
And I am logged in as "narrator"
Scenario: Comment creation
Given I navigate to page "post/bWBjpkTKZp/101-essays"
Given I navigate to page "/post/bWBjpkTKZp/101-essays"
And I comment the following:
"""
Ocelot.social rocks
@ -28,7 +28,7 @@ Feature: Comments on post
And the editor should be cleared
Scenario: View medium length comments
Given I navigate to page "post/bWBjpkTKZp/101-essays"
Given I navigate to page "/post/bWBjpkTKZp/101-essays"
And I type in a comment with 305 characters
And I click on "comment button"
Then my comment should be successfully created
@ -36,7 +36,7 @@ Feature: Comments on post
And the editor should be cleared
Scenario: View long comments
Given I navigate to page "post/bWBjpkTKZp/101-essays"
Given I navigate to page "/post/bWBjpkTKZp/101-essays"
And I type in a comment with 1205 characters
And I click on "comment button"
Then my comment should be successfully created
@ -44,6 +44,6 @@ Feature: Comments on post
And the editor should be cleared
Scenario: Direct reply to Comment
Given I navigate to page "post/bWBjpkTKZp/101-essays"
Given I navigate to page "/post/bWBjpkTKZp/101-essays"
And I click on "reply button"
Then it should create a mention in the CommentForm

View File

@ -8,7 +8,7 @@ Feature: Create a post
| slug | email | password | id | name | termsAndConditionsAgreedVersion |
| narrator | narrator@example.org | 1234 | narrator | Nathan Narrator | 0.0.4 |
And I am logged in as "narrator"
And I navigate to page "landing"
And I navigate to page "/"
Scenario: Create a post
When I click on "create post button"

View File

@ -11,7 +11,7 @@ Feature: Upload/Delete images on posts
| authorId | id | title | content |
| narrator | p1 | Post to be updated | successfully updated |
And I am logged in as "narrator"
And I navigate to page "landing"
And I navigate to page "/"
Scenario: Create a Post with a Teaser Image
When I click on "create post button"
@ -24,7 +24,7 @@ Feature: Upload/Delete images on posts
And the post was saved successfully with the "new" teaser image
Scenario: Update a Post to add an image
Given I navigate to page "post/edit/p1"
Given I navigate to page "/post/edit/p1"
And I should be able to "change" a teaser image
And I click on "save button"
Then I see a toaster with "Saved!"
@ -51,7 +51,7 @@ Feature: Upload/Delete images on posts
And the "new" post was saved successfully without a teaser image
Scenario: Delete existing image
Given I navigate to page "post/edit/p1"
Given I navigate to page "/post/edit/p1"
And my post has a teaser image
Then I should be able to "remove" a teaser image
And I click on "save button"

View File

@ -13,11 +13,11 @@ Feature: See a post
| aBcDeFgHiJ | previously created post | previously-created-post | id-of-peter-pan | with some content |
And I am logged in as "narrator"
Scenario: See a post on the landing page
When I navigate to page "landing"
Then the post shows up on the landing page at position 1
Scenario: See a post on the newsfeed
When I navigate to page "/"
Then the post shows up on the newsfeed at position 1
Scenario: Navigate to the Post Page
When I navigate to page "landing"
When I navigate to page "/"
And I click on "the first post"
Then I am on page "/post/.*"

View File

@ -1,6 +1,6 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("the post shows up on the landing page at position {int}", index => {
Then("the post shows up on the newsfeed at position {int}", index => {
const selector = `.post-teaser:nth-child(${index}) > .base-card`;
cy.get(selector).should("contain", 'previously created post');
cy.get(selector).should("contain", 'with some content');

View File

@ -14,7 +14,7 @@ Feature: Search
| p1 | 101 Essays that will change the way you think | 101 Essays, of course (PR)! |
| p2 | No content | will be found in this post, I guarantee |
And I am logged in as "narrator"
And I navigate to page "landing"
And I navigate to page "/"
Scenario: Search for specific words
When I search for "Essays"

View File

@ -10,7 +10,7 @@ Feature: User authentication
| peterpan@example.org | 1234 | id-of-peter-pan | Peter Pan | peter-pan | 0.0.4 |
Scenario: Log in
When I navigate to page "login"
When I navigate to page "/login"
And I fill in my credentials "peterpan@example.org" "1234"
And I click on "submit button"
Then I am logged in with username "Peter Pan"

View File

@ -13,7 +13,7 @@ Feature: User change password
| email | password | id | name | slug | termsAndConditionsAgreedVersion |
| peterpan@example.org | exposed | id-of-peter-pan | Peter Pan | peter-pan | 0.0.4 |
And I am logged in as "peter-pan"
And I navigate to page "settings"
And I navigate to page "/settings"
And I click on "security menu"
Scenario: Incorrect Old Password
@ -35,7 +35,7 @@ Feature: User change password
And I cannot submit the form
Scenario: Change my password
Given I navigate to page "settings"
Given I navigate to page "/settings"
And I click on "security menu"
When I fill the password form with:
| Your old password | exposed |

View File

@ -20,8 +20,8 @@ const savePostTitle = $post => {
})
}
Given("I see David Irving's post on the landing page", page => {
cy.openPage('landing')
Given("I see David Irving's post on the newsfeed", page => {
cy.openPage('newsfeed')
})
Given("I see David Irving's post on the post page", page => {

View File

@ -161,11 +161,11 @@ When("I click on the avatar menu in the top right corner", () => {
cy.get(".avatar-menu").click();
});
Then(/^I should see only ([0-9]+) posts? on the landing page/, postCount => {
Then(/^I should see only ([0-9]+) posts? on the newsfeed/, postCount => {
cy.get(".post-teaser").should("have.length", postCount);
});
Then("the first post on the landing page has the title:", title => {
Then("the first post on the newsfeed has the title:", title => {
cy.get(".post-teaser:first").should("contain", title);
});

View File

@ -1,8 +1,5 @@
import { Given } from "cypress-cucumber-preprocessor/steps";
Given("I navigate to page {string}", page => {
if (page === "landing") {
page = "";
}
cy.visit(`/${page}`);
cy.visit(page);
});

View File

@ -31,7 +31,7 @@ Feature: Report and Moderate
"""
Examples:
| Page |
| landing page |
| newsfeed page|
| post page |
Scenario: Report user