mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Changed comments to be four times as long (was 300, now 1200 characters) before they are hidden behind show more. Added two tests, one to make sure comments of length > 300 but < 1200 are fully visible, and another to check that comments > 1200 characters are hidden.
This commit is contained in:
parent
65988ea0a1
commit
08f4d5f0d7
@ -3,6 +3,14 @@ import { When, Then } from "cypress-cucumber-preprocessor/steps";
|
|||||||
const narratorAvatar =
|
const narratorAvatar =
|
||||||
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";
|
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";
|
||||||
|
|
||||||
|
When("I type in a comment with {int} characters", size => {
|
||||||
|
var c="";
|
||||||
|
for (var i = 0; i < size; i++) {
|
||||||
|
c += "c"
|
||||||
|
}
|
||||||
|
cy.get(".editor .ProseMirror").type(c);
|
||||||
|
});
|
||||||
|
|
||||||
Then("I click on the {string} button", text => {
|
Then("I click on the {string} button", text => {
|
||||||
cy.get("button")
|
cy.get("button")
|
||||||
.contains(text)
|
.contains(text)
|
||||||
@ -23,6 +31,16 @@ Then("I should see my comment", () => {
|
|||||||
.should("contain", "today at");
|
.should("contain", "today at");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Then("I should see the entirety of my comment", () => {
|
||||||
|
cy.get("div.comment")
|
||||||
|
.should("not.contain", "show more")
|
||||||
|
});
|
||||||
|
|
||||||
|
Then("I should see an abreviated version of my comment", () => {
|
||||||
|
cy.get("div.comment")
|
||||||
|
.should("contain", "show more")
|
||||||
|
});
|
||||||
|
|
||||||
Then("the editor should be cleared", () => {
|
Then("the editor should be cleared", () => {
|
||||||
cy.get(".ProseMirror p").should("have.class", "is-empty");
|
cy.get(".ProseMirror p").should("have.class", "is-empty");
|
||||||
});
|
});
|
||||||
|
|||||||
@ -20,3 +20,19 @@ Feature: Post Comment
|
|||||||
Then my comment should be successfully created
|
Then my comment should be successfully created
|
||||||
And I should see my comment
|
And I should see my comment
|
||||||
And the editor should be cleared
|
And the editor should be cleared
|
||||||
|
|
||||||
|
Scenario: View medium length comments
|
||||||
|
Given I visit "post/bWBjpkTKZp/101-essays"
|
||||||
|
And I type in a comment with 305 characters
|
||||||
|
And I click on the "Comment" button
|
||||||
|
Then my comment should be successfully created
|
||||||
|
And I should see the entirety of my comment
|
||||||
|
And the editor should be cleared
|
||||||
|
|
||||||
|
Scenario: View long comments
|
||||||
|
Given I visit "post/bWBjpkTKZp/101-essays"
|
||||||
|
And I type in a comment with 1205 characters
|
||||||
|
And I click on the "Comment" button
|
||||||
|
Then my comment should be successfully created
|
||||||
|
And I should see an abreviated version of my comment
|
||||||
|
And the editor should be cleared
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
export const COMMENT_MIN_LENGTH = 1
|
export const COMMENT_MIN_LENGTH = 1
|
||||||
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 300
|
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 1200
|
||||||
export const COMMENT_TRUNCATE_TO_LENGTH = 180
|
export const COMMENT_TRUNCATE_TO_LENGTH = 180
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user