1
0
Fork 0
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:
nabim777 2024-09-01 09:32:59 +05:45
parent 8009742ba7
commit 95c8175e8c
No known key found for this signature in database
GPG key ID: 6EBA146273BEC371
4 changed files with 98 additions and 6 deletions

91
.github/workflows/ci-workflows.yml vendored Normal file
View 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

View file

@ -8,7 +8,8 @@ setDefaultTimeout(60000);
// launch the browser
BeforeAll(async function () {
global.browser = await chromium.launch({
headless: false,
// makes true for CI
headless: true,
slowMo: 1000,
});
});

View file

@ -15,10 +15,10 @@ Feature: login
When user logs in with username "<username>" and password "<password>" using the webUI
Then user should see the error message "<message>"
Examples:
| username | password | message |
| spiderman | spidy123 | Invalid e-mail or username |
| ironman | iron123 | Invalid e-mail or username |
| aquaman | aqua123 | Invalid e-mail or username |
| username | password | message |
| spiderman | spidy123 | Invalid credentials |
| ironman | iron123 | Invalid credentials |
| aquaman | aqua123 | Invalid credentials |
Scenario: User can log out

View file

@ -1,7 +1,7 @@
class LoginPage {
constructor() {
// url
this.homeUrl = 'http://localhost:3000';
this.homeUrl = 'http://localhost:1337';
this.loginUrl = `${this.homeUrl}/login`;
this.loginButtonSelector = `//i[@class="right arrow icon"]`;