Skip to content

Commit c422853

Browse files
authored
Merge pull request #1311 from microting/feature/playwright-migration
Feature/playwright migration
2 parents ebb34c6 + f5aee9b commit c422853

9 files changed

+737
-82
lines changed

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

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ jobs:
2626
- name: Copy dependencies
2727
run: |
2828
cp -av eform-angular-outer-inner-resource-plugin/eform-client/src/app/plugins/modules/outer-inner-resource-pn eform-angular-frontend/eform-client/src/app/plugins/modules/outer-inner-resource-pn
29-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-settings eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-settings
30-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-general eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-general
31-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Page\ objects/OuterInnerResource eform-angular-frontend/eform-client/e2e/Page\ objects/OuterInnerResource
32-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-headless-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.ts
33-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
3429
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
3530
cd eform-angular-frontend/eform-client && ../../eform-angular-outer-inner-resource-plugin/testinginstallpn.sh
3631
- name: Get the version release
@@ -51,9 +46,13 @@ jobs:
5146
with:
5247
name: outer-inner-resource-container
5348
path: outer-inner-resource-container.tar
54-
outer-inner-resource-test:
49+
outer-inner-resource-playwright-test:
5550
needs: outer-inner-resource-build
56-
runs-on: ubuntu-latest
51+
runs-on: ubuntu-22.04
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
test: [a,b]
5756
steps:
5857
- uses: actions/checkout@v3
5958
with:
@@ -62,7 +61,7 @@ jobs:
6261
id: extract_branch
6362
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
6463
- name: Create docker network
65-
run: docker network create --driver bridge data
64+
run: docker network create --driver bridge --attachable data
6665
- name: Start MariaDB
6766
run: |
6867
docker pull mariadb:10.8
@@ -85,25 +84,14 @@ jobs:
8584
repository: microting/eform-angular-frontend
8685
ref: ${{ steps.extract_branch.outputs.branch }}
8786
path: eform-angular-frontend
88-
- name: Cache node_modules
89-
id: cache
90-
uses: actions/cache@v3
91-
with:
92-
path: eform-angular-frontend/eform-client/node_modules
93-
key: ${{ runner.os }}-build-${{ hashFiles('eform-angular-frontend/eform-client/package.json') }}
94-
restore-keys: |
95-
${{ runner.os }}-build-
96-
${{ runner.os }}-
9787
- name: Sleep 15 seconds
9888
run: sleep 15
9989
- name: Copy dependencies
10090
run: |
10191
cp -av eform-angular-outer-inner-resource-plugin/eform-client/src/app/plugins/modules/outer-inner-resource-pn eform-angular-frontend/eform-client/src/app/plugins/modules/outer-inner-resource-pn
102-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-settings eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-settings
103-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-general eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-general
104-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Page\ objects/OuterInnerResource eform-angular-frontend/eform-client/e2e/Page\ objects/OuterInnerResource
105-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-headless-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.ts
106-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
92+
mkdir -p eform-angular-frontend/eform-client/playwright/e2e/plugins/
93+
cp -av eform-angular-outer-inner-resource-plugin/eform-client/playwright/e2e/plugins/outer-inner-resource-pn eform-angular-frontend/eform-client/playwright/e2e/plugins/outer-inner-resource-pn
94+
cp -av eform-angular-outer-inner-resource-plugin/eform-client/playwright.config.ts eform-angular-frontend/eform-client/playwright.config.ts
10795
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
10896
cd eform-angular-frontend/eform-client && ../../eform-angular-outer-inner-resource-plugin/testinginstallpn.sh
10997
- name: Start the newly build Docker container
@@ -114,37 +102,51 @@ jobs:
114102
- name: Get standard output
115103
run: cat docker_run_log
116104
- name: Pretest changes to work with Docker container
117-
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
105+
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/playwright/e2e/Constants/DatabaseConfigurationConstants.ts
118106
- name: yarn install
119107
run: cd eform-angular-frontend/eform-client && yarn install
120-
if: steps.cache.outputs.cache-hit != 'true'
108+
- name: Install Playwright browsers
109+
run: cd eform-angular-frontend/eform-client && npx playwright install --with-deps chromium
110+
- name: Wait for app
111+
run: npx wait-on http://localhost:4200 --timeout 120000
121112
- name: DB Configuration
122-
uses: cypress-io/github-action@v4
123-
with:
124-
start: echo 'hi'
125-
wait-on: "http://localhost:4200"
126-
wait-on-timeout: 120
127-
browser: chrome
128-
record: false
129-
spec: cypress/e2e/db/*
130-
config-file: cypress.config.ts
131-
working-directory: eform-angular-frontend/eform-client
132-
command-prefix: "--"
113+
run: cd eform-angular-frontend/eform-client && npx playwright test playwright/e2e/Tests/database-configuration/
133114
- name: Change rabbitmq hostname
134115
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
135-
- name: Plugin testing
136-
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin
116+
- name: Get standard output
117+
run: |
118+
cat docker_run_log
119+
result=`cat docker_run_log | grep "Now listening on:.*:5000" -m 1 | wc -l`
120+
if [ $result -ne 1 ];then exit 1; fi
121+
- name: Enable plugin
122+
if: matrix.test != 'a'
123+
run: |
124+
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
125+
docker restart my-container
126+
sleep 15
127+
- name: Wait for app
128+
run: npx wait-on http://localhost:4200 --timeout 120000
129+
- name: ${{ matrix.test }} playwright test
130+
run: |
131+
cd eform-angular-frontend/eform-client
132+
npx playwright test playwright/e2e/plugins/outer-inner-resource-pn/${{ matrix.test }}/
137133
- name: Stop the newly build Docker container
138134
run: docker stop my-container
139135
- name: Get standard output
140136
run: |
141137
cat docker_run_log
142-
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
138+
result=`cat docker_run_log | grep "Now listening on:.*:5000" -m 1 | wc -l`
143139
if [ $result -ne 1 ];then exit 1; fi
144-
- name: The job has failed
140+
- name: Get standard output
145141
if: ${{ failure() }}
146-
run: |
147-
cat docker_run_log
142+
run: cat docker_run_log
143+
- name: Archive Playwright report
144+
if: failure()
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: playwright-report-${{ matrix.test }}
148+
path: eform-angular-frontend/eform-client/playwright-report/
149+
retention-days: 2
148150
outer-inner-resource-dotnet-test:
149151
runs-on: ubuntu-latest
150152
steps:

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

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ jobs:
2323
- name: Copy dependencies
2424
run: |
2525
cp -av eform-angular-outer-inner-resource-plugin/eform-client/src/app/plugins/modules/outer-inner-resource-pn eform-angular-frontend/eform-client/src/app/plugins/modules/outer-inner-resource-pn
26-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-settings eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-settings
27-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-general eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-general
28-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Page\ objects/OuterInnerResource eform-angular-frontend/eform-client/e2e/Page\ objects/OuterInnerResource
29-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-headless-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.ts
30-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
3126
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
3227
cd eform-angular-frontend/eform-client && ../../eform-angular-outer-inner-resource-plugin/testinginstallpn.sh
3328
- name: Get the version release
@@ -48,19 +43,27 @@ jobs:
4843
with:
4944
name: outer-inner-resource-container
5045
path: outer-inner-resource-container.tar
51-
outer-inner-resource-test:
46+
outer-inner-resource-playwright-test:
5247
needs: outer-inner-resource-build
53-
runs-on: ubuntu-latest
48+
runs-on: ubuntu-22.04
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
test: [a,b]
5453
steps:
5554
- uses: actions/checkout@v3
5655
with:
5756
path: eform-angular-outer-inner-resource-plugin
5857
- name: Create docker network
59-
run: docker network create --driver bridge data
58+
run: docker network create --driver bridge --attachable data
6059
- name: Start MariaDB
6160
run: |
6261
docker pull mariadb:10.8
6362
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
63+
- name: Start rabbitmq
64+
run: |
65+
docker pull rabbitmq:latest
66+
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password rabbitmq:latest
6467
- uses: actions/download-artifact@v4
6568
with:
6669
name: outer-inner-resource-container
@@ -75,25 +78,14 @@ jobs:
7578
repository: microting/eform-angular-frontend
7679
ref: stable
7780
path: eform-angular-frontend
78-
- name: Cache node_modules
79-
id: cache
80-
uses: actions/cache@v3
81-
with:
82-
path: eform-angular-frontend/eform-client/node_modules
83-
key: ${{ runner.os }}-build-${{ hashFiles('eform-angular-frontend/eform-client/package.json') }}
84-
restore-keys: |
85-
${{ runner.os }}-build-
86-
${{ runner.os }}-
8781
- name: Sleep 15 seconds
8882
run: sleep 15
8983
- name: Copy dependencies
9084
run: |
9185
cp -av eform-angular-outer-inner-resource-plugin/eform-client/src/app/plugins/modules/outer-inner-resource-pn eform-angular-frontend/eform-client/src/app/plugins/modules/outer-inner-resource-pn
92-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-settings eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-settings
93-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Tests/outer-inner-resource-general eform-angular-frontend/eform-client/e2e/Tests/outer-inner-resource-general
94-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/e2e/Page\ objects/OuterInnerResource eform-angular-frontend/eform-client/e2e/Page\ objects/OuterInnerResource
95-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-headless-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.ts
96-
cp -av eform-angular-outer-inner-resource-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
86+
mkdir -p eform-angular-frontend/eform-client/playwright/e2e/plugins/
87+
cp -av eform-angular-outer-inner-resource-plugin/eform-client/playwright/e2e/plugins/outer-inner-resource-pn eform-angular-frontend/eform-client/playwright/e2e/plugins/outer-inner-resource-pn
88+
cp -av eform-angular-outer-inner-resource-plugin/eform-client/playwright.config.ts eform-angular-frontend/eform-client/playwright.config.ts
9789
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
9890
cd eform-angular-frontend/eform-client && ../../eform-angular-outer-inner-resource-plugin/testinginstallpn.sh
9991
- name: Start the newly build Docker container
@@ -104,37 +96,51 @@ jobs:
10496
- name: Get standard output
10597
run: cat docker_run_log
10698
- name: Pretest changes to work with Docker container
107-
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
99+
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/playwright/e2e/Constants/DatabaseConfigurationConstants.ts
108100
- name: yarn install
109101
run: cd eform-angular-frontend/eform-client && yarn install
110-
if: steps.cache.outputs.cache-hit != 'true'
102+
- name: Install Playwright browsers
103+
run: cd eform-angular-frontend/eform-client && npx playwright install --with-deps chromium
104+
- name: Wait for app
105+
run: npx wait-on http://localhost:4200 --timeout 120000
111106
- name: DB Configuration
112-
uses: cypress-io/github-action@v4
113-
with:
114-
start: echo 'hi'
115-
wait-on: "http://localhost:4200"
116-
wait-on-timeout: 120
117-
browser: chrome
118-
record: false
119-
spec: cypress/e2e/db/*
120-
config-file: cypress.config.ts
121-
working-directory: eform-angular-frontend/eform-client
122-
command-prefix: "--"
107+
run: cd eform-angular-frontend/eform-client && npx playwright test playwright/e2e/Tests/database-configuration/
123108
- name: Change rabbitmq hostname
124109
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
125-
- name: Plugin testing
126-
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin
110+
- name: Get standard output
111+
run: |
112+
cat docker_run_log
113+
result=`cat docker_run_log | grep "Now listening on:.*:5000" -m 1 | wc -l`
114+
if [ $result -ne 1 ];then exit 1; fi
115+
- name: Enable plugin
116+
if: matrix.test != 'a'
117+
run: |
118+
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
119+
docker restart my-container
120+
sleep 15
121+
- name: Wait for app
122+
run: npx wait-on http://localhost:4200 --timeout 120000
123+
- name: ${{ matrix.test }} playwright test
124+
run: |
125+
cd eform-angular-frontend/eform-client
126+
npx playwright test playwright/e2e/plugins/outer-inner-resource-pn/${{ matrix.test }}/
127127
- name: Stop the newly build Docker container
128128
run: docker stop my-container
129129
- name: Get standard output
130130
run: |
131131
cat docker_run_log
132-
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
132+
result=`cat docker_run_log | grep "Now listening on:.*:5000" -m 1 | wc -l`
133133
if [ $result -ne 1 ];then exit 1; fi
134-
- name: The job has failed
134+
- name: Get standard output
135135
if: ${{ failure() }}
136-
run: |
137-
cat docker_run_log
136+
run: cat docker_run_log
137+
- name: Archive Playwright report
138+
if: failure()
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: playwright-report-${{ matrix.test }}
142+
path: eform-angular-frontend/eform-client/playwright-report/
143+
retention-days: 2
138144
outer-inner-resource-dotnet-test:
139145
runs-on: ubuntu-latest
140146
steps:

eform-client/playwright.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './playwright/e2e',
5+
fullyParallel: false,
6+
workers: 1,
7+
timeout: 120_000,
8+
use: {
9+
baseURL: 'http://localhost:4200',
10+
viewport: { width: 1920, height: 1080 },
11+
video: 'retain-on-failure',
12+
screenshot: 'only-on-failure',
13+
trace: 'retain-on-failure',
14+
},
15+
projects: [
16+
{
17+
name: 'chromium',
18+
use: { ...devices['Desktop Chrome'] },
19+
},
20+
],
21+
});

0 commit comments

Comments
 (0)