Skip to content

Commit

Permalink
refining cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Braimllari committed May 4, 2024
1 parent c3db629 commit e0c45e1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
14 changes: 0 additions & 14 deletions cypress/e2e/clear-editor-button.cy.js

This file was deleted.

17 changes: 0 additions & 17 deletions cypress/e2e/copy-button.cy.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe("Text Changes Detection - Character, Word, and Typo Count", () => {
describe("editor toolbar", () => {
beforeEach(() => {
cy.visit("/");
});
Expand Down Expand Up @@ -38,4 +38,25 @@ describe("Text Changes Detection - Character, Word, and Typo Count", () => {
.contains("0 karaktere, 0 fjalë, 0 shenjime")
.should("exist");
});

it("should copy the text from the editor and paste it correctly", () => {
cy.get('[data-test="editor"]').clear().type("test per butonin copy");

cy.get('[data-test="copy-to-clipboard-button"]').click();

cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq("test per butonin copy");
});
});
});

it('should clear the text in the editor when the "x" button is clicked', () => {
cy.get('[data-test="clear-editor-icon"]').should("not.exist");
cy.get(".typo").should("not.exist");
cy.get('[data-test="editor"]').type("saktë");
cy.get('[data-test="clear-editor-icon"]').click();
cy.get('[data-test="editor"]').contains("saktë").should("not.exist");
cy.get('[data-test="clear-editor-icon"]').should("not.exist");
});
});
8 changes: 8 additions & 0 deletions cypress/e2e/editor.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe("editor", () => {
beforeEach(() => {
cy.visit("/");
});

it("should ...", () => {
});
});

0 comments on commit e0c45e1

Please sign in to comment.