first shell script to run frontend tests

This commit is contained in:
anovazzi1 2023-10-09 12:33:04 -03:00
commit d419fd6ee4
2 changed files with 44 additions and 6 deletions

View file

@ -24,7 +24,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
// baseURL: "http://127.0.0.1:3000",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
@ -69,9 +69,16 @@ export default defineConfig({
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
// webServer: [
// {
// command: "npm run backend",
// reuseExistingServer: !process.env.CI,
// timeout: 120 * 1000,
// },
// {
// command: "npm run start",
// url: "http://127.0.0.1:3000",
// reuseExistingServer: !process.env.CI,
// },
// ],
});

31
src/frontend/run-tests.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# Navigate to the project root directory (where the Makefile is located)
cd ../../
# Start the frontend using 'make frontend' in the background
make frontend &
# Give some time for the frontend to start (adjust sleep duration as needed)
sleep 10
#Run frontend only Playwright tests
cd src/frontend && npx playwright test --ui tests/onlyFront
# Start the backend using 'make backend' in the background
make backend &
# Give some time for the backend to start (adjust sleep duration as needed)
sleep 10
# Navigate back to the test directory
cd src/frontend
# Run Playwright tests
npx playwright test --ui tests/end-to-end
# After the tests are finished, you can add cleanup or teardown logic here if needed
# Terminate the background processes (backend and frontend)
pkill -f "make backend"
pkill -f "make frontend"