Skip to content

Commit dc28a79

Browse files
committed
feat: add Playwright test job to master workflow
1 parent b498245 commit dc28a79

File tree

1 file changed

+113
-1
lines changed

1 file changed

+113
-1
lines changed

.github/workflows/dotnet-core-master.yml

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,116 @@ jobs:
161161
- name: Build
162162
run: dotnet build eform-angular-workflow-plugin/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn.sln
163163
- name: Unit Tests
164-
run: dotnet test --no-restore -c Release -v n eform-angular-workflow-plugin/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn.Test/Workflow.Pn.Test.csproj
164+
run: dotnet test --no-restore -c Release -v n eform-angular-workflow-plugin/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn.Test/Workflow.Pn.Test.csproj workflow-playwright-test:
165+
needs: workflow-build
166+
runs-on: ubuntu-22.04
167+
strategy:
168+
fail-fast: false
169+
matrix:
170+
test: [a,b,c,d]
171+
steps:
172+
- uses: actions/checkout@v3
173+
with:
174+
path: eform-angular-workflow-plugin
175+
- name: Extract branch name
176+
id: extract_branch
177+
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
178+
- name: Create docker network
179+
run: docker network create --driver bridge data
180+
- name: Start MariaDB
181+
run: |
182+
docker pull mariadb:10.8
183+
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
184+
- name: Start rabbitmq
185+
run: |
186+
docker pull rabbitmq:latest
187+
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password rabbitmq:latest
188+
- uses: actions/download-artifact@v4
189+
with:
190+
name: workflow-container
191+
- run: docker load -i workflow-container.tar
192+
- name: Use Node.js
193+
uses: actions/setup-node@v3
194+
with:
195+
node-version: 22
196+
- name: 'Preparing Frontend checkout'
197+
uses: actions/checkout@v3
198+
with:
199+
repository: microting/eform-angular-frontend
200+
ref: ${{ steps.extract_branch.outputs.branch }}
201+
path: eform-angular-frontend
202+
- name: Sleep 15 seconds
203+
run: sleep 15
204+
- name: Load DB dump
205+
run: |
206+
mysql -u root -h 127.0.0.1 --password=secretpassword -e 'create database `420_eform-angular-workflow-plugin`'
207+
mysql -u root -h 127.0.0.1 --password=secretpassword 420_eform-angular-workflow-plugin < eform-angular-workflow-plugin/420_eform-angular-workflow-plugin.sql
208+
- name: Copy dependencies
209+
run: |
210+
cp -av eform-angular-workflow-plugin/eform-client/src/app/plugins/modules/workflow-pn eform-angular-frontend/eform-client/src/app/plugins/modules/workflow-pn
211+
mkdir -p eform-angular-frontend/eform-client/playwright/e2e/plugins/
212+
cp -av eform-angular-workflow-plugin/eform-client/playwright/e2e/plugins/workflow-pn eform-angular-frontend/eform-client/playwright/e2e/plugins/workflow-pn
213+
cp -av eform-angular-workflow-plugin/eform-client/playwright.config.ts eform-angular-frontend/eform-client/playwright.config.ts
214+
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
215+
cd eform-angular-frontend/eform-client && ../../eform-angular-workflow-plugin/testinginstallpn.sh
216+
- name: Start the newly build Docker container
217+
id: docker-run
218+
run: docker run --name my-container -p 4200:5000 --network data microtingas/workflow-container:latest "/ConnectionString=host=mariadbtest;Database=420_Angular;user=root;password=secretpassword;port=3306;Convert Zero Datetime = true;SslMode=none;" > docker_run_log 2>&1 &
219+
- name: Sleep 15 seconds
220+
run: sleep 15
221+
- name: Get standard output
222+
run: cat docker_run_log
223+
- name: Pretest changes to work with Docker container
224+
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
225+
- name: yarn install
226+
run: cd eform-angular-frontend/eform-client && yarn install
227+
- name: Install Playwright browsers
228+
run: cd eform-angular-frontend/eform-client && npx playwright install --with-deps chromium
229+
- name: DB Configuration
230+
uses: cypress-io/github-action@v4
231+
with:
232+
start: echo 'hi'
233+
wait-on: "http://localhost:4200"
234+
wait-on-timeout: 120
235+
browser: chrome
236+
record: false
237+
spec: cypress/e2e/db/*
238+
config-file: cypress.config.ts
239+
working-directory: eform-angular-frontend/eform-client
240+
command-prefix: "--"
241+
- name: Change rabbitmq hostname
242+
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
243+
- name: Enable plugins
244+
if: matrix.test != 'a'
245+
run: |
246+
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
247+
docker restart my-container
248+
sleep 15
249+
- name: Get standard output
250+
run: |
251+
cat docker_run_log
252+
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
253+
if [ $result -ne 1 ];then exit 1; fi
254+
- name: Wait for app
255+
run: npx wait-on http://localhost:4200 --timeout 120000
256+
- name: ${{ matrix.test }} playwright test
257+
run: |
258+
cd eform-angular-frontend/eform-client
259+
npx playwright test playwright/e2e/plugins/workflow-pn/${{ matrix.test }}/
260+
- name: Stop the newly build Docker container
261+
run: docker stop my-container
262+
- name: Get standard output
263+
run: |
264+
cat docker_run_log
265+
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
266+
if [ $result -ne 1 ];then exit 1; fi
267+
- name: Get standard output
268+
if: ${{ failure() }}
269+
run: cat docker_run_log
270+
- name: Archive Playwright report
271+
if: failure()
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: playwright-report-${{ matrix.test }}
275+
path: eform-angular-frontend/eform-client/playwright-report/
276+
retention-days: 2

0 commit comments

Comments
 (0)