From 38f049b9eb77319254301099bb18f052585c5a5e Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:57:24 +0530 Subject: [PATCH 01/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index a202e6bf0..e78a45190 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -64,6 +64,52 @@ After you have been assigned to an issue, fork the [json-schema-org/website](htt To propose modifications to our documentation that do not have an issue in the [documentation board](https://github.com/orgs/json-schema-org/projects/16), you can [create a GitHub issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-repository) and use the *Documentation* template to describe the changes. After that, you can decide whether you want to work on the changes yourself or let someone else claim the issue. If you decide to work on the issue, assign it to yourself and commit the changes to a new branch. +###Writing Tests + +To ensure the quality and consistency of our documentation, we encourage contributors to write and update tests as part of their contributions. Below is a quick guide to writing tests: + +###Guidelines for Writing Tests + +1.Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. + +-`For new features, write tests that cover all potential scenarios`. + +-`For bug fixes, include regression tests to prevent reoccurrence`. + +2.Structure Your Test Cases: A well-structured test includes the following: + +-`Title`: A concise name describing the purpose of the test. + +-`Steps`: A clear sequence of actions to execute. + +-`Expected Results`: The outcomes that confirm the functionality works as intended. + +3.Use Consistent Naming Conventions: Follow the naming conventions already established in the project. Use meaningful names for test files and methods. + +4.Run Existing Tests: Before adding new tests, ensure all current tests pass. This helps confirm a stable baseline. + +5.Iterate and Refactor: Optimize your test cases for readability and maintainability. Avoid duplicating test logic when possible. + +###Resources + +For additional guidance on writing effective tests, refer to these resources: + +-`How to Write Test Cases` - Coursera + +-`Manual Test Cases` - Testrail + +-`Effective Test Cases` - Testrail + +###Submitting Your Tests + + When submitting a pull request that includes tests: + +-`Ensure the test results are included in the pull request description.` + +-`Highlight any areas of concern or cases where additional review is needed.` + +-`Tag @json-schema-org/docs-team for assistance if required.` + ## Create a Pull Request To submit your work to review by the community, open a draft pull request to the `main` upstream branch, and add the issue your pull request solves. Add @json-schema-org/docs-team as a reviewer of your pull request, and let us know in the #documentation Slack channel your pull request is ready for review. From de96972c7bd86025b6326aeb815624bc844f1e5f Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:58:41 +0530 Subject: [PATCH 02/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index e78a45190..8c687dcf1 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -64,11 +64,11 @@ After you have been assigned to an issue, fork the [json-schema-org/website](htt To propose modifications to our documentation that do not have an issue in the [documentation board](https://github.com/orgs/json-schema-org/projects/16), you can [create a GitHub issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-repository) and use the *Documentation* template to describe the changes. After that, you can decide whether you want to work on the changes yourself or let someone else claim the issue. If you decide to work on the issue, assign it to yourself and commit the changes to a new branch. -###Writing Tests +### Writing Tests To ensure the quality and consistency of our documentation, we encourage contributors to write and update tests as part of their contributions. Below is a quick guide to writing tests: -###Guidelines for Writing Tests +### Guidelines for Writing Tests 1.Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. @@ -90,7 +90,7 @@ To ensure the quality and consistency of our documentation, we encourage contrib 5.Iterate and Refactor: Optimize your test cases for readability and maintainability. Avoid duplicating test logic when possible. -###Resources +### Resources For additional guidance on writing effective tests, refer to these resources: @@ -100,7 +100,7 @@ For additional guidance on writing effective tests, refer to these resources: -`Effective Test Cases` - Testrail -###Submitting Your Tests +### Submitting Your Tests When submitting a pull request that includes tests: From 94f2ba3ff9387c4cabb841593d433ffde18b4492 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:59:49 +0530 Subject: [PATCH 03/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 8c687dcf1..22f53bde8 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -78,11 +78,11 @@ To ensure the quality and consistency of our documentation, we encourage contrib 2.Structure Your Test Cases: A well-structured test includes the following: --`Title`: A concise name describing the purpose of the test. +- `Title`: A concise name describing the purpose of the test. --`Steps`: A clear sequence of actions to execute. +- `Steps`: A clear sequence of actions to execute. --`Expected Results`: The outcomes that confirm the functionality works as intended. +- `Expected Results`: The outcomes that confirm the functionality works as intended. 3.Use Consistent Naming Conventions: Follow the naming conventions already established in the project. Use meaningful names for test files and methods. @@ -94,21 +94,21 @@ To ensure the quality and consistency of our documentation, we encourage contrib For additional guidance on writing effective tests, refer to these resources: --`How to Write Test Cases` - Coursera +- `How to Write Test Cases` - Coursera --`Manual Test Cases` - Testrail +- `Manual Test Cases` - Testrail --`Effective Test Cases` - Testrail +- `Effective Test Cases` - Testrail ### Submitting Your Tests When submitting a pull request that includes tests: --`Ensure the test results are included in the pull request description.` +- `Ensure the test results are included in the pull request description.` --`Highlight any areas of concern or cases where additional review is needed.` +- `Highlight any areas of concern or cases where additional review is needed.` --`Tag @json-schema-org/docs-team for assistance if required.` +- `Tag @json-schema-org/docs-team for assistance if required.` ## Create a Pull Request From 8e6b336e3b9b68e595feb792d3d1c71e99409a5d Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:00:50 +0530 Subject: [PATCH 04/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 22f53bde8..228270e87 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -72,9 +72,9 @@ To ensure the quality and consistency of our documentation, we encourage contrib 1.Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. --`For new features, write tests that cover all potential scenarios`. +- `For new features, write tests that cover all potential scenarios`. --`For bug fixes, include regression tests to prevent reoccurrence`. +- `For bug fixes, include regression tests to prevent reoccurrence`. 2.Structure Your Test Cases: A well-structured test includes the following: From 93484990a1b085661f5eafe7cec41befb3698ac7 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:11:13 +0530 Subject: [PATCH 05/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 228270e87..5ca7cb05d 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -70,13 +70,13 @@ To ensure the quality and consistency of our documentation, we encourage contrib ### Guidelines for Writing Tests -1.Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. +1. Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. - `For new features, write tests that cover all potential scenarios`. - `For bug fixes, include regression tests to prevent reoccurrence`. -2.Structure Your Test Cases: A well-structured test includes the following: +2. Structure Your Test Cases: A well-structured test includes the following: - `Title`: A concise name describing the purpose of the test. @@ -84,11 +84,27 @@ To ensure the quality and consistency of our documentation, we encourage contrib - `Expected Results`: The outcomes that confirm the functionality works as intended. -3.Use Consistent Naming Conventions: Follow the naming conventions already established in the project. Use meaningful names for test files and methods. +3. Use Consistent Naming Conventions: Follow the naming conventions already established in the project. Use meaningful names for test files and methods. -4.Run Existing Tests: Before adding new tests, ensure all current tests pass. This helps confirm a stable baseline. +4. Run Existing Tests: Before adding new tests, ensure all current tests pass. This helps confirm a stable baseline. -5.Iterate and Refactor: Optimize your test cases for readability and maintainability. Avoid duplicating test logic when possible. +5. Iterate and Refactor: Optimize your test cases for readability and maintainability. Avoid duplicating test logic when possible. + +### Writing Tests with Cypress + +- `Component Tests`: Add tests for new components in cypress/components. + +- `E2E Tests`: Add tests for new features or bug fixes in cypress/e2e. + +- `Enhance Existing Tests`: Improve coverage and robustness of existing tests. + +Running Tests + +Run all tests before submitting a pull request: + +### Reporting Test Issues + +If you encounter test problems, open an issue describing the issue and steps to reproduce it. ### Resources From 8c257f4468e2e56648b3a91f17e53b9008c1d074 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:14:01 +0530 Subject: [PATCH 06/15] adding guide for tests writing --- CONTRIBUTING-docs.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 5ca7cb05d..6994e8914 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -100,7 +100,10 @@ To ensure the quality and consistency of our documentation, we encourage contrib Running Tests -Run all tests before submitting a pull request: +## Run all tests before submitting a pull request: + ``` + yarn cypress:run:all + ``` ### Reporting Test Issues From a2dd14412484906b9ce406730109741e8c89cf17 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:17:35 +0530 Subject: [PATCH 07/15] Adding guide for tests writing --- CONTRIBUTING-docs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 6994e8914..08d392bc2 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -113,11 +113,11 @@ If you encounter test problems, open an issue describing the issue and steps to For additional guidance on writing effective tests, refer to these resources: -- `How to Write Test Cases` - Coursera +- `[How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases)` - Coursera -- `Manual Test Cases` - Testrail +- `[Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/)` - Testrail -- `Effective Test Cases` - Testrail +- `[Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/)` - Testrail ### Submitting Your Tests From 4e5535aaaa31e44076aa843c57379a259c2b36a8 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:20:11 +0530 Subject: [PATCH 08/15] Adding guide for tests writing --- CONTRIBUTING-docs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 08d392bc2..d7bb924b2 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -113,11 +113,11 @@ If you encounter test problems, open an issue describing the issue and steps to For additional guidance on writing effective tests, refer to these resources: -- `[How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases)` - Coursera +- `.[How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases)` - Coursera -- `[Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/)` - Testrail +- `.[Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/)` - Testrail -- `[Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/)` - Testrail +- `.[Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/)` - Testrail ### Submitting Your Tests From d159dbc8e534a3352ac33fc15b4718f06932cdfa Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:25:43 +0530 Subject: [PATCH 09/15] Adding guide for tests writing --- CONTRIBUTING-docs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index d7bb924b2..0f18b428d 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -113,11 +113,11 @@ If you encounter test problems, open an issue describing the issue and steps to For additional guidance on writing effective tests, refer to these resources: -- `.[How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases)` - Coursera +1. [How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases) - Coursera -- `.[Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/)` - Testrail +2. [Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/) - Testrail -- `.[Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/)` - Testrail +3. [Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/) - Testrail ### Submitting Your Tests From 464b9363a8f710d9025956739b4e4e97e20af88f Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:05:27 +0530 Subject: [PATCH 10/15] Adding guide for tests writing --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73e7a8ff6..ddadb5020 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,7 @@ If you don't have time to contribute, that's fine. There are other easy ways to - ๐ŸŽจ [Improving the Design](#-improving-the-design) - ๐Ÿš€ [Contributing to CI/CD Pipeline](#-contributing-to-cicd-pipeline) - ๐Ÿงช [Contributing to Testing](#-contributing-to-testing) + - ๐Ÿ”จ [Guidelines for Testing Website Components](#-guidelines-for-testing-website-components) - โŒจ๏ธ [Pull requests](#%EF%B8%8F-pull-requests) - ๐Ÿ› [License](#-license) @@ -97,6 +98,47 @@ We value contributions to our testing efforts. Here are ways you can help improv For more details on our testing setup and how to run tests, please refer to the Testing section in our [INSTALLATION.md](./INSTALLATION.md#testing) file. +### ๐Ÿ”จ Guidelines for Testing Website Components + +To ensure consistent and effective testing of website components, follow these guidelines: + +1. Understand the Requirements: + + - Review the functionality and design requirements for the component. + + - Refer to the provided resources to understand effective test case design: + + - [How to write test cases](https://www.coursera.org/articles/how-to-write-test-cases) + + - [Manual test cases](https://www.testrail.com/blog/manual-test-cases/) + + - [Effective test cases](https://www.testrail.com/blog/effective-test-cases-templates/) + +2. Write Comprehensive Test Cases: + + - Ensure each test case has a clear objective, preconditions, test steps, and expected results. + + - Include positive, negative, and edge case scenarios. + +3. Automate Where Possible: + + - Write automated tests using Cypress for components and E2E flows. + + - Ensure test scripts are reusable and modular. + +4. Review and Update: + + - Regularly review test cases to align with changes in component functionality or design. + + - Update outdated or redundant test cases to maintain relevance. + +5. Collaborate with the Team: + + - Seek feedback on test cases and scripts from other contributors. + + - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. + +Following these guidelines will help ensure high-quality testing and contribute to a robust and reliable website. ### โŒจ๏ธ Pull requests From d5b90acab9f4249b4c5127556f549e6fb77d56a9 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:10:37 +0530 Subject: [PATCH 11/15] adding guide for tests writing --- CONTRIBUTING.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddadb5020..ffa396f45 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -102,41 +102,41 @@ For more details on our testing setup and how to run tests, please refer to the To ensure consistent and effective testing of website components, follow these guidelines: -1. Understand the Requirements: +1. **Understand the Requirements**: - - Review the functionality and design requirements for the component. + - Review the functionality and design requirements for the component. - - Refer to the provided resources to understand effective test case design: + - Refer to the provided resources to understand effective test case design: - - [How to write test cases](https://www.coursera.org/articles/how-to-write-test-cases) + - [How to write test cases](https://www.coursera.org/articles/how-to-write-test-cases) - - [Manual test cases](https://www.testrail.com/blog/manual-test-cases/) + - [Manual test cases](https://www.testrail.com/blog/manual-test-cases/) - - [Effective test cases](https://www.testrail.com/blog/effective-test-cases-templates/) + - [Effective test cases](https://www.testrail.com/blog/effective-test-cases-templates/) -2. Write Comprehensive Test Cases: +2. **Write Comprehensive Test Cases**: - - Ensure each test case has a clear objective, preconditions, test steps, and expected results. + - Ensure each test case has a clear objective, preconditions, test steps, and expected results. - - Include positive, negative, and edge case scenarios. + - Include positive, negative, and edge case scenarios. -3. Automate Where Possible: +3. **Automate Where Possible**: - - Write automated tests using Cypress for components and E2E flows. + - Write automated tests using Cypress for components and E2E flows. - - Ensure test scripts are reusable and modular. + - Ensure test scripts are reusable and modular. -4. Review and Update: +4. **Review and Update**: - - Regularly review test cases to align with changes in component functionality or design. + - Regularly review test cases to align with changes in component functionality or design. - - Update outdated or redundant test cases to maintain relevance. + - Update outdated or redundant test cases to maintain relevance. -5. Collaborate with the Team: +5. **Collaborate with the Team**: - - Seek feedback on test cases and scripts from other contributors. + - Seek feedback on test cases and scripts from other contributors. - - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. + - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. Following these guidelines will help ensure high-quality testing and contribute to a robust and reliable website. From 7aa0fa8490250c957a8156025ed77c7a523c21e0 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:12:21 +0530 Subject: [PATCH 12/15] Update CONTRIBUTING.md --- CONTRIBUTING.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffa396f45..e77f68a27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,39 +104,39 @@ To ensure consistent and effective testing of website components, follow these g 1. **Understand the Requirements**: - - Review the functionality and design requirements for the component. + - Review the functionality and design requirements for the component. - - Refer to the provided resources to understand effective test case design: + - Refer to the provided resources to understand effective test case design: - - [How to write test cases](https://www.coursera.org/articles/how-to-write-test-cases) + - [How to write test cases](https://www.coursera.org/articles/how-to-write-test-cases) - - [Manual test cases](https://www.testrail.com/blog/manual-test-cases/) + - [Manual test cases](https://www.testrail.com/blog/manual-test-cases/) - - [Effective test cases](https://www.testrail.com/blog/effective-test-cases-templates/) + - [Effective test cases](https://www.testrail.com/blog/effective-test-cases-templates/) 2. **Write Comprehensive Test Cases**: - - Ensure each test case has a clear objective, preconditions, test steps, and expected results. + - Ensure each test case has a clear objective, preconditions, test steps, and expected results. - - Include positive, negative, and edge case scenarios. + - Include positive, negative, and edge case scenarios. 3. **Automate Where Possible**: - - Write automated tests using Cypress for components and E2E flows. + - Write automated tests using Cypress for components and E2E flows. - - Ensure test scripts are reusable and modular. + - Ensure test scripts are reusable and modular. 4. **Review and Update**: - - Regularly review test cases to align with changes in component functionality or design. + - Regularly review test cases to align with changes in component functionality or design. - - Update outdated or redundant test cases to maintain relevance. + - Update outdated or redundant test cases to maintain relevance. 5. **Collaborate with the Team**: - - Seek feedback on test cases and scripts from other contributors. + - Seek feedback on test cases and scripts from other contributors. - - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. + - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. Following these guidelines will help ensure high-quality testing and contribute to a robust and reliable website. From f3708ad30cb5961111e4fd1c368cb841a1f245d5 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:16:14 +0530 Subject: [PATCH 13/15] Update CONTRIBUTING-docs.md --- CONTRIBUTING-docs.md | 65 -------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/CONTRIBUTING-docs.md b/CONTRIBUTING-docs.md index 0f18b428d..a202e6bf0 100644 --- a/CONTRIBUTING-docs.md +++ b/CONTRIBUTING-docs.md @@ -64,71 +64,6 @@ After you have been assigned to an issue, fork the [json-schema-org/website](htt To propose modifications to our documentation that do not have an issue in the [documentation board](https://github.com/orgs/json-schema-org/projects/16), you can [create a GitHub issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-repository) and use the *Documentation* template to describe the changes. After that, you can decide whether you want to work on the changes yourself or let someone else claim the issue. If you decide to work on the issue, assign it to yourself and commit the changes to a new branch. -### Writing Tests - -To ensure the quality and consistency of our documentation, we encourage contributors to write and update tests as part of their contributions. Below is a quick guide to writing tests: - -### Guidelines for Writing Tests - -1. Understand the Scope: Identify the purpose of the test and the specific functionality it should validate. - -- `For new features, write tests that cover all potential scenarios`. - -- `For bug fixes, include regression tests to prevent reoccurrence`. - -2. Structure Your Test Cases: A well-structured test includes the following: - -- `Title`: A concise name describing the purpose of the test. - -- `Steps`: A clear sequence of actions to execute. - -- `Expected Results`: The outcomes that confirm the functionality works as intended. - -3. Use Consistent Naming Conventions: Follow the naming conventions already established in the project. Use meaningful names for test files and methods. - -4. Run Existing Tests: Before adding new tests, ensure all current tests pass. This helps confirm a stable baseline. - -5. Iterate and Refactor: Optimize your test cases for readability and maintainability. Avoid duplicating test logic when possible. - -### Writing Tests with Cypress - -- `Component Tests`: Add tests for new components in cypress/components. - -- `E2E Tests`: Add tests for new features or bug fixes in cypress/e2e. - -- `Enhance Existing Tests`: Improve coverage and robustness of existing tests. - -Running Tests - -## Run all tests before submitting a pull request: - ``` - yarn cypress:run:all - ``` - -### Reporting Test Issues - -If you encounter test problems, open an issue describing the issue and steps to reproduce it. - -### Resources - -For additional guidance on writing effective tests, refer to these resources: - -1. [How to Write Test Cases](https://www.coursera.org/articles/how-to-write-test-cases) - Coursera - -2. [Manual Test Cases](https://www.testrail.com/blog/manual-test-cases/) - Testrail - -3. [Effective Test Cases](https://www.testrail.com/blog/effective-test-cases-templates/) - Testrail - -### Submitting Your Tests - - When submitting a pull request that includes tests: - -- `Ensure the test results are included in the pull request description.` - -- `Highlight any areas of concern or cases where additional review is needed.` - -- `Tag @json-schema-org/docs-team for assistance if required.` - ## Create a Pull Request To submit your work to review by the community, open a draft pull request to the `main` upstream branch, and add the issue your pull request solves. Add @json-schema-org/docs-team as a reviewer of your pull request, and let us know in the #documentation Slack channel your pull request is ready for review. From 644048290e444cbf7e47254870d029e9e71767d3 Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Fri, 27 Dec 2024 19:21:39 +0530 Subject: [PATCH 14/15] Update CONTRIBUTING.md --- CONTRIBUTING.md | 71 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e77f68a27..d70dd221a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,25 +119,84 @@ To ensure consistent and effective testing of website components, follow these g - Ensure each test case has a clear objective, preconditions, test steps, and expected results. - Include positive, negative, and edge case scenarios. + - Example + ``` + Test Case ID: TC001 + Title: Verify the login functionality with valid credentials + Objective: Ensure that users can log in with correct credentials + Preconditions: User has a valid account + Test Steps: + 1. Navigate to the login page. + 2. Enter valid username and password. + 3. Click the "Login" button. + Expected Result: User is redirected to the dashboard page. + ``` 3. **Automate Where Possible**: - Write automated tests using Cypress for components and E2E flows. - - Ensure test scripts are reusable and modular. - + - Setup Steps: + + - Install Cypress:``` npm install cypress --save-dev ``` + + - Open Cypress Test Runner: ``` npx cypress open ``` + + - Create test files in the `cypress/components`. + + - Example Automated Test: + ``` + describe('Login Functionality', () => { + it('should log in successfully with valid credentials', () => { + cy.visit('/login'); + cy.get('#username').type('testuser'); + cy.get('#password').type('securepassword'); + cy.get('#login-button').click(); + cy.url().should('include', '/dashboard'); + }); + }); + ``` 4. **Review and Update**: - Regularly review test cases to align with changes in component functionality or design. - - - Update outdated or redundant test cases to maintain relevance. + - Use version control to track updates to test cases and scripts. + - Identify and remove outdated or redundant test cases. 5. **Collaborate with the Team**: - Seek feedback on test cases and scripts from other contributors. - - Discuss edge cases and complex scenarios in the #testing channel in our Slack workspace. - +6. **Testing Best Practices**: + - Ensure tests are: + - Isolated: Avoid dependencies between test cases. + - Repeatable: Tests should produce the same results irrespective of the test environment. + - Fast: Optimize tests to run efficiently. + - Use mocking and stubbing to handle external dependencies (e.g., API calls): + ``` + cy.intercept('POST', '/api/login', { statusCode: 200, body: { token: 'fakeToken' } }); + ``` + - Integrate tests into CI/CD pipelines (e.g., GitHub Actions, Jenkins) to ensure tests run on every pull request: + ``` + name: CI + + on: + pull_request: + branches: + - main + + jobs: + cypress-run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + - run: npm install + - run: npx cypress run + ``` + Following these guidelines will help ensure high-quality testing and contribute to a robust and reliable website. ### โŒจ๏ธ Pull requests From ea645e61d8e5c15d9237e828a261283cfd2e7caf Mon Sep 17 00:00:00 2001 From: shubham yadav <126192924+yadavshubham01@users.noreply.github.com> Date: Sat, 18 Jan 2025 18:18:10 +0530 Subject: [PATCH 15/15] Update CONTRIBUTING.md --- CONTRIBUTING.md | 56 +++++-------------------------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d70dd221a..dc4088287 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,11 +100,11 @@ For more details on our testing setup and how to run tests, please refer to the ### ๐Ÿ”จ Guidelines for Testing Website Components -To ensure consistent and effective testing of website components, follow these guidelines: +To effectively write tests for website components, follow these streamlined instructions: 1. **Understand the Requirements**: - - Review the functionality and design requirements for the component. + - Review component functionality and design. - Refer to the provided resources to understand effective test case design: @@ -119,18 +119,6 @@ To ensure consistent and effective testing of website components, follow these g - Ensure each test case has a clear objective, preconditions, test steps, and expected results. - Include positive, negative, and edge case scenarios. - - Example - ``` - Test Case ID: TC001 - Title: Verify the login functionality with valid credentials - Objective: Ensure that users can log in with correct credentials - Preconditions: User has a valid account - Test Steps: - 1. Navigate to the login page. - 2. Enter valid username and password. - 3. Click the "Login" button. - Expected Result: User is redirected to the dashboard page. - ``` 3. **Automate Where Possible**: @@ -144,24 +132,11 @@ To ensure consistent and effective testing of website components, follow these g - Create test files in the `cypress/components`. - - Example Automated Test: - ``` - describe('Login Functionality', () => { - it('should log in successfully with valid credentials', () => { - cy.visit('/login'); - cy.get('#username').type('testuser'); - cy.get('#password').type('securepassword'); - cy.get('#login-button').click(); - cy.url().should('include', '/dashboard'); - }); - }); - ``` 4. **Review and Update**: - - Regularly review test cases to align with changes in component functionality or design. - - Use version control to track updates to test cases and scripts. - - Identify and remove outdated or redundant test cases. - + - Keep test cases up to date with changes to components. + - Remove outdated tests regularly. + 5. **Collaborate with the Team**: - Seek feedback on test cases and scripts from other contributors. @@ -175,27 +150,6 @@ To ensure consistent and effective testing of website components, follow these g ``` cy.intercept('POST', '/api/login', { statusCode: 200, body: { token: 'fakeToken' } }); ``` - - Integrate tests into CI/CD pipelines (e.g., GitHub Actions, Jenkins) to ensure tests run on every pull request: - ``` - name: CI - - on: - pull_request: - branches: - - main - - jobs: - cypress-run: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm install - - run: npx cypress run - ``` Following these guidelines will help ensure high-quality testing and contribute to a robust and reliable website.