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 module context provider #252

Merged
merged 7 commits into from
Mar 29, 2023
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
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ _Learn, repeat and memorize tasks with repeatio._

## [Start Learning](https://repeatio.netlify.app)

## :construction: Current limitations (v0.3) :construction:
## :construction: Current limitations (v0.4) :construction:

> **Warning**
> Not all browser and devices are supported!
> Currently not all UI elements are working (e.g. module progress)!
> Editing and deleting questions only works when using the default practice mode (not random/saved)!
> Only use Electron if you know how to edit .json files. The website should work just fine for most users.

## Browser Support
Expand Down Expand Up @@ -98,19 +97,13 @@ The order of the questions is random but each question will only be shown once.

<img src="./.github/Docs/assets/images/practice-random.png" height="180px" />

> **Warning**
> Don't delete or edit questions when using this mode!

### Bookmarked

To practice with the questions you bookmarked navigate to the module and click the `Start >` button inside `Bookmarked Questions`.
The questions are in the order that they were saved in. **[Read](#bookmarked-questions)** how to bookmark a question.

<img src="./.github/Docs/assets/images/train-bookmarked-questions.png" alt="Train Bookmarked Questions" height="180px"/>

> **Warning**
> Don't delete or edit questions when using this mode!

## Adding and editing Questions

### Add a new Question
Expand All @@ -130,9 +123,6 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
> **Note**
> On mobile you may have to first extend the bottom of the navigation

> **Warning**
> Editing questions while using the mode random or saved Question is currently not supported!

### Question Editor

#### Fields
Expand Down Expand Up @@ -193,7 +183,7 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
}
```

**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-1?mode=chronological)_**
**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-1?mode=practice&order=chronological)_**

</details>

Expand Down Expand Up @@ -251,7 +241,7 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
}
```

**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-2?mode=chronological)_**
**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-2?mode=practice&order=chronological)_**

</details>

Expand Down Expand Up @@ -292,7 +282,7 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
}
```

**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-3?mode=chronological)_**
**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-3?mode=practice&order=chronological)_**

</details>

Expand Down Expand Up @@ -343,7 +333,7 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
}
```

**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-4?mode=chronological)_**
**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-4?mode=practice&order=chronological)_**

</details>

Expand Down Expand Up @@ -406,7 +396,7 @@ The questions are in the order that they were saved in. **[Read](#bookmarked-que
}
```

**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-5?mode=chronological)_**
**_[Result](https://repeatio.netlify.app/module/types_1/question/qID-5?mode=practice&order=chronological)_**

</details>

Expand Down
13 changes: 8 additions & 5 deletions cypress/e2e/QuestionOverview.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ describe("Show questions of a module", () => {

it("should navigate to the question if clicking on an arrow inside an item", () => {
cy.visit("/module/cypress_1/all-questions");
cy.get("#question-qID-2").find("button.button-to-question").click();
cy.get("#question-qID-2").find("a.link-to-question").click();
cy.contains("Multiple Response questions have at least one correct answer.").should("exist");
cy.url().should("include", "/module/cypress_1/question/qID-2?mode=practice&order=chronological");
});
});

context("Types bookmarked fixture", () => {
it("should reset filteredQuestions when clicking arrow", () => {
it("should reset question ids in the context when clicking arrow", () => {
cy.fixtureToLocalStorage("repeatio-module-cypress_1.json");

// Add bookmarked questions
cy.fixtureToLocalStorage("repeatio-marked-types_1.json");
cy.fixtureToLocalStorage("repeatio-marked-cypress_1.json");

// navigate to module
cy.visit("/module/types_1");
cy.visit("/module/cypress_1");

// Visit bookmarked questions
cy.get("article[data-cy='Bookmarked Questions']").contains("Start").click();
Expand All @@ -46,7 +49,7 @@ describe("Show questions of a module", () => {
cy.get("a[aria-label='View all Questions']").click();

// Visit a question that is not in the bookmarked questions array
cy.get("#question-qID-5").find("button.button-to-question").click();
cy.get("#question-qID-5").find("a.link-to-question").click();

// Check if question is shown
cy.contains("This is a question of the type Extended Match.").should("exist");
Expand Down
14 changes: 7 additions & 7 deletions cypress/e2e/addQuestions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe("Adding a question of type gap-text", () => {
cy.get("textarea#editor-gap-text-textarea").type("This is a simple [test]");
cy.get("button[type='submit']").click();

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("section.question-user-response").find("input").type("test");
cy.get("button[type='submit']").click();
cy.contains("Yes, that's correct!").should("exist");
Expand All @@ -257,7 +257,7 @@ describe("Adding a question of type gap-text", () => {
cy.get("textarea#editor-gap-text-textarea").type("[This] is a [complex] [test]", { force: true });
cy.get("button[type='submit']").click();

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("section.question-user-response").find("input").first().type("This");
cy.get("section.question-user-response").find("input").eq(1).type("complex");
cy.get("section.question-user-response").find("input").last().type("test");
Expand All @@ -269,7 +269,7 @@ describe("Adding a question of type gap-text", () => {
cy.get("textarea#editor-gap-text-textarea").type("This text supports [multiple; more than one] correct values");
cy.get("button[type='submit']").click();

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("section.question-user-response").find("input").type("more than one");
cy.get("button[type='submit']").click();
cy.contains("Yes, that's correct!").should("exist");
Expand Down Expand Up @@ -301,7 +301,7 @@ describe("Adding a question of type gap-text", () => {
cy.get("textarea#editor-gap-text-textarea").type("This text is [split] into{enter}two[lines]");
cy.get("button[type='submit']").click();

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("div.question-gap-text").invoke("height").should("be.greaterThan", 45);
cy.get("section.question-user-response").find("input").should("have.length", 2);
});
Expand All @@ -313,7 +313,7 @@ describe("Adding a question of type gap-text", () => {
);
cy.get("button[type='submit']").click();

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("table").should("exist").and("be.visible");
});

Expand All @@ -335,7 +335,7 @@ describe("Adding a question of type gap-text", () => {
expect((addedQuestion?.answerOptions as IGapText).correctGapValues).to.deep.eq([["This"], ["gap", "hole"]]);
});

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.contains("a", "link").should("exist");
cy.contains("a", "another link").should("exist");
cy.get("section.question-user-response").find("input").first().type("This");
Expand Down Expand Up @@ -369,7 +369,7 @@ describe("Adding a question of type gap-text", () => {
expect((addedQuestion?.answerOptions as IGapText).correctGapValues).to.deep.eq([["gap", "hole"]]);
});

cy.visit("/module/empty-questions/question/test-id");
cy.visit("/module/empty-questions/question/test-id?mode=practice&order=chronological");
cy.get("img").invoke("height").should("equal", 256);
cy.get("section.question-user-response").find("input").should("have.length", 1);
});
Expand Down
Loading