From 28d03d2f64f9b8b861c78e10ac36d74462a10e95 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 11 Apr 2021 17:59:23 +0200 Subject: [PATCH] refactored "I navigated to page" step --- cypress/integration/Notification.Mention.feature | 6 +++--- cypress/integration/Post.Comment.feature | 8 ++++---- cypress/integration/Post.Create.feature | 2 +- cypress/integration/Post.Images.feature | 6 +++--- cypress/integration/Post.feature | 8 ++++---- ...he_post_shows_up_on_the_newsfeed_at_position_{int}.js} | 2 +- cypress/integration/Search.feature | 2 +- cypress/integration/User.Authentication.feature | 2 +- cypress/integration/User.ChangePassword.feature | 4 ++-- cypress/integration/common/.report.js | 4 ++-- cypress/integration/common/.steps.js | 4 ++-- cypress/integration/common/I_navigate_to_page_{string}.js | 5 +---- cypress/integration/moderation/.ReportContent.feature | 2 +- 13 files changed, 26 insertions(+), 29 deletions(-) rename cypress/integration/Post/{the_post_shows_up_on_the_landing_page_at_position_{int}.js => the_post_shows_up_on_the_newsfeed_at_position_{int}.js} (77%) diff --git a/cypress/integration/Notification.Mention.feature b/cypress/integration/Notification.Mention.feature index 5ae2296f2..d4bd8f5a8 100644 --- a/cypress/integration/Notification.Mention.feature +++ b/cypress/integration/Notification.Mention.feature @@ -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" diff --git a/cypress/integration/Post.Comment.feature b/cypress/integration/Post.Comment.feature index 6eb5f52bb..1ec0c602a 100644 --- a/cypress/integration/Post.Comment.feature +++ b/cypress/integration/Post.Comment.feature @@ -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 diff --git a/cypress/integration/Post.Create.feature b/cypress/integration/Post.Create.feature index 602c924e3..cdb3e1008 100644 --- a/cypress/integration/Post.Create.feature +++ b/cypress/integration/Post.Create.feature @@ -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" diff --git a/cypress/integration/Post.Images.feature b/cypress/integration/Post.Images.feature index ff99d320a..59cb01939 100644 --- a/cypress/integration/Post.Images.feature +++ b/cypress/integration/Post.Images.feature @@ -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" diff --git a/cypress/integration/Post.feature b/cypress/integration/Post.feature index a4f6f98ae..7a572b955 100644 --- a/cypress/integration/Post.feature +++ b/cypress/integration/Post.feature @@ -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/.*" diff --git a/cypress/integration/Post/the_post_shows_up_on_the_landing_page_at_position_{int}.js b/cypress/integration/Post/the_post_shows_up_on_the_newsfeed_at_position_{int}.js similarity index 77% rename from cypress/integration/Post/the_post_shows_up_on_the_landing_page_at_position_{int}.js rename to cypress/integration/Post/the_post_shows_up_on_the_newsfeed_at_position_{int}.js index 070d23905..3b42ea58e 100644 --- a/cypress/integration/Post/the_post_shows_up_on_the_landing_page_at_position_{int}.js +++ b/cypress/integration/Post/the_post_shows_up_on_the_newsfeed_at_position_{int}.js @@ -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'); diff --git a/cypress/integration/Search.feature b/cypress/integration/Search.feature index 91ddd8375..9ff1fe0ba 100644 --- a/cypress/integration/Search.feature +++ b/cypress/integration/Search.feature @@ -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" diff --git a/cypress/integration/User.Authentication.feature b/cypress/integration/User.Authentication.feature index aaa7e1415..db7680bd4 100644 --- a/cypress/integration/User.Authentication.feature +++ b/cypress/integration/User.Authentication.feature @@ -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" diff --git a/cypress/integration/User.ChangePassword.feature b/cypress/integration/User.ChangePassword.feature index 5e275c1df..582d56149 100644 --- a/cypress/integration/User.ChangePassword.feature +++ b/cypress/integration/User.ChangePassword.feature @@ -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 | diff --git a/cypress/integration/common/.report.js b/cypress/integration/common/.report.js index 4c6d2f6c3..b8a199967 100644 --- a/cypress/integration/common/.report.js +++ b/cypress/integration/common/.report.js @@ -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 => { diff --git a/cypress/integration/common/.steps.js b/cypress/integration/common/.steps.js index e7331fa36..541c5f04c 100644 --- a/cypress/integration/common/.steps.js +++ b/cypress/integration/common/.steps.js @@ -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); }); diff --git a/cypress/integration/common/I_navigate_to_page_{string}.js b/cypress/integration/common/I_navigate_to_page_{string}.js index f0ecb2065..aa929c80a 100644 --- a/cypress/integration/common/I_navigate_to_page_{string}.js +++ b/cypress/integration/common/I_navigate_to_page_{string}.js @@ -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); }); \ No newline at end of file diff --git a/cypress/integration/moderation/.ReportContent.feature b/cypress/integration/moderation/.ReportContent.feature index be1a07786..90a203c9c 100644 --- a/cypress/integration/moderation/.ReportContent.feature +++ b/cypress/integration/moderation/.ReportContent.feature @@ -31,7 +31,7 @@ Feature: Report and Moderate """ Examples: | Page | - | landing page | + | newsfeed page| | post page | Scenario: Report user