Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: changed data-cy to data-test-id #367

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/web-component/cypress/e2e/annotated.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ context("Readalong Component with annotation", () => {
it(" toggle button testing", () => {
cy.wait(["@text", "@audio"]);
cy.readalong().within(() => {
cy.get("[data-cy=play-button]").should("be.enabled");
cy.get("[data-test-id=play-button]").should("be.enabled");
cy.get("[annotation-id]").should("have.class", "invisible");
cy.get("#annotationsMenu").should("not.exist");
cy.get("[data-test-id=annotations-toggle]").click();
Expand Down
18 changes: 9 additions & 9 deletions packages/web-component/cypress/e2e/basic.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ context("The Readalong Component", () => {
cy.readalong().within(() => {
cy.playReadAlong();
cy.wait(FOR_ERIC_TO_TALK_A_BIT);
cy.get("[data-cy=stop-button]").click();
cy.get("[data-test-id=stop-button]").click();
});
});

Expand All @@ -34,7 +34,7 @@ context("The Readalong Component", () => {

cy.readalong().within(() => {
//wait for initialization process to be completed
cy.get("[data-cy=play-button]").should("be.enabled");
cy.get("[data-test-id=play-button]").should("be.enabled");
cy.get("span").contains("technologies").click();
});
});
Expand All @@ -45,21 +45,21 @@ context("The Readalong Component", () => {

cy.readalong().within(() => {
cy.playReadAlong();
cy.get("[data-cy=page-count__current]")
cy.get("[data-test-id=page-count__current]")
.filter("*:visible")
.invoke("text")
.should("eq", "1");

cy.get("[data-cy=progress-bar]")
cy.get("[data-test-id=progress-bar]")
.as("progress-bar")
.then((el) => {
// click 3/4 of the way in the readalong (should be second page)
cy.get("@progress-bar").click(el.width() * 0.75, el.height() * 0.5);
});
cy.get("[data-cy=stop-button]").click();
cy.get("[data-test-id=stop-button]").click();
cy.wait(FOR_PAGE_TURN_ANIMATION);

cy.get("[data-cy=page-count__current]")
cy.get("[data-test-id=page-count__current]")
.filter("*:visible")
.invoke("text")
.should("eq", "2");
Expand All @@ -74,12 +74,12 @@ context("The Readalong Component", () => {
cy.wait("@audio").then(() => {
cy.readalong().within(() => {
//wait for initialization process to be completed
cy.get("[data-cy=play-button]").should("be.enabled");
cy.get("[data-test-id=play-button]").should("be.enabled");
//word corpus and robuste should hidden
cy.get("#t0b0d1p0s2w1").should("not.be.visible");
cy.get("#t0b0d1p1s0w14").should("not.be.visible");
//advance to about 61%
cy.get("[data-cy=progress-bar]")
cy.get("[data-test-id=progress-bar]")
.as("progress-bar")
.then((el) => {
// click 3/4 of the way in the readalong (should be second page)
Expand All @@ -91,7 +91,7 @@ context("The Readalong Component", () => {
//word corpus and robuste should now be visible
cy.get("#t0b0d1p0s2w1").should("be.visible");
cy.get("#t0b0d1p1s0w14").should("be.visible");
cy.get("[data-cy=play-button]")
cy.get("[data-test-id=play-button]")
.click()
.then(() => {
cy.wait(FOR_PAGE_TURN_ANIMATION);
Expand Down
4 changes: 2 additions & 2 deletions packages/web-component/cypress/e2e/customizations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ context("Testing creator enabled settings", () => {
cy.readalong().within(() => {
cy.get("#t0b0d0p0s0w0").should("be.visible");
cy.get("#t0b0d0p0s0trtext0").should("not.be.visible");
cy.get("[data-cy=translation-toggle]").should("be.visible");
cy.get("[data-test-id=translation-toggle]").should("be.visible");
});
});

Expand All @@ -20,7 +20,7 @@ context("Testing creator enabled settings", () => {
cy.readalong().within(() => {
cy.get("#t0b0d0p0s0w0").should("be.visible");
cy.get("#t0b0d0p0s0trtext0").should("be.visible");
cy.get("[data-cy=translation-toggle]").should("be.visible");
cy.get("[data-test-id=translation-toggle]").should("be.visible");
});
});

Expand Down
14 changes: 7 additions & 7 deletions packages/web-component/cypress/e2e/edit.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ context("The Readalong Component", () => {

cy.readalong().within(() => {
// Click first line add translation
cy.get("[data-cy=add-translation-button]").first().click();
cy.get("[data-test-id=add-translation-button]").first().click();
// Check translation line was added
cy.get("[data-cy=translation-line]").should("have.length", 1);
cy.get("[data-test-id=translation-line]").should("have.length", 1);
// Check you can type into the new translation line
cy.get("[data-cy=translation-line]").type("this is a test", {
cy.get("[data-test-id=translation-line]").type("this is a test", {
force: true,
});
// Create a new translation line with the last sentence
cy.get("[data-cy=add-translation-button]").last().click();
cy.get("[data-test-id=add-translation-button]").last().click();
// Check it was added
cy.get("[data-cy=translation-line]").should("have.length", 2);
cy.get("[data-test-id=translation-line]").should("have.length", 2);
// Remove the first line
cy.get("[data-cy=remove-translation-button]").first().click();
cy.get("[data-test-id=remove-translation-button]").first().click();
// Check it was removed
cy.get("[data-cy=translation-line]").should("have.length", 1);
cy.get("[data-test-id=translation-line]").should("have.length", 1);
});
});
});
10 changes: 5 additions & 5 deletions packages/web-component/cypress/e2e/embedded.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ context("The Readalong Component", () => {
cy.readalong().within(() => {
cy.playReadAlong();
cy.wait(FOR_ERIC_TO_TALK_A_BIT);
cy.get("[data-cy=stop-button]").click();
cy.get("[data-test-id=stop-button]").click();
});
});

Expand All @@ -37,21 +37,21 @@ context("The Readalong Component", () => {

cy.readalong().within(() => {
cy.playReadAlong();
cy.get("[data-cy=page-count__current]")
cy.get("[data-test-id=page-count__current]")
.filter("*:visible")
.invoke("text")
.should("eq", "1");

cy.get("[data-cy=progress-bar]")
cy.get("[data-test-id=progress-bar]")
.as("progress-bar")
.then((el) => {
// click 3/4 of the way in the readalong (should be second page)
cy.get("@progress-bar").click(el.width() * 0.75, el.height() * 0.5);
});
cy.get("[data-cy=stop-button]").click();
cy.get("[data-test-id=stop-button]").click();
cy.wait(FOR_PAGE_TURN_ANIMATION);

cy.get("[data-cy=page-count__current]")
cy.get("[data-test-id=page-count__current]")
.filter("*:visible")
.invoke("text")
.should("eq", "2");
Expand Down
50 changes: 25 additions & 25 deletions packages/web-component/cypress/e2e/missing.assets.feedback.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ context("Readalong Component with missing assets", () => {
cy.readalongElement().should("be.visible");

cy.readalong().within(() => {
cy.get("[data-cy=text-container]").should(($el) => {
cy.get("[data-test-id=text-container]").should(($el) => {
expect($el.children().length).equal(0, "has text");
});
cy.get("[data-cy=AUDIO-error]").should("not.exist");
cy.get("[data-cy=alignment-error]").should("not.exist");
cy.get("[data-cy=control-panel]")
cy.get("[data-test-id=AUDIO-error]").should("not.exist");
cy.get("[data-test-id=alignment-error]").should("not.exist");
cy.get("[data-test-id=control-panel]")
.should("have.length", 1)
.should("be.visible");
cy.get("[data-cy=RAS-error]")
cy.get("[data-test-id=RAS-error]")
.should(($el) => {
expect($el.hasClass("fade")).equal(
false,
Expand All @@ -25,7 +25,7 @@ context("Readalong Component with missing assets", () => {
);
})
.should("be.visible");
cy.get("[data-cy=progress-bar]").should("have.length", 0);
cy.get("[data-test-id=progress-bar]").should("have.length", 0);
});
});

Expand All @@ -34,15 +34,15 @@ context("Readalong Component with missing assets", () => {
cy.readalongElement().should("be.visible");

cy.readalong().within(() => {
cy.get("[data-cy=text-container]").should(($el) => {
cy.get("[data-test-id=text-container]").should(($el) => {
expect($el.children().length).equal(0, "has text");
});
cy.get("[data-cy=AUDIO-error]").should("not.exist");
cy.get("[data-cy=alignment-error]").should("not.exist");
cy.get("[data-cy=control-panel]")
cy.get("[data-test-id=AUDIO-error]").should("not.exist");
cy.get("[data-test-id=alignment-error]").should("not.exist");
cy.get("[data-test-id=control-panel]")
.should("have.length", 1)
.should("be.visible");
cy.get("[data-cy=RAS-error]")
cy.get("[data-test-id=RAS-error]")
.should(($el) => {
expect($el.hasClass("fade")).equal(
false,
Expand All @@ -55,7 +55,7 @@ context("Readalong Component with missing assets", () => {
);
})
.should("be.visible");
cy.get("[data-cy=progress-bar]").should("have.length", 0);
cy.get("[data-test-id=progress-bar]").should("have.length", 0);
});
});

Expand All @@ -65,7 +65,7 @@ context("Readalong Component with missing assets", () => {

cy.readalong().within(() => {
cy.contains("Page");
cy.get("[data-cy=AUDIO-error]")
cy.get("[data-test-id=AUDIO-error]")
.should(($el) => {
expect($el.hasClass("fade")).equal(false);
//check that message is visible
Expand All @@ -74,10 +74,10 @@ context("Readalong Component with missing assets", () => {
);
})
.should("be.visible");
cy.get("[data-cy=control-panel]").should("have.length", 0);
cy.get("[data-cy=RAS-error]").should("not.exist");
cy.get("[data-cy=alignment-error]").should("not.exist");
cy.get("[data-cy=progress-bar]").should("have.length", 1);
cy.get("[data-test-id=control-panel]").should("have.length", 0);
cy.get("[data-test-id=RAS-error]").should("not.exist");
cy.get("[data-test-id=alignment-error]").should("not.exist");
cy.get("[data-test-id=progress-bar]").should("have.length", 1);
});
});

Expand All @@ -87,19 +87,19 @@ context("Readalong Component with missing assets", () => {

cy.readalong().within(() => {
cy.contains("Page");
cy.get("[data-cy=AUDIO-error]").should("not.exist");
cy.get("[data-cy=control-panel]")
cy.get("[data-test-id=AUDIO-error]").should("not.exist");
cy.get("[data-test-id=control-panel]")
.should("have.length", 1)
.should("be.visible");
cy.get("[data-cy=RAS-error]").should("not.exist");
cy.get("[data-cy=alignment-error]")
cy.get("[data-test-id=RAS-error]").should("not.exist");
cy.get("[data-test-id=alignment-error]")
.should(($el) => {
expect($el.hasClass("fade")).equal(false);
// check that message is visible
expect($el.text()).contains("Error: No alignments were found");
})
.should("be.visible");
cy.get("[data-cy=progress-bar]").should("have.length", 0);
cy.get("[data-test-id=progress-bar]").should("have.length", 0);
});
});

Expand All @@ -108,9 +108,9 @@ context("Readalong Component with missing assets", () => {
cy.readalongElement().should("be.visible");

cy.readalong().within(() => {
cy.get("[data-cy=alignment-error]").should("not.exist");
cy.get("[data-cy=RAS-error]").should("be.visible");
cy.get("[data-cy=AUDIO-error]").should("be.visible");
cy.get("[data-test-id=alignment-error]").should("not.exist");
cy.get("[data-test-id=RAS-error]").should("be.visible");
cy.get("[data-test-id=AUDIO-error]").should("be.visible");
});
});
});
2 changes: 1 addition & 1 deletion packages/web-component/cypress/e2e/settings.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ context("Testing end user enabled settings", () => {
cy.wait(7000); //6740 timestamp of the first word on second page
cy.get("#t0b0d1p0s0w0").should("not.be.visible");

cy.get("[data-cy=play-button]").should("be.visible");
cy.get("[data-test-id=play-button]").should("be.visible");
});
});
it("can save user preference", () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/web-component/cypress/e2e/translated.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ context("Readalong Component with translation", () => {
cy.get(".sentence__translation")
.should("have.length.above", 0)
.should("be.visible");
cy.get("[data-cy=translation-toggle]").should("be.visible");
cy.get("[data-test-id=translation-toggle]").should("be.visible");
});
});

it(" toggle button testing", () => {
cy.readalong().within(() => {
cy.get(".sentence__translation").should("not.have.class", "invisible");
cy.get("[data-cy=translation-toggle]").click();
cy.get("[data-test-id=translation-toggle]").click();
cy.get(".sentence__translation").should("have.class", "invisible");
cy.get("[data-cy=translation-toggle]").click();
cy.get("[data-test-id=translation-toggle]").click();
cy.get(".sentence__translation").should("not.have.class", "invisible");
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/web-component/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Cypress.Commands.add("readalongElement", () => {
});

Cypress.Commands.add("playReadAlong", () => {
cy.get("[data-cy=play-button]", { timeout: 10000 })
cy.get("[data-test-id=play-button]", { timeout: 10000 })
.should("be.enabled")
.click();
});
Loading