-
Follow the setup document to set up Appsmith locally and go through the docs. The docs are backed by the appsmith-docs repository.
-
Once we have the setup in place, all dependencies will be available locally for test execution.
-
Cypress tests are located in the
app/client/cypress
directory. -
All the test spec must be in the integration directory only i.e
app/client/cypress/integration
-
You can create directories under
app/client/cypress
but make sure you place the spec within theapp/client/cypress/integration
directory. -
Directory name under
app/client/cypress/integration
suggests the specific area the test belongs to. Example: All our Smoke tests are inapp/client/cypress/integration/Smoke_TestSuite
-
For default settings, check the
app/client/cypress.json
file. -
You can create a local file
app/client/cypress.env.json
to populateUSERNAME
andPASSWORD
env variables or use one of the methods from their docs.{ "USERNAME": "Enter username", "PASSWORD": "Enter password" }
-
Once the
app/client/cypress.env.json
file is ready, we can actually run tests from the cypress client. -
Change your directory to
app/client
. -
Cypress tests can be executed in 2 modes: run mode and open mode. If you are willing to execute tests in headless mode through command line follow run mode else you can use cypress client to run in open mode
-
Command to open cypress client
$(npm bin)/cypress open
Cypress supports Chrome/Firefox/electron browsers. Select a suitable browser and check the status of your tests. -
For run mode, you can use CLI args. Example: To run the entire
Smoke_TestSuite
, use$(npm bin)/cypress run --headless --browser chrome --spec "cypress/integration/Smoke_TestSuite/*/*"
-
If you need help with writing the tests, their syntax or flow, cypress getting started docs is a great starting point.
If you want to add a new env variable to cypress tests, add it to the cypress.env.json
file and also in the documentation above.
All ENV variables from your .env
file and all APPSMITH_*
env variables from process.env
are accessible with the Cypress.env()
method.
Note: This can only be done by the project maintainers. Please contact one of them if you require this step to be accomplished.
-
Go to https://github.com/appsmithorg/appsmith/settings/secrets/actions.
-
Click on "New Repository Secret"
-
Add the secret key & value here. These values will be masked in the CI output logs incase they are printed out.
-
Save the value.
-
In the file
.github/workflows/client.yml
, find the steps named: "Setting up the cypress tests" & "Run the cypress test". These steps are responsible for setting up & executing the Cypress tests. -
Add the env variable there in the form:
YOUR_SECRET_KEY: ${{ secrets.APPSMITH_YOUR_SECRET_KEY }}
-
Commit & push the file
.github/workflows/client.yml
to the default branch (release
). Please remember that the changes to the build file will not take effect unless they are committed against the default branch.