Skip to content

Commit a2cf29f

Browse files
nilgaarjosephca
andauthored
docs(e2e): contribution guidelines for e2e tests (#1896)
* style more like * add anotation about running on CI * expanding and grouping developer guidelines * add paths ignore for e2e docs * adding Use of External Sources for Validation * reorganization * delete innecessari duplications of principles for new PRs * move e2e contributing file * delete duplicates * +readme.md * relative paths on Update Documentation --------- Co-authored-by: Joseph Kim <[email protected]>
1 parent 4e70265 commit a2cf29f

File tree

3 files changed

+298
-32
lines changed

3 files changed

+298
-32
lines changed

CONTRIBUTING.md

Lines changed: 130 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,79 +6,177 @@ We are excited to see you want to be a part of this project by contributing. Her
66

77
### Clone and Install
88

9-
1. For the repository here in GitHub
10-
2. Clone your forked version of the Showcase app
11-
3. Install dependencies using `yarn install`
12-
4. Run type generation and checks using `yarn tsc`
9+
```bash
10+
git clone https://github.com/your-username/backstage-showcase.git # Clone your forked repository
11+
cd backstage-showcase # Change to the project directory
12+
yarn install # Install dependencies
13+
yarn tsc # Run type generation and checks
14+
```
1315

1416
### Run the Showcase App
1517

16-
We currently have quite a bit of moving parts for the showcase application. As such we have documentation dedicated to the requirements for running the showcase app under [getting-started.md](https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/getting-started.md)
18+
We currently have quite a bit of moving parts for the showcase application. As such, we have documentation dedicated to the requirements for running the showcase app under [getting-started.md](https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/getting-started.md).
19+
20+
### Useful Scripts
1721

18-
Some useful package scripts for the application
22+
Our project uses [Turborepo](https://turbo.build/repo) for running scripts across packages efficiently. Here are some useful scripts used in the project:
1923

20-
```shell
21-
yarn start # Starts the application
22-
yarn tsc # Type generation and checks
23-
yarn test
24-
yarn test:e2e
25-
yarn lint # Lint packages
26-
yarn ci # Mirrors our CI in GitHub
27-
yarn prettier:check # Checks for formatting errors
28-
yarn prettier:fix # Fixes formatting errors
24+
```bash
25+
yarn start # Starts the backend application
26+
yarn dev # Starts both backend and frontend applications
27+
yarn build # Builds all packages
28+
yarn tsc # Runs TypeScript type checks across all packages
29+
yarn test # Runs tests across all packages
30+
yarn lint:check # Checks for linting errors across all packages
31+
yarn lint:fix # Fixes linting errors automatically across all packages
32+
yarn prettier:check # Checks for formatting issues across all packages
33+
yarn prettier:fix # Fixes formatting issues automatically across all packages
34+
yarn clean # Cleans up build artifacts across all packages
2935
```
3036

3137
## Contributions
3238

33-
We welcome code and non-code contributions to our project. Non-code contributions can come in the form of documentation updates, bug reports, enhancement and feature requests.
39+
We welcome code and non-code contributions to our project. Non-code contributions can come in the form of documentation updates, bug reports, enhancement requests, and feature requests.
40+
41+
### Finding Issues to Work On
42+
43+
Want to submit some changes to the code? The best place to start is to look through our issues for [bugs](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3Akind%2Fbug), [good first issues](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22), and [help wanted](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). These are a great starting point for new contributors.
3444

3545
### Bug Reporting
3646

37-
If you found a bug in our showcase app, please submit an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Fbug%2Cstatus%2Ftriage&template=bug.md) describing the problem that you ran into. Some important information to include are steps to reproduce the bug, the app-config.yaml that is being used, and any relevant logs. This will help us narrow down the potential cause of the bug and speed up the time it takes to solve the problem at hand.
47+
If you found a bug in our showcase app, please submit an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Fbug%2Cstatus%2Ftriage&template=bug.md) describing the problem that you ran into. Important information to include:
48+
49+
- Steps to reproduce the bug
50+
- The `app-config.yaml` that is being used (**remember to remove all secrets before sharing**)
51+
- Any relevant logs
3852

39-
**Please remember to remove all secrets from the app-config.yaml before sharing.**
53+
This will help us narrow down the potential cause of the bug and speed up the time it takes to solve the problem at hand.
4054

4155
### Updating Backstage Dependencies
4256

43-
1. Run the following command
57+
To update Backstage dependencies, run the following command:
4458

45-
```console
46-
yarn versions:all
47-
```
59+
```bash
60+
yarn versions:bump # Updates Backstage dependencies
61+
```
4862

4963
### Enhancement Requests
5064

51-
Want an enhancement of a feature or workflow, you can submit an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Fenhancement%2Cstatus%2Ftriage&template=enhancement.md) describing the enhancement. Maybe you see a feature that we could provide a better experience to. This would be that opportunity to call it out. It is important to include in the issue what you are wanting to see improved, what the current behavior is, and what the new behavior you wish to see.
65+
If you want an enhancement of a feature or workflow, you can submit an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Fenhancement%2Cstatus%2Ftriage&template=enhancement.md) describing the enhancement. Include:
66+
67+
- What you are wanting to see improved
68+
- The current behavior
69+
- The new behavior you wish to see
5270

5371
### Feature Requests
5472

55-
Want to see a new feature within the showcase app, file an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Ffeature%2Cstatus%2Ftriage&template=feature.md) detailing the new feature. Sometimes we don't know about the latest and greatest and this issue is a great way for you to communicate that to us. Be sure to include information on what you are trying to achieve with the new issue, what you will need, who will have access, and any relevant documentation / information on the new feature.
73+
If you want to see a new feature within the showcase app, file an [issue](https://github.com/janus-idp/backstage-showcase/issues/new?assignees=&labels=kind%2Ffeature%2Cstatus%2Ftriage&template=feature.md) detailing the new feature. Include:
74+
75+
- What you are trying to achieve with the new feature
76+
- What you will need
77+
- Who will have access
78+
- Any relevant documentation or information on the new feature
5679

5780
### Documentation
5881

59-
Documentation is another option for contributing to us. If there is documentation that is unclear or could use some TLC, please raise an issue.
82+
Documentation is another option for contributing to us. If there is documentation that is unclear or could use some improvements, please raise an issue or submit a pull request.
6083

6184
### Pull Requests
6285

63-
Want to submit some changes to the code? The best place to start is to look through our issues for [bugs](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3Akind%2Fbug), [good first issues](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22), and [help wanted](https://github.com/janus-idp/backstage-showcase/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). Be sure to include a description of the changes made, which issue this PR will fix (if any), PR acceptance criteria, and any special notes to the reviewers.
86+
If you want to submit code changes to the project, here are some guidelines:
6487

65-
Before submitting the PR, it is important to run some of our package scripts to ensure that the code changes will pass our CI workflow. These include running `yarn lint` `yarn prettier:write` `yarn test` `yarn test:e2e` and `yarn build`. This saves time from having to go back and make changes to your PR.
88+
1. **Create a Branch**
89+
90+
```bash
91+
git checkout -b your-feature-branch # Create a new branch for your feature
92+
```
6693

67-
A special note. If there will be changes to the [app config](https://github.com/janus-idp/backstage-showcase/blob/main/app-config.yaml), we ask that [documentation](https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/getting-started.md) be updated if it will be a requirement for running the app. We also ask to ensure that the app will still work in the case of dummy information being supplied to the app config. While it is not a hard requirement, it does help others with quickly being able to get up and running with the showcase app.
94+
2. **Implement Your Changes**
6895

69-
### Adding statically linked plugins for frontend and backend
96+
Make your code changes, ensuring that you follow the project's coding standards and best practices.
97+
98+
3. **Testing**
99+
100+
- **Run Tests:** Ensure all tests pass before committing.
101+
102+
```bash
103+
yarn test # Run unit tests
104+
cd e2e-tests
105+
yarn showcase # Run e2e tests
106+
```
107+
108+
_For more on the e2e, check the [e2e contributing guidelines](./docs/e2e-tests/CONTRIBUTING.MD)_
109+
110+
- **Note on Environment Dependencies:**
111+
112+
- If your new or edited code can't be validated locally due to environment dependencies, you can open a **draft Pull Request (PR)**. This allows the tests to run on the test environment as described in our CI documentation.
113+
114+
4. **Linting and Formatting**
115+
116+
Ensure your code passes linting and formatting checks.
117+
118+
```bash
119+
yarn lint:check # Checks for linting errors
120+
yarn lint:fix # Fixes linting errors automatically
121+
yarn prettier:check # Checks for formatting issues
122+
yarn prettier:fix # Fixes formatting issues automatically
123+
```
70124
71-
When contributing a new @internal plugin into this repo, you must remember to add the plugin to the Dockerfiles under the section titled `Stage 2 - Install dependencies`:
125+
5. **Ensure CI Passes**
126+
127+
Your contributions will need to pass the Continuous Integration (CI) tests for pull requests.
128+
129+
6. **Commit Changes**
130+
131+
Use meaningful commit messages following the [Conventional Commits](https://www.conventionalcommits.org/) specification.
132+
133+
```bash
134+
git commit -m "feat: add new feature" # Commit your changes with a meaningful message
135+
```
136+
137+
7. **Update Documentation**
138+
139+
If there will be changes to the [app config](app-config.yaml), we ask that [documentation](README.md#getting-started) be updated if it will be a requirement for running the app. We also ask to ensure that the app will still work in the case of dummy information being supplied to the app config. While it is not a hard requirement, it does help others with quickly being able to get up and running with the showcase app.
140+
141+
8. **Push to Your Fork**
142+
143+
```bash
144+
git push origin your-feature-branch # Push your branch to your fork
145+
```
146+
147+
9. **Open a Pull Request**
148+
149+
Go to the original repository and click on **New Pull Request**. Provide a clear description of your changes, including any issues your PR fixes, acceptance criteria, and any special notes to the reviewers.
150+
151+
## Commit Messages
152+
153+
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
154+
155+
- `feat`: A new feature.
156+
- `fix`: A bug fix.
157+
- `docs`: Documentation changes.
158+
- `style`: Code style changes (formatting, missing semi-colons, etc.).
159+
- `refactor`: Code changes that neither fix a bug nor add a feature.
160+
- `test`: Adding or correcting tests.
161+
- `chore`: Changes to the build process or auxiliary tools.
162+
163+
### Adding Statically Linked Plugins for Frontend and Backend
164+
165+
When contributing a new `@internal` plugin into this repo, you must remember to add the plugin to the Dockerfiles under the section titled `Stage 2 - Install dependencies`:
72166
73167
- [Upstream Dockerfile](.rhdh/docker/Dockerfile)
74168
- [Downstream Dockerfile](docker/Dockerfile)
75169
76170
For example:
77171
78-
```
172+
```dockerfile
79173
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-plugins-info/package.json ./plugins/dynamic-plugins-info/package.json
80174
```
81175
82176
## Support
83177
84-
You can reach out to us in our [community slack channel](https://join.slack.com/t/janus-idp/shared_invite/zt-1pxtehxom-fCFtF9rRe3vFqUiFFeAkmg) if you run into any issues with setup, running, or testing the application. Members of the team and community can assist you with questions and concerns you might have. Even if you don't need help, please consider joining and being involved in our community.
178+
You can reach out to us in our [community Slack channel](https://join.slack.com/t/janus-idp/shared_invite/zt-1pxtehxom-fCFtF9rRe3vFqUiFFeAkmg) if you run into any issues with setup, running, or testing the application. Members of the team and community can assist you with questions and concerns you might have. Even if you don't need help, please consider joining and being involved in our community.
179+
180+
## License
181+
182+
By contributing, you agree that your contributions will be licensed under the [Apache-2.0 License](https://github.com/janus-idp/backstage-showcase/blob/main/LICENSE).

docs/e2e-tests/CONTRIBUTING.MD

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributing
2+
3+
We are excited that you want to be a part of this project by contributing to the end-to-end tests. Here is some information on how to get started, as well as our requirements and guidelines to ensure a smooth contribution process.
4+
5+
## Getting Started
6+
7+
Before you begin, please ensure you have followed the general setup instructions in the main [Contributing Guide](../../CONTRIBUTING.md) to clone the repository and install dependencies.
8+
**The [Readme](README.md) file contains practical information about the e2e project**
9+
10+
## Contribution Guidelines
11+
12+
We welcome both code and non-code contributions to our project. Non-code contributions can come in the form of documentation updates, enhancement requests, and new test requests.
13+
14+
### Developer Guidelines
15+
16+
These principles are valid for new contributions. Some parts of the codebase may not adhere yet to these principles, but improvements should be made in that direction.
17+
18+
#### Architectural Principles
19+
20+
1. **Naming Convention**
21+
22+
A naming convention is enforced for all entities, including variables, functions, and file names. Consistent naming ensures code clarity, maintainability, and ease of navigation throughout the project.
23+
24+
2. **Code Visibility**
25+
26+
Carefully consider the visibility of all classes, variables, and functions. Exposed elements should be simple and understandable on the frontend while being versatile and resilient in the background. This promotes a clean and user-friendly API while maintaining robust internal functionality.
27+
28+
3. **Test Isolation**
29+
30+
All tests should be written to be as isolated as possible. Even if current constraints (such as GitHub login rate limits) prevent complete independence, strive for maximum isolation. This approach ensures that when blockers are removed, refactoring can proceed smoothly.
31+
32+
4. **Control Over Test Environment**
33+
34+
The test framework must have full control over the test environment. All environment configurations should be managed and propagated up to the Node.js layer, when possible. This ensures that the test environtment can be set up in case-to-case bases.
35+
36+
5. **Team Agreement on Architecture Principles**
37+
38+
All architecture principles and guidelines must be agreed upon by the team. Every team member's voice is important, and open communication ensures alignment and shared understanding of the project's direction.
39+
40+
#### Technical Guidelines
41+
42+
1. **Page Object Model (POM)**
43+
44+
The Page Object Model (POM) design pattern is required for all test code. Until we find a better-suited standard, we adhere to this well-known and well-tested pattern to promote code reusability and maintainability.
45+
46+
2. **Playwright Best Practices**
47+
48+
We follow Playwright best practices, including the use of fixtures. Adhering to these practices ensures that our tests are reliable, efficient, and maintainable. Please refer to the [Playwright Best Practices](https://playwright.dev/docs/best-practices) and [Fixtures](https://playwright.dev/docs/test-fixtures) documentation for guidance.
49+
50+
3. **Avoid Using `uiHelper` in Spec Files**
51+
52+
- The `uiHelper` utility should not be used directly in spec files. The reason for that is that some methods in this class are too generic and sometimes it is difficult to point what they are intended. Idellay, they shall be called from inside a POM that states what thay are looking for.
53+
- Use `uiHelper` methods only within the Page Object Model (POM) classes.
54+
- When working with tests that directly use `uiHelper` in spec files, refactor them to move `uiHelper` usage into POM classes.
55+
- This ensures that all UI interactions are encapsulated within page objects, promoting cleaner and more maintainable test code.
56+
57+
4. **Use External Sources for Validation**
58+
59+
- **Avoid Hardcoded Data in Tests**
60+
61+
- When validating frontend results in your end-to-end tests, use external sources of truth such as APIs or databases instead of hardcoded information.
62+
- This approach ensures that tests are more robust and accurately reflect the dynamic nature of the application data.
63+
64+
### Adding New Tests
65+
66+
When contributing new tests or modifying existing ones, please adhere to the guidelines.
67+
To open a PR, follow the steps described in the [general contribution guide](../../CONTRIBUTING.md)
68+
69+
### Collaboration and Communication
70+
71+
- **Team Consensus:**
72+
73+
- Engage with the team when introducing significant changes. Ensure that architectural decisions are agreed upon collectively.
74+
75+
- **Open Communication:**
76+
77+
- Encourage discussion and feedback. All voices are important in shaping the project's direction.

0 commit comments

Comments
 (0)