mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
unified click events
separated post in post.create & post
This commit is contained in:
parent
2aaf54d60e
commit
a02a72de82
@ -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
|
||||
|
||||
@ -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
|
||||
});
|
||||
@ -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
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("I click on create post", () => {
|
||||
cy.get(".post-add-button").click();
|
||||
});
|
||||
@ -1,6 +0,0 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When(`I click on {string}`, text => {
|
||||
cy.contains(text)
|
||||
.click()
|
||||
});
|
||||
18
cypress/integration/Post.feature
Normal file
18
cypress/integration/Post.feature
Normal 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/..."
|
||||
14
cypress/integration/common/I_click_on_{string}.js
Normal file
14
cypress/integration/common/I_click_on_{string}.js
Normal 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);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user