Skip to content

Commit

Permalink
chore: Update @watts-lab/surveys npm dependency to version 1.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amirrr committed Aug 7, 2024
1 parent 590d8c7 commit 820452e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
32 changes: 28 additions & 4 deletions client/cypress/e2e/1-functionality/formfill.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("fill out the survay", () => {

cy.wait(1000); // Wait for 1 second before selecting the radio button

cy.get("input[type='radio'][id*='question1-No']")
cy.get("input[type='radio'][id*='question1-Yes']")
.check({ force: true })
.should("be.checked");
cy.get("input[type='radio'][id*=\"question2-It's obvious\"]")
Expand Down Expand Up @@ -86,12 +86,21 @@ describe("fill out the survay", () => {
cy.get("input[type='button'][value='Complete']").click();

// Fill the demographic form
// Birth year
cy.get("input[type='text'][id*='sq_169i']").type("1990");
cy.get("input[type='radio'][id*='sq_170i_2']")

// Gender
cy.get("input[type='radio'][id*='sq_170i_0']")
.check({ force: true })
.should("be.checked");

cy.get("input[type='text'][id*='sq_173i_0']").type("English\n");
cy.get("input[type='text'][id*='sq_172i_0']").type("Other\n", {
force: true,
});

cy.get("input[type='text'][id*='sq_173i_0']").type("English\n", {
force: true,
});

cy.get("input[type='radio'][id*='sq_175i_0']")
.check({ force: true })
Expand All @@ -101,7 +110,22 @@ describe("fill out the survay", () => {
.check({ force: true })
.should("be.checked");

cy.get("input[type='text'][id*='sq_178i_0']").type("Algeria\n");
cy.get("input[type='text'][id*='sq_178i_0']").type("Algeria\n", {
force: true,
});

// Check if the form is submitted
cy.intercept("http://localhost:4000/api/results").as("resultData");

cy.get("input[type='button'][value='Complete']").click();

cy.wait("@resultData").its("response.statusCode").should("equal", 200);

cy.wait(1000); // Wait for 1 second before selecting the radio button

cy.get('[data-cy="commonsense-score"]')
.invoke("text")
.then(parseFloat)
.should("be.gt", 0);
});
});
15 changes: 7 additions & 8 deletions client/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 client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@headlessui/react": "^1.7.18",
"@observablehq/plot": "^0.6.14",
"@reduxjs/toolkit": "^1.9.7",
"@watts-lab/surveys": "^1.13.4",
"@watts-lab/surveys": "^1.17.1",
"aos": "^2.3.4",
"axios": "^1.6.8",
"i18next": "^23.11.5",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function Result(props: ResultProps) {
<div className="flex flex-col justify-center items-center h-full text-white">
<div className="text-pale-blue pb-4 text-2xl">Your Result</div>
<div className="rounded-full pt-3 h-24 w-24 justify-center text-center items-center bg-gradient-to-b from-sky-600 to-indigo-500">
<div className="text-4xl font-bold">
<div data-cy="commonsense-score" className="text-4xl font-bold">
{commonSenseScore.commonsense}
</div>
<span className="text-pale-blue text-sm">of 100</span>
Expand Down

0 comments on commit 820452e

Please sign in to comment.