mirror of
https://github.com/plankanban/planka.git
synced 2025-08-05 05:25:29 +02:00
add ci workflows to run test
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
This commit is contained in:
parent
8009742ba7
commit
95c8175e8c
4 changed files with 98 additions and 6 deletions
91
.github/workflows/ci-workflows.yml
vendored
Normal file
91
.github/workflows/ci-workflows.yml
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Setup PostgreSQL
|
||||||
|
uses: ikalnytskyi/action-setup-postgres@v5
|
||||||
|
with:
|
||||||
|
port: 5432
|
||||||
|
database: planka
|
||||||
|
username: planka
|
||||||
|
password: planka
|
||||||
|
|
||||||
|
- name: Cache Node.js modules
|
||||||
|
id: cache-npm
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/home/runner/work/planka/planka/node_modules
|
||||||
|
/home/runner/work/planka/planka/client/node_modules
|
||||||
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node_modules-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
cd client
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Save Node.js modules cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/home/runner/work/planka/planka/node_modules
|
||||||
|
/home/runner/work/planka/planka/client/node_modules
|
||||||
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Symbolic fun
|
||||||
|
run: |
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/asset-manifest.json /home/runner/work/planka/planka/server/public/asset-manifest.json
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/favicon.ico /home/runner/work/planka/planka/server/public/favicon.ico
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/logo192.png /home/runner/work/planka/planka/server/public/logo192.png
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/logo512.png /home/runner/work/planka/planka/server/public/logo512.png
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/manifest.json /home/runner/work/planka/planka/server/public/manifest.json
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/robots.txt /home/runner/work/planka/planka/server/public/robots.txt
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/static /home/runner/work/planka/planka/server/public/static
|
||||||
|
ln -s /home/runner/work/planka/planka/client/build/index.html /home/runner/work/planka/planka/server/views/index.ejs
|
||||||
|
|
||||||
|
- name: server setup
|
||||||
|
run: |
|
||||||
|
SECRETKEY=$(openssl rand -hex 64)
|
||||||
|
cd server
|
||||||
|
cp .env.sample .env
|
||||||
|
sed -i 's|^DATABASE_URL=.*|DATABASE_URL=postgresql://planka:planka@localhost/planka|' .env
|
||||||
|
sed -i "s|^SECRET_KEY=.*|SECRET_KEY=${SECRETKEY}/|" .env
|
||||||
|
sed -i 's/^# DEFAULT_ADMIN_EMAIL/DEFAULT_ADMIN_EMAIL/' .env
|
||||||
|
sed -i 's/^# DEFAULT_ADMIN_PASSWORD/DEFAULT_ADMIN_PASSWORD/' .env
|
||||||
|
sed -i 's/^# DEFAULT_ADMIN_NAME/DEFAULT_ADMIN_NAME/' .env
|
||||||
|
sed -i 's/^# DEFAULT_ADMIN_USERNAME/DEFAULT_ADMIN_USERNAME/' .env
|
||||||
|
npm run db:init
|
||||||
|
npm start --prod &
|
||||||
|
|
||||||
|
- name: Wait for development server
|
||||||
|
run: |
|
||||||
|
sudo apt-get install wait-for-it -y
|
||||||
|
wait-for-it -h localhost -p 1337 -t 10
|
||||||
|
|
||||||
|
- name: Run e2e tests
|
||||||
|
run: |
|
||||||
|
cd client
|
||||||
|
npm install
|
||||||
|
npx playwright install chromium
|
||||||
|
npm run test:e2e tests
|
|
@ -8,7 +8,8 @@ setDefaultTimeout(60000);
|
||||||
// launch the browser
|
// launch the browser
|
||||||
BeforeAll(async function () {
|
BeforeAll(async function () {
|
||||||
global.browser = await chromium.launch({
|
global.browser = await chromium.launch({
|
||||||
headless: false,
|
// makes true for CI
|
||||||
|
headless: true,
|
||||||
slowMo: 1000,
|
slowMo: 1000,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,9 +16,9 @@ Feature: login
|
||||||
Then user should see the error message "<message>"
|
Then user should see the error message "<message>"
|
||||||
Examples:
|
Examples:
|
||||||
| username | password | message |
|
| username | password | message |
|
||||||
| spiderman | spidy123 | Invalid e-mail or username |
|
| spiderman | spidy123 | Invalid credentials |
|
||||||
| ironman | iron123 | Invalid e-mail or username |
|
| ironman | iron123 | Invalid credentials |
|
||||||
| aquaman | aqua123 | Invalid e-mail or username |
|
| aquaman | aqua123 | Invalid credentials |
|
||||||
|
|
||||||
|
|
||||||
Scenario: User can log out
|
Scenario: User can log out
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class LoginPage {
|
class LoginPage {
|
||||||
constructor() {
|
constructor() {
|
||||||
// url
|
// url
|
||||||
this.homeUrl = 'http://localhost:3000';
|
this.homeUrl = 'http://localhost:1337';
|
||||||
this.loginUrl = `${this.homeUrl}/login`;
|
this.loginUrl = `${this.homeUrl}/login`;
|
||||||
|
|
||||||
this.loginButtonSelector = `//i[@class="right arrow icon"]`;
|
this.loginButtonSelector = `//i[@class="right arrow icon"]`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue