11name : Playwright test
2-
3- on :
4- schedule :
5- - cron : ' 0 2 * * *'
6- workflow_dispatch :
2+ on : ['push', 'pull_request']
73
84jobs :
95 playwright :
106 runs-on : ubuntu-latest
117 container :
128 image : yireo/magento2playwright:2.4.8-p3
9+
1310 env :
1411 GIT_DEPTH : 1
1512 GIT_STRATEGY : fetch
3835 OPENSEARCH_JAVA_OPTS : " -Xms128m -Xmx128m"
3936 OPENSEARCH_INITIAL_ADMIN_PASSWORD : " admin"
4037 MAGENTO_VERSION : " 2.4.8-p3"
41-
4238 GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN }}
4339
4440 services :
4945 MYSQL_USER : magento2
5046 MYSQL_PASSWORD : magento2
5147 MYSQL_ROOT_PASSWORD : root
48+ options : >-
49+ --health-cmd="mysqladmin ping"
50+ --health-interval=10s
51+ --health-timeout=5s
52+ --health-retries=3
5253
5354 redis :
5455 image : redis:latest
56+ options : >-
57+ --health-cmd="redis-cli ping"
58+ --health-interval=10s
59+ --health-timeout=5s
60+ --health-retries=3
5561
5662 opensearch :
5763 image : yireo/opensearch
@@ -75,51 +81,88 @@ jobs:
7581 echo COMPOSER_NAME=`jq '.name' composer.json -r` >> $GITHUB_ENV
7682 echo MAGENTO_MODULE=`jq '.module_name' MODULE.json -r` >> $GITHUB_ENV
7783
78- - name : Configure Yireo GitLab
84+ - name : Setup Magento
7985 if : env.SKIP_JOB != 'true'
8086 run : |
81- test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0
8287 cd /tmp/magento
83- composer config gitlab-domains gitlab.yireo.com
84- composer config --global --auth http-basic.gitlab.yireo.com yireo "${GITLAB_TOKEN}"
85- composer config repositories.loki-third-party composer https://gitlab.yireo.com/api/v4/group/loki-third-party/-/packages/composer/packages.json
86- composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
8788
88- - name : Prepare Magento Playwright setup
89- if : env.SKIP_JOB != 'true'
90- run : |
91- cd "$GITHUB_WORKSPACE"
92- cd /tmp/magento
89+ if [ -n "${GITLAB_TOKEN}" ]; then
90+ composer config gitlab-domains gitlab.yireo.com
91+ composer config --global --auth http-basic.gitlab.yireo.com yireo "${GITLAB_TOKEN}"
92+ composer config repositories.loki-third-party composer https://gitlab.yireo.com/api/v4/group/loki-third-party/-/packages/composer/packages.json
93+ composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
94+ fi
9395
9496 test -f "$GITHUB_WORKSPACE/.github/workflows/composer-additional.sh" && source "$GITHUB_WORKSPACE/.github/workflows/composer-additional.sh"
9597 test -f "$GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh" && source "$GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh"
9698
97- composer config repositories.local-source path " $GITHUB_WORKSPACE"
99+ composer config repositories.local-source "{\"type\": \" path\", \"url\": \" $GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}} "
98100 composer require --prefer-source -- "${COMPOSER_NAME}:@dev" loki-checkout/magento2-core-cli:@dev loki-checkout/magento2-functional-tests:@dev yireo/magento2-enable-module-sequence
99101
100102 $GITHUB_WORKSPACE/.github/workflows/magento-install.sh
101103
104+ bin/magento deploy:mode:set developer
102105 bin/magento module:enable Yireo_EnableModuleSequence
103- bin/magento module:sequence LokiCheckout_FunctionalTests
106+ bin/magento module:sequence LokiCheckout_FunctionalTests
104107 bin/magento module:sequence LokiCheckout_CoreCli
105108 bin/magento module:sequence "${MAGENTO_MODULE}"
106109 bin/magento setup:upgrade
107110 bin/magento loki-checkout:modules:dump
108111
109112 magerun2 config:store:set loki_functional_tests/general/token loki -n
110- cp -R /tmp/magento $GITHUB_WORKSPACE/magento
111113
112- - name : Prepare Magento Playwright setup
114+ echo "Copying Magento to workspace..."
115+ mkdir -p $GITHUB_WORKSPACE/magento/
116+ cp -R /tmp/magento/* $GITHUB_WORKSPACE/magento/
117+
118+ echo "Magento setup complete"
119+
120+ - name : Verify Magento installation
121+ if : env.SKIP_JOB != 'true'
122+ run : |
123+ echo "Verifying Magento installation in workspace..."
124+ ls -la $GITHUB_WORKSPACE/magento/
125+ test -f $GITHUB_WORKSPACE/magento/bin/magento || (echo "ERROR: Magento installation verification failed" && exit 1)
126+ echo "Magento installation verified successfully"
127+
128+ - name : Run Playwright tests
113129 if : env.SKIP_JOB != 'true'
114- uses : docker://mcr.microsoft.com/playwright:v1.57.0-noble
130+ run : |
131+ echo "Starting Playwright tests..."
132+ echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
133+ echo "MAGENTO_MODULE: $MAGENTO_MODULE"
134+
135+ if [ ! -d "$GITHUB_WORKSPACE/magento" ]; then
136+ echo "ERROR: magento directory not found"
137+ exit 1
138+ fi
139+
140+ echo "Navigating to Playwright test directory..."
141+ cd $GITHUB_WORKSPACE/magento/vendor/loki-checkout/magento2-functional-tests/Test/Playwright/
142+
143+ echo "Installing npm dependencies..."
144+ npm install
145+ npx playwright install chromium
146+
147+ echo "Creating .env file..."
148+ printf "TEST_URL=http://127.0.0.1:8888\nTEST_TOKEN=loki\n" > .env
149+ cat .env
150+
151+ echo "Running Playwright tests for project: ${MAGENTO_MODULE}"
152+ CI=true MAGENTO_ROOT=$GITWORK_WORKSPACE/magento npx playwright test --project=${MAGENTO_MODULE}
153+
154+ - name : Upload Playwright report
155+ if : ${{ !cancelled() }}
156+ uses : actions/upload-artifact@v4
157+ with :
158+ name : playwright-report
159+ path : playwright-report/
160+ retention-days : 14
161+
162+ - name : Upload raw test results
163+ if : ${{ failure() }}
164+ uses : actions/upload-artifact@v4
115165 with :
116- args : >
117- bash -lc "
118- cd $GITHUB_WORKSPACE/magento/vendor/loki-checkout/magento2-functional-tests/Test/Playwright/
119- npm install
120- npx playwright install
121- touch .env
122- echo TEST_URL=$MAGENTO_BASE_URL >> .env
123- echo TEST_TOKEN=loki >> .env
124- npx playwright test --project=$MAGENTO_MODULE
125- "
166+ name : test-results
167+ path : test-results/
168+ retention-days : 14
0 commit comments