diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8c1e8d9083..f5a1de42e9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -242,92 +242,14 @@ jobs: /sbin/my_init & node bin/scripts/test.connection.js npx grunt mochaTest - ui-test-dashboard: - runs-on: ubuntu-22.04-4core - - services: - mongodb: - image: mongo:8.0 - options: >- - --health-cmd mongosh - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 27017:27017 - - container: - image: countly/countly-core:pipelines-${{ inputs.custom_tag || github.base_ref || github.ref_name }} - env: - COUNTLY_CONFIG__MONGODB_HOST: mongodb - COUNTLY_CONFIG_API_PREVENT_JOBS: true - steps: - - uses: actions/checkout@v4 - - - name: Install Chrome - shell: bash - run: | - apt update - apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb wget - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb - apt install -y /tmp/chrome.deb - - - name: Copy code - shell: bash - run: cp -rf ./* /opt/countly - - - name: Prepare files to use correct MongoDB host - shell: bash - 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" - - - name: NPM install - shell: bash - working-directory: /opt/countly - run: npm install - - - name: Prepare environment - shell: bash - working-directory: /opt/countly - run: | - sed -i 's/port: 3001,/port: 3001, workers: 1,/' /opt/countly/api/config.js - cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json" - npm install - sudo countly task dist-all - bash bin/backup/import_events.sh - bash bin/scripts/countly.prepare.ce.tests.sh - countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}' - mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});' - mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});' - cd ui-tests - echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json - sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json - cp cypress.config.sample.js cypress.config.js - sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js - - - name: Run UI tests - shell: bash - working-directory: /opt/countly - run: | - /sbin/my_init & - cd ui-tests - npm install - xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \ - npm run cy:run:dashboard - - - name: Upload UI tests artifacts - if: ${{ failure() }} - shell: bash - working-directory: /opt/countly/ui-tests/cypress - run: | - ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz" - mkdir -p screenshots videos - tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos - curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME" - - ui-test-onboarding: + ui-tests: runs-on: ubuntu-22.04-4core + strategy: + matrix: + test_type: [dashboard, onboarding] + services: mongodb: image: mongo:8.0 @@ -377,7 +299,13 @@ jobs: cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json" npm install sudo countly task dist-all + bash bin/backup/import_events.sh bash bin/scripts/countly.prepare.ce.tests.sh + if [ "${{ matrix.test_type }}" = "dashboard" ]; then + countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}' + mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});' + mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});' + fi cd ui-tests echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json @@ -391,15 +319,18 @@ jobs: /sbin/my_init & cd ui-tests npm install - xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \ - npm run cy:run:onboarding + if [ "${{ matrix.test_type }}" = "dashboard" ]; then + xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:dashboard + else + xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:onboarding + fi - name: Upload UI tests artifacts if: ${{ failure() }} shell: bash working-directory: /opt/countly/ui-tests/cypress run: | - ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz" + ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}_${{ matrix.test_type }}.tar.gz" mkdir -p screenshots videos tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME" diff --git a/ui-tests/cypress/e2e/onboarding/onboarding.cy.js b/ui-tests/cypress/e2e/onboarding/onboarding.cy.js index f8e356fa619..3461659f394 100644 --- a/ui-tests/cypress/e2e/onboarding/onboarding.cy.js +++ b/ui-tests/cypress/e2e/onboarding/onboarding.cy.js @@ -63,11 +63,8 @@ const { APP_TYPE, DATA_TYPE } = require('../../support/constants'); describe('Complete Onboarding', () => { beforeEach(function() { - navigationHelpers.goToLoginPage(); - }); - - afterEach(function() { cy.dropMongoDatabase(); + navigationHelpers.goToLoginPage(); }); it('should be complete onboarding flow with creating web type demo application', function() {