strapi/CONTRIBUTING.md
Alexandre Bodin 4a615f2db4 test: add e2e tooling
Remove old cypress related files

Update config and reorg tests

Run test app before running playwright tests

feat: add beginning of authentication test

feat: add app template with database dumping ability

chore: pr amends

Run test app before running playwright tests

feat: add beginning of authentication test

feat: add app template with database dumping ability

chore: pr amends

init deits

fix: e2e test

chore: rename to e2e

chore: commit tar for data

Init playwright

Run test app before running playwright tests

feat: add beginning of authentication test

feat: add app template with database dumping ability

chore: pr amends

chore: remove unneeded workflow

fix: add private: true to the template so `test-apps` aren't published

docs: add docs

chore: add warning about DTS caveats

chore: tweak docs

docs(e2e): add correct route to api example for template

chore: fix package.json tests

chore: update from feature/DEITS

chore: updates from DTS

chore: update data-transfer

Update yarn.lock

fix: remove duplicate type

chore(e2e): set up folder structure

fix(e2e): avoid clearing 'admin_' DB tables through DTS or DB Dump

feat(e2e): DTS scripts and backup files

add route to change rate limit

fix wront appPath for API test in CI

no template by default when creating a test app

Fix typo double equal

fix template path for e2e tests

chore(e2e): fix broken signup spec

feat(e2e): basic logout test spec

Login e2e tests

globalSetup attempt

use withAdmin backup

cleanup

fix playwright config & rate limit test

remove example.spec.js

refactor and merge some login tests

Chore: Cleanup login and signup specs

feat(e2e): sign up password error cases

feat(e2e): add homepage expectation to signup spec

refactor(e2e)

refactor(e2e): signUp

refactor(e2e): use global login util for logout and logins specs

Init playwright

fix: remove duplicate type

chore: uncomment transfer route registering

Update yarn.lock

chore: update data-transfer

chore: updates from DTS

chore: update from feature/DEITS

chore: fix package.json tests

docs(e2e): add correct route to api example for template

chore: tweak docs

chore: add warning about DTS caveats

docs: add docs

fix: add private: true to the template so `test-apps` aren't published

chore: remove unneeded workflow

chore: pr amends

feat: add app template with database dumping ability

feat: add beginning of authentication test

Run test app before running playwright tests

Init playwright

chore: commit tar for data

chore: rename to e2e

fix: e2e test

init deits

chore: pr amends

feat: add app template with database dumping ability

feat: add beginning of authentication test

Run test app before running playwright tests

chore: pr amends

feat: add app template with database dumping ability

feat: add beginning of authentication test

Run test app before running playwright tests

Update config and reorg tests

Remove old cypress related files

chore(e2e): cleanup e2e dir

chore(docs): improve e2e testing documentation

chore(docs): PR feedback

chore: tweak action to run browsers in matrix & build packages

chore: fix tests based on merge

chore: shuffle e2e tests and add first conent-type

fix: tests

Make use of yarn linking for api & e2e tests

Chore: Fix running backend unit tests

Chore: Bring opts.run back

Chore: Update playwright

Chore: Update Playwright setup

fix: workflow

chore: fix path to package.json

chore: build ts projects before tests

chore: update e2e workflow

chore: add no-immutable

Use simpler transfer token to avoid misinterpretation

Remove console.log

Ensure that the custom transfer token exists in the e2e test app's database upon startup

Use the custom transfer token for transferring data to the e2e test app

Fix code analysis warning

Define and export a constant for the custom transfer token

Allow passing a custom access key for the transfer token service

chore: add test-apps to workspace

chore: update lockfile
Co-Authored-By: Josh <37798644+joshuaellis@users.noreply.github.com>
Co-Authored-By: Gustav Hansen <gu@stav.dev>
Co-Authored-By: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
Co-Authored-By: Jean-Sébastien Herbaux <25851739+Convly@users.noreply.github.com>
2023-07-25 14:20:49 +01:00

8.9 KiB

Contribute to Strapi

Strapi is an open-source project administered by the Strapi team. We appreciate your interest and efforts to contribute to Strapi. See the LICENSE licensing information. All work done is available on GitHub.

We highly appreciate your effort to contribute, but we recommend you talk to a maintainer before spending a lot of time making a pull request that may not align with the project roadmap. Whether it is from Strapi or contributors, every pull request goes through the same process.

Feature Requests

Feature Requests by the community are highly encouraged. Feel free to submit a new one or upvote an existing feature request on feedback.strapi.io.

Request For Comments (RFC)

Larger chunks of changes to Strapi that might affect many users require a thorough design phase before starting working on a PR. We will do our best to respond as soon as possible, but since we need to discuss these proposals thoroughly, please do not expect them to be merged and accepted immediately.

The Request For Comments process will help us create consensus among the core team and include as much feedback as possible from the community for these upcoming changes.

A Request For Comments has to be created on the strapi/rfcs repository.

Code of Conduct

This project, and everyone participating in it, are governed by the Strapi Code of Conduct. By participating, you are expected to uphold it. Make sure to read the full text to understand which type of actions may or may not be tolerated.

Contributor License Agreement (CLA)

Individual contribution

