Add cypress test to check date comment posted is displayed

This commit is contained in:
aonomike 2019-06-04 15:16:01 +03:00
parent 55b3764258
commit 21131a1e45

View File

@ -1,25 +1,28 @@
import { When, Then } from 'cypress-cucumber-preprocessor/steps' import { When, Then } from "cypress-cucumber-preprocessor/steps";
const narratorAvatar = 'https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg' const narratorAvatar =
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";
Then('I click on the {string} button', text => { Then("I click on the {string} button", text => {
cy.get('button').contains(text).click() cy.get("button")
}) .contains(text)
.click();
});
Then('my comment should be successfully created', () => { Then("my comment should be successfully created", () => {
cy.get('.iziToast-message') cy.get(".iziToast-message").contains("Comment Submitted");
.contains('Comment Submitted') });
})
Then('I should see my comment', () => { Then("I should see my comment", () => {
cy.get('div.comment p') cy.get("div.comment p")
.should('contain', 'Human Connection rocks') .should("contain", "Human Connection rocks")
.get('.ds-avatar img') .get(".ds-avatar img")
.should('have.attr', 'src') .should("have.attr", "src")
.and('contain', narratorAvatar) .and("contain", narratorAvatar)
}) .get("div p.ds-text span")
.should("contain", "today at");
});
Then('the editor should be cleared', () => { Then("the editor should be cleared", () => {
cy.get('.ProseMirror p') cy.get(".ProseMirror p").should("have.class", "is-empty");
.should('have.class', 'is-empty') });
})