-
Notifications
You must be signed in to change notification settings - Fork 7
168 lines (142 loc) · 6.05 KB
/
playwright.yml
File metadata and controls
168 lines (142 loc) · 6.05 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
name: Playwright test
on: ['push', 'pull_request']
jobs:
playwright:
runs-on: ubuntu-latest
container:
image: yireo/magento2playwright:2.4.8-p3
env:
GIT_DEPTH: 1
GIT_STRATEGY: fetch
MAGENTO_BASE_URL: "http://127.0.0.1:8888/"
MAGENTO_BACKEND_FRONTNAME: "admin"
MAGENTO_ADMIN_FIRSTNAME: "CI"
MAGENTO_ADMIN_LASTNAME: "User"
MAGENTO_ADMIN_EMAIL: "admin@example.com"
MAGENTO_ADMIN_USER: "admin"
MAGENTO_ADMIN_PASSWORD: "Admin123!@#"
MAGENTO_LANGUAGE: "en_US"
MAGENTO_CURRENCY: "USD"
MAGENTO_TIMEZONE: "UTC"
MAGENTO_USE_REWRITES: "1"
MAGENTO_SEARCH_ENGINE: "opensearch"
COMPOSER_ALLOW_SUPERUSER: "1"
COMPOSER_MEMORY_LIMIT: "-1"
MYSQL_HOST: "mysql"
MYSQL_USER: "magento2"
MYSQL_PASSWORD: "magento2"
MYSQL_DATABASE: "magento2"
MYSQL_ROOT_PASSWORD: "root"
MYSQL_PORT: "3306"
OPENSEARCH_HOST: "opensearch"
OPENSEARCH_PORT: "9200"
OPENSEARCH_JAVA_OPTS: "-Xms128m -Xmx128m"
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "admin"
MAGENTO_VERSION: "2.4.8-p3"
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
services:
mysql:
image: yireo/mariadb:10
env:
MYSQL_DATABASE: magento2
MYSQL_USER: magento2
MYSQL_PASSWORD: magento2
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
redis:
image: redis:latest
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
opensearch:
image: yireo/opensearch
env:
OPENSEARCH_JAVA_OPTS: "-Xms128m -Xmx128m"
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "admin"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Detecting Playwright tests
run: |
test -d $GITHUB_WORKSPACE/Test/Playwright || echo "SKIP_JOB=true" >> $GITHUB_ENV
- name: Setting up module variables
if: env.SKIP_JOB != 'true'
run: |
echo COMPOSER_NAME=`jq '.name' composer.json -r` >> $GITHUB_ENV
echo MAGENTO_MODULE=`jq '.module_name' MODULE.json -r` >> $GITHUB_ENV
- name: Setup Magento
if: env.SKIP_JOB != 'true'
run: |
cd /tmp/magento
if [ -n "${GITLAB_TOKEN}" ]; then
composer config gitlab-domains gitlab.yireo.com
composer config --global --auth http-basic.gitlab.yireo.com yireo "${GITLAB_TOKEN}"
composer config repositories.loki-third-party composer https://gitlab.yireo.com/api/v4/group/loki-third-party/-/packages/composer/packages.json
composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
fi
test -f "$GITHUB_WORKSPACE/.github/workflows/composer-additional.sh" && source "$GITHUB_WORKSPACE/.github/workflows/composer-additional.sh"
test -f "$GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh" && source "$GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh"
composer config repositories.local-source "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
composer require --prefer-source -- "${COMPOSER_NAME}:@dev" loki-checkout/magento2-core-cli:@dev loki-checkout/magento2-functional-tests:@dev yireo/magento2-enable-module-sequence
$GITHUB_WORKSPACE/.github/workflows/magento-install.sh
bin/magento deploy:mode:set developer
bin/magento module:enable Yireo_EnableModuleSequence
bin/magento module:sequence LokiCheckout_FunctionalTests
bin/magento module:sequence LokiCheckout_CoreCli
bin/magento module:sequence "${MAGENTO_MODULE}"
bin/magento setup:upgrade
bin/magento loki-checkout:modules:dump
magerun2 config:store:set loki_functional_tests/general/token loki -n
echo "Copying Magento to workspace..."
mkdir -p $GITHUB_WORKSPACE/magento/
cp -R /tmp/magento/* $GITHUB_WORKSPACE/magento/
echo "Magento setup complete"
- name: Verify Magento installation
if: env.SKIP_JOB != 'true'
run: |
echo "Verifying Magento installation in workspace..."
ls -la $GITHUB_WORKSPACE/magento/
test -f $GITHUB_WORKSPACE/magento/bin/magento || (echo "ERROR: Magento installation verification failed" && exit 1)
echo "Magento installation verified successfully"
- name: Run Playwright tests
if: env.SKIP_JOB != 'true'
run: |
echo "Starting Playwright tests..."
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
echo "MAGENTO_MODULE: $MAGENTO_MODULE"
if [ ! -d "$GITHUB_WORKSPACE/magento" ]; then
echo "ERROR: magento directory not found"
exit 1
fi
echo "Navigating to Playwright test directory..."
cd $GITHUB_WORKSPACE/magento/vendor/loki-checkout/magento2-functional-tests/Test/Playwright/
echo "Installing npm dependencies..."
npm install
npx playwright install chromium
echo "Creating .env file..."
printf "TEST_URL=http://127.0.0.1:8888\nTEST_TOKEN=loki\n" > .env
cat .env
echo "Running Playwright tests for project: ${MAGENTO_MODULE}"
CI=true MAGENTO_ROOT=$GITWORK_WORKSPACE/magento npx playwright test --project=${MAGENTO_MODULE}
- name: Upload Playwright report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload raw test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
retention-days: 14