You need to sign a Contributor License Agreement (CLA) to accept your pull request. You only need to do this once. If you submit a pull request for the first time, you can complete your CLA here, or our CLA bot will automatically ask you to sign before merging the pull request.

Company contribution

If you make contributions to our repositories on behalf of your company, we will need a Corporate Contributor License Agreement (CLA) signed. To do that, please get in touch with us at contributions@strapi.io.

Documentation

Pull requests related to fixing documentation for the latest release should be directed towards the documentation repository. Please follow the documentation contributing guide for more information.

Bugs

Strapi is using GitHub issues to manage bugs. We keep a close eye on them. Before filing a new issue, try to ensure your problem does not already exist.


Before Submitting a Pull Request

The Strapi core team will review your pull request and either merge it, request changes, or close it.

Contribution Prerequisites

  • You have Node.js at version >= v16 and <= v20 and Yarn at v1.2.0+ installed.
  • You are familiar with Git.

Before submitting your pull request make sure the following requirements are fulfilled:

  • Fork the repository and create your new branch from main.
  • Run yarn install in the root of the repository.
  • Run yarn setup in the root of the repository.
  • If you've fixed a bug or added code that should be tested, please make sure to add tests
  • Ensure the following test suites are passing:
    • yarn test:unit
    • yarn test:front
  • Make sure your code lints by running yarn lint.
  • If your contribution fixes an existing issue, please make sure to link it in your pull request.

Development Workflow

1. Fork the repository

Go to the repository and fork it using your own GitHub account.

2. Clone your repository

git clone git@github.com:YOUR_USERNAME/strapi.git

3. Install the dependencies

Go to the root of the repository and run the setup:

cd strapi
yarn install
yarn setup

4. Start the example application

cd ./examples/getstarted
yarn develop

Make sure to read the getstarted application README for more details.

5. Running the administration panel in development mode

Start the administration panel server for development:

cd ./packages/core/admin
yarn develop

The administration panel should now be available at http://localhost:4000/admin. Make sure the example application (step 4) is still running.

Awesome! You are now able to contribute to Strapi.

6. Available commands

  • yarn watch starts yarn watch in all packages.
  • yarn build builds the strapi-helper-plugin (use this command when you develop in the administration panel).
  • yarn setup installs dependencies.
  • yarn lint lints the codebase.
  • yarn test:clean removes the coverage reports.
  • yarn test:front runs front-end related tests.
  • yarn test:front:watch runs an interactive test watcher for the front-end.
  • yarn test:unit runs the back-end unit tests.
  • yarn test:api runs the api integration tests.
  • yarn test:generate-app generates a test application.
  • yarn test:run-app runs a test application.
  • yarn test:start-app starts the test application.

Running the API Integration tests

The API integration tests require a Strapi app to be able to run. You can generate a "test app" using yarn test:generate-app <database>:

$ yarn test:generate-app --db=sqlite
$ yarn test:generate-app --db=postgres
$ yarn test:generate-app --db=mysql

A new app is required every time you run the API integration tests, otherwise the test suite will fail. A command is available to make this process easier: yarn test:api.

This command runs tests using jest behind the scenes. Options for jest can be passed to the command. (e.g. to update snapshots yarn test:api -u).

Changing the database

By default the script run by test:api generates an app that uses sqlite as a database. But you can run the test suites using different databases:

$ yarn test:api --db=sqlite
$ yarn test:api --db=postgres
$ yarn test:api --db=mysql

Running the tests for the Enterprise Edition (EE)

The test suites run the tests for the Community Edition (CE) version of Strapi by default. In order to run the Enterprise Edition tests you need a valid license. To specify a license, you can use the environment variable STRAPI_LICENSE:

$ STRAPI_LICENSE=<license> yarn test:api

Miscellaneous

Repository Organization

We chose to use a monorepo design using Yarn Workspaces in the way React or Babel does. This allows us to maintain the whole ecosystem keep it up-to-date and consistent.

We do our best to keep the master branch as clean as possible, with tests passing at all times. However, the master branch can move faster than the release cycle. Therefore check the releases on npm so that you are always up-to-date with the latest stable version.

Reporting an issue

Before submitting an issue you need to make sure:

  • You are experiencing a technical issue with Strapi.
  • You have already searched for related issues and found none open (if you found a related closed issue, please link to it from your post).
  • You are not asking a question about how to use Strapi or about whether or not Strapi has a certain feature. For general help using Strapi, you may:
  • Your issue title is concise, on-topic, and polite.
  • You provide steps to reproduce the issue.
  • You have tried all the following (if relevant), and your issue remains:
    • Make sure you have the right application started.
    • Make sure the [issue template] is respected.
    • Make sure your issue body is readable and well formatted.
    • Make sure you've stopped the Strapi server with CTRL+C and restarted it.
    • Make sure your application has a clean node_modules directory, meaning:
      • you didn't link any dependencies (e.g., by running yarn link)
      • you haven't made any inline changes to files in the node_modules directory
      • you don't have any global dependency loops. If you aren't sure, the easiest way to double-check any of the above is to run: $ rm -rf node_modules && yarn cache clean && yarn install && yarn setup.