Skip to content

Commit

Permalink
multiple animation for marked suggestion added (#360)
Browse files Browse the repository at this point in the history
* multiple animation for marked suggestion added

* duplicated text markings issue resolved

* test files for card's suggestion animation

* empty test file fix
  • Loading branch information
vaqueraoscar0 authored Nov 15, 2023
1 parent cd12de6 commit 944a158
Show file tree
Hide file tree
Showing 6 changed files with 1,154 additions and 28 deletions.
20 changes: 20 additions & 0 deletions cypress/e2e/multiple-suggestion-selection-animation.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe("Test animation during multiple suggestion selections", () => {
beforeEach(() => {
cy.visit("/");
});

it("should select suggestions for all cards and display smooth animation", () => {
cy.get("#editor > p > .typo").should("not.exist");

cy.get('[data-test="editor"]').type("asd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \n");
cy.wait(2000);

cy.get(".sticky .card").each((card, index) => {
cy.wrap(card).find('[data-test="suggestion"]').first().click();
cy.wait(2000)

});

cy.get("#editor > p > .typo").should("not.exist");
});
});
28 changes: 28 additions & 0 deletions cypress/e2e/request-after-suggestion-selection.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
describe("Test request after suggestion selection", () => {
beforeEach(() => {
cy.visit("/");
});

it("should make a post request after rapidly selecting suggestions from cards", () => {
cy.get("#editor > p > .typo").should("not.exist");

cy.get('[data-test="editor"]').type("asd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \n");
cy.wait(2000);

cy.get(".sticky .card").each((card, index) => {
if(index < 9){
cy.wrap(card).find('[data-test="suggestion"]').first().click();
}
});

cy.wait(5000)

cy.intercept("POST", 'http://localhost:3000/api/generateMarkingsForParagraphs').as("postRequest");
cy.wait("@postRequest").then((interception) => {
// we only need this to be true regardless of the status code
expect(interception.response.statusCode).to.equal(404);
});


});
});
26 changes: 26 additions & 0 deletions cypress/e2e/suggestion-selection-text-changed.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
describe("Test editor marking's change in text", () => {
beforeEach(() => {
cy.visit("/");
});

it("should reflect rapid changes in text when selecting multiple suggestions", () => {
let shouldBe = "aks Për kryerjen e programeve gazmim aso aks Për kryerjen e programeve gazmim aso aks Për kryerjen e programeve gazmim aso aks Për kryerjen e programeve gazmim aso "

cy.get("#editor > p > .typo").should("not.exist");

cy.get('[data-test="editor"]').type("asd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \nasd Për kryerjen e programeve gabmim asd \n");
cy.wait(2000);

cy.get(".sticky .card").each((card, index) => {
cy.wrap(card).find('[data-test="suggestion"]').first().click();
});

cy.wait(3000)
cy.get('#editor > p').invoke('text').then((actualText) => {
actualText = actualText.replace(/\s+/g, ' ').trim();
shouldBe = shouldBe.replace(/\s+/g, ' ').trim();

expect(actualText).to.equal(shouldBe);
});
});
});
Loading

0 comments on commit 944a158

Please sign in to comment.