@@ -244,96 +244,13 @@ jobs:
244244 /sbin/my_init &
245245 node bin/scripts/test.connection.js
246246 npx grunt mochaTest
247- ui-test-dashboard :
248- runs-on : ubuntu-22.04-4core
249247
250- services :
251- mongodb :
252- image : mongo:8.0
253- options : >-
254- --health-cmd mongosh
255- --health-interval 10s
256- --health-timeout 5s
257- --health-retries 5
258- ports :
259- - 27017:27017
260-
261- container :
262- image : countly/countly-core:pipelines-${{ inputs.custom_tag || github.base_ref || github.ref_name }}
263- env :
264- COUNTLY_CONFIG__MONGODB_HOST : mongodb
265- COUNTLY_CONFIG_API_PREVENT_JOBS : true
266-
267- steps :
268- - uses : actions/checkout@v4
269-
270- - name : Install Chrome
271- shell : bash
272- run : |
273- apt update
274- apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb wget
275- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb
276- apt install -y /tmp/chrome.deb
277-
278- - name : Copy code
279- shell : bash
280- run : |
281- rm -rf /opt/countly/frontend
282- rm -rf /opt/countly/plugins/old-ui-compatibility
283- cp -rf ./* /opt/countly
284- cp /opt/countly/frontend/express/config.sample.js /opt/countly/frontend/express/config.js
285- cp /opt/countly/frontend/express/public/javascripts/countly/countly.config.sample.js /opt/countly/frontend/express/public/javascripts/countly/countly.config.js
286-
287- - name : Prepare files to use correct MongoDB host
288- shell : bash
289- run : " sed -i 's/mongosh --quiet/mongosh --host mongodb --quiet/' /opt/countly/bin/backup/import_events.sh && sed -i 's/mongoimport --db/mongoimport --host mongodb --db/' /opt/countly/bin/backup/import_events.sh"
290-
291- - name : NPM install
292- shell : bash
293- working-directory : /opt/countly
294- run : npm install
295-
296- - name : Prepare environment
297- shell : bash
298- working-directory : /opt/countly
299- run : |
300- sed -i 's/port: 3001,/port: 3001, workers: 1,/' /opt/countly/api/config.js
301- cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json"
302- npm install
303- sudo countly task dist-all
304- bash bin/backup/import_events.sh
305- bash bin/scripts/countly.prepare.ce.tests.sh
306- countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}'
307- mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});'
308- mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});'
309- cd ui-tests
310- echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json
311- sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json
312- cp cypress.config.sample.js cypress.config.js
313- sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js
314-
315- - name : Run UI tests
316- shell : bash
317- working-directory : /opt/countly
318- run : |
319- /sbin/my_init &
320- cd ui-tests
321- npm install
322- xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
323- npm run cy:run:dashboard
324-
325- - name : Upload UI tests artifacts
326- if : ${{ failure() }}
327- shell : bash
328- working-directory : /opt/countly/ui-tests/cypress
329- run : |
330- ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz"
331- mkdir -p screenshots videos
332- tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
333- curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"
248+ ui-tests :
249+ runs-on : ubuntu-latest
334250
335- ui-test-onboarding :
336- runs-on : ubuntu-22.04-4core
251+ strategy :
252+ matrix :
253+ test_type : [dashboard, onboarding]
337254
338255 services :
339256 mongodb :
@@ -371,7 +288,7 @@ jobs:
371288 cp -rf ./* /opt/countly
372289 cp /opt/countly/frontend/express/config.sample.js /opt/countly/frontend/express/config.js
373290 cp /opt/countly/frontend/express/public/javascripts/countly/countly.config.sample.js /opt/countly/frontend/express/public/javascripts/countly/countly.config.js
374-
291+
375292 - name : Prepare files to use correct MongoDB host
376293 shell : bash
377294 run : " sed -i 's/mongosh --quiet/mongosh --host mongodb --quiet/' /opt/countly/bin/backup/import_events.sh && sed -i 's/mongoimport --db/mongoimport --host mongodb --db/' /opt/countly/bin/backup/import_events.sh"
@@ -389,7 +306,13 @@ jobs:
389306 cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json"
390307 npm install
391308 sudo countly task dist-all
309+ bash bin/backup/import_events.sh
392310 bash bin/scripts/countly.prepare.ce.tests.sh
311+ if [ "${{ matrix.test_type }}" = "dashboard" ]; then
312+ countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}'
313+ mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});'
314+ mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});'
315+ fi
393316 cd ui-tests
394317 echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json
395318 sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json
@@ -403,15 +326,18 @@ jobs:
403326 /sbin/my_init &
404327 cd ui-tests
405328 npm install
406- xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
407- npm run cy:run:onboarding
329+ if [ "${{ matrix.test_type }}" = "dashboard" ]; then
330+ xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:dashboard
331+ else
332+ xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:onboarding
333+ fi
408334
409335 - name : Upload UI tests artifacts
410336 if : ${{ failure() }}
411337 shell : bash
412338 working-directory : /opt/countly/ui-tests/cypress
413339 run : |
414- ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz"
340+ ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}_${{ matrix.test_type }} .tar.gz"
415341 mkdir -p screenshots videos
416342 tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
417343 curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"
0 commit comments