unified click events

separated post in post.create & post
This commit is contained in:
Ulf Gebhardt 2021-04-10 20:06:57 +02:00
parent 2aaf54d60e
commit a02a72de82
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
9 changed files with 36 additions and 29 deletions

View File

@ -10,7 +10,7 @@ Feature: Authentication
Scenario: Log in
When I navigate to page "login"
And I fill in my credentials
And I click submit
And I click on "submit button"
Then I am logged in as "Peter Pan"
Scenario: Refresh and stay logged in

View File

@ -1,7 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I click submit", () => {
cy.get("button[name=submit]")
.click()
.wait(500); // This is to ensure we reach the feed
});

View File

@ -9,21 +9,14 @@ Feature: Create a post
And I navigate to page "landing"
Scenario: Create a post
When I click on create post
And I wait for 500 milliseconds
When I click on "create post button"
Then I am on page "post/create"
When I choose "My first post" as the title
And I choose the following text as content:
"""
Human Connection is a free and open-source social network
Ocelot.social is a free and open-source social network
for active citizenship.
"""
And I click on "Save"
And I wait for 500 milliseconds
And I click on "save button"
Then I am on page ".../my-first-post"
And the post was saved successfully
Scenario: See a post on the landing page
When I previously created a post
And I navigate to page "landing"
Then the post shows up on the landing page at position 1

View File

@ -1,5 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I click on create post", () => {
cy.get(".post-add-button").click();
});

View File

@ -1,6 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When(`I click on {string}`, text => {
cy.contains(text)
.click()
});

View File

@ -0,0 +1,18 @@
Feature: Create a post
As an logged in user
I would like to see a post
And to see the whole content of it
Background:
Given I have an user account
And I am logged in
And I previously created a post
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: Navigate to the Post Page
When I navigate to page "landing"
And I click on "the first post"
Then I am on page "post/..."

View File

@ -0,0 +1,14 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I click on {string}", element => {
const elementSelectors = {
'submit button': 'button[name=submit]',
'create post button': '.post-add-button',
'save button': 'button[type=submit]',
'the first post': '.post-teaser:nth-child(1)',
}
cy.get(elementSelectors[element])
.click()
.wait(750);
});