* get tests started * Create opensaas-ci.yml * move github workflows * modify ci scripts * install linebyline * Update package.json * install wait-port * Update package.json * add conditional webserver when in CI env * test tagging action * Update retag-commit.yml * remove unused workflow * add .env file and test stripe webhook * Update e2e-tests.yml * Update e2e-tests.yml * Update e2e-tests.yml * Update e2e-tests.yml * test demo app * Update e2e-tests.yml * update github action versions * disable wasp telemetry * Cleanup running (#72) * improve tests * Update ci-start-app.js * remove npm scripts * Update e2e-tests.yml * Update ci-start-app-with-scripts.js * Update ci-start-app-with-scripts.js * rename test folder * Update e2e-tests.yml * Update e2e-tests.yml * export prisma client from server * Update e2e-tests.yml * Update e2e-tests.yml * Update e2e-tests.yml * Update e2e-tests.yml * Update package-lock.json * install linebyline * add npm scripts * Update package.json * Update paidUserTests.spec.ts * update flaky test * update tsconfig * Update e2e-tests.yml * Update e2e-tests.yml * pin node version to github action * Update e2e-tests.yml * fix retag and clean up * add notes on tag action * Update retag-commit.yml * pr changes part 1 * pr changes part 2 * Setup tests with local Prisma (#86) Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com> * pr changes part 3 * add db naming script * Update package.json * Update package.json * Update package.json * spawn prisma process * Update package.json * move db setup * Update package.json * Update package.json * Update package.json * Update setupDatabaseName.sh * Update package.json * use same process for local and CI testing * Update package.json * wait for app for prisma setup * Update package.json * changes made with martin * stripe clie * Update e2e-tests.yml * Update e2e-tests.yml * update start stripe cli * try again * start testing stripe payments * stripe payment works * fix base url issue & cleanup * Update playwright.config.ts * Update package.json * Update package-lock.json * Update main.wasp * Update utils.ts * Update e2e-tests.yml * Update utils.ts * Update utils.ts * Update e2e-tests.yml * Update actions.ts * Update actions.ts * Update actions.ts * Update actions.ts * Update stripeUtils.ts * Update e2e-tests.yml * catch stripe checkout error * remove console.logs * fix comments, add err catches * fix cache and cache keys * Update .github/workflows/e2e-tests.yml Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Update .github/workflows/e2e-tests.yml Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Update .github/workflows/e2e-tests.yml Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Update .github/workflows/e2e-tests.yml Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Update e2e-tests/playwright.config.ts Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Improve CI caching and other stuff * fix cache key, npm scripts, error handling * Update e2e-tests.yml * Update README.md * add template versioning info --------- Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com> Co-authored-by: Fran Zekan <zekan.fran369@gmail.com> Co-authored-by: Mihovil Ilakovac <mihovil@ilakovac.com> Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
1.8 KiB
Open SaaS e2e Tests with Playwright
These are e2e tests that are written using Playwright for the Open SaaS project.
They not only serve as tests for development of the Open SaaS project, but also as reference examples for how you can implement tests for the app you build with Open SaaS as a template, if you choose to do so.
Running the tests
Locally
First, make sure you've integrated Stripe into your app. This includes installing the Stripe CLI and logging into it with your Stripe account.
Next, Install the test dependencies:
cd e2e-tests && npm install
Start your Wasp DB and leave it running:
cd ../app && wasp db start
Open another terminal and start the Wasp app:
cd app && wasp start
In another terminal, run the local e2e tests:
cd e2e-tests && npm run local:e2e:start
This will start the tests in Playwright's UI mode, which will allow you to see and run the tests in an interactive browser environment. You should also see the Stripe events being triggered in the terminal where the tests were started.
To exit the local e2e tests, go back to the terminal were you started your tests and press ctrl + c
.
CI/CD
In .github/workflows/e2e-tests.yml
, you can see the workflow that runs the headless e2e tests in a CI/CD pipeline via GitHub actions.
In order for these tests to run correctly, you need to provide the environment variables mentioned in the e2e-tests.yml
file within your GitHub repository's "Actions" secrets so that they can be accessed by the tests.
Upon pushing to the repository's main branch, or creating a PR against the main branch, the tests will run in the CI/CD pipeline.