Skip to content

Commit

Permalink
fixed history test
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikwilkowski committed Feb 1, 2025
1 parent 0b54e96 commit 7346f5f
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/tests/e2e/history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
})
// correct answer
.then(() => {
// correct answer
cy.get("[data-answer]").contains(correct).realClick();
})
// next question
Expand All @@ -75,14 +75,14 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
wrongs = new RegExp(`^(?!${answerText}$).*$`, "gm");
})
// wrong answer
.then(() => {
// wrong answer
wrongAnswers.push(answerText);
cy.get('[data-answer=""]').contains(wrongs).realClick();
})
Expand Down Expand Up @@ -110,14 +110,14 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
wrongs = new RegExp(`^(?!${answerText}$).*$`, "gm");
})
// wrong answer
.then(() => {
// wrong answer
wrongAnswers.push(answerText);
cy.get('[data-answer=""]').contains(wrongs).realClick();
})
Expand All @@ -131,14 +131,14 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
wrongs = new RegExp(`^(?!${answerText}$).*$`, "gm");
})
// wrong answer
.then(() => {
// wrong answer
wrongAnswers.push(answerText);
cy.get('[data-answer=""]').contains(wrongs).realClick();
})
Expand All @@ -152,14 +152,14 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
wrongs = new RegExp(`^(?!${answerText}$).*$`, "gm");
})
// wrong answer
.then(() => {
// wrong answer
wrongAnswers.push(answerText);
cy.get('[data-answer=""]').contains(wrongs).realClick();
})
Expand All @@ -173,14 +173,14 @@ describe("The history", () => {
.realClick()
// getting the current question from the DOM
.then(() => {
$title = Cypress.$('[data-question="true"] title');
return cy.get('[data-question="true"] title').should("exist");
})
.then(($title) => {
questionID = "#" + $title.attr("id").replace("-title", "");
answerText = SIGNALS[questionID].text;
correct = new RegExp(`^(${answerText})$`, "g");
wrongs = new RegExp(`^(?!${answerText}$).*$`, "gm");
})
// wrong answer
.then(() => {
// wrong answer
wrongAnswers.push(answerText);
cy.get('[data-answer=""]').contains(wrongs).realClick();
})
Expand Down

0 comments on commit 7346f5f

Please sign in to comment.