Files
open-saas/e2e-tests/ci-start-app-and-db.js
vincanger 2d94e28dd2 Playwright tests & CI (#69)
* 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>
2024-04-22 10:43:25 +02:00

42 lines
1.4 KiB
JavaScript

/**
* We use this script rather than running `wasp start` normally in the CI due to an error where prisma hangs due to some stdin issue.
* Running it this way gives us more control over that and avoids it hanging. See https://github.com/wasp-lang/wasp/pull/1218#issuecomment-1599098272.
*/
const cp = require('child_process');
const readline = require('linebyline');
function spawn(name, cmd, args, done) {
try {
const spawnOptions = {
detached: false,
};
const proc = cp.spawn(cmd, args, spawnOptions);
console.log('\x1b[0m\x1b[33m', `Starting ${name} with command: ${cmd} ${args.join(' ')}`, '\x1b[0m');
// We close stdin stream on the new process because otherwise the start-app
// process hangs.
// See https://github.com/wasp-lang/wasp/pull/1218#issuecomment-1599098272.
proc.stdin.destroy();
readline(proc.stdout).on('line', (data) => {
console.log(`\x1b[0m\x1b[33m[${name}][out]\x1b[0m ${data}`);
});
readline(proc.stderr).on('line', (data) => {
console.log(`\x1b[0m\x1b[33m[${name}][err]\x1b[0m ${data}`);
});
proc.on('exit', done);
} catch (error) {
console.error(error);
}
}
// Exit if either child fails
const cb = (code) => {
if (code !== 0) {
process.exit(code);
}
};
spawn('app', 'npm', ['run', 'ci:e2e:start-app'], cb);
spawn('db', 'npm', ['run', 'ci:e2e:start-db'], cb);