forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (139 loc) · 4.51 KB
/
test-selenium.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: "End-to-End tests"
on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
- QA_**
permissions:
contents: read
env:
php-version: "8.2"
jobs:
selenium:
name: "Selenium"
if: "!contains(github.event.head_commit.message, '[ci selenium skip]')"
runs-on: "ubuntu-latest"
services:
database-server:
image: "mysql:5.7"
env:
MYSQL_ROOT_PASSWORD: testbench
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
selenium-server:
image: selenium/standalone-chrome:4
volumes:
- /dev/shm:/dev/shm
options: >-
--health-cmd "/opt/bin/check-grid.sh"
env:
SCREEN_WIDTH: 1920
SCREEN_HEIGHT: 1080
ports:
- "4444:4444"
docker-host-bridge:
# Allow accessing localhost ports from docker containers.
# See https://github.com/qoomon/docker-host
image: qoomon/docker-host
options: >-
--name docker-host-bridge
--hostname docker-host-bridge
--add-host docker-host-bridge:127.0.0.1
--cap-add=NET_ADMIN
--cap-add=NET_RAW
--restart on-failure
strategy:
fail-fast: false
matrix:
test-name:
- "ChangePassword"
- "CreateDropDatabase"
- "CreateRemoveUser"
- "Database/Events"
- "Database/Operations"
- "Database/Procedures"
- "Database/Structure"
- "Export"
- "Import"
- "Login"
- "Normalization"
- "ServerSettings"
- "SqlQuery"
- "Table/Browse"
- "Table/Create"
- "Table/Insert"
- "Table/Operations"
- "Table/Structure"
- "Tracking"
- "Triggers"
- "Xss"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install gettext
run: sudo apt-get update && sudo apt-get install -y gettext
- name: Generate mo files
run: ./bin/generate-mo --quiet
- name: Set up PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: ${{ env.php-version }}
extensions: :opcache, mbstring, iconv, mysqli, zip, gd, bz2
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'yarn'
- name: Install modules
run: yarn install --non-interactive --production
- name: Copy the config
run: cp tests/config.e2e.inc.php config.inc.php
- name: Start server
env:
CI_MODE: selenium
FPM_PATH: php-fpm${{ env.php-version }}
SKIP_STANDALONE: 1
run: |
sudo chown -R runner:docker /var/lib/nginx/
sudo chown -R runner:docker /var/log/nginx/
./tests/start-local-server
echo "SELENIUM_TEMPDIR=$(cat /tmp/last_temp_dir_phpMyAdminTests)" >> $GITHUB_OUTPUT
id: start-local-server
- name: Run Selenium tests
env:
CI_MODE: selenium
TESTSUITE_SELENIUM_BROWSER: chrome
TESTSUITE_USER: root
TESTSUITE_PASSWORD: testbench
# Port defined in tests/nginx.conf
TESTSUITE_URL: http://docker-host-bridge:8000
TESTSUITE_DATABASE_PREFIX: "selenium"
TESTSUITE_SELENIUM_HOST: "127.0.0.1"
TESTSUITE_SELENIUM_PORT: "4444"
run: ./vendor/bin/phpunit --testsuite end-to-end --no-logging --no-coverage --stop-on-skipped --testdox tests/end-to-end/${{ matrix.test-name }}Test.php
- name: Output logs and stop server
env:
CI_MODE: selenium
SELENIUM_TEMPDIR: ${{ steps.start-local-server.outputs.SELENIUM_TEMPDIR }}
if: ${{ success() || failure() }}
run: |
if [ -f "${SELENIUM_TEMPDIR}/php.log" ] ; then cat "${SELENIUM_TEMPDIR}/php.log" ; fi
if [ -f "${SELENIUM_TEMPDIR}/nginx-error.log" ] ; then cat "${SELENIUM_TEMPDIR}/nginx-error.log" ; fi
./tests/stop-local-server
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: selenium-screenshots
path: ${{ github.workspace }}/build/selenium/**/*
retention-days: 3