Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 55 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,15 @@ jobs:
npm install
/sbin/my_init &
node bin/scripts/test.connection.js
npx grunt mochaTest
npx grunt mochaTest

ui-test-dashboard:
runs-on: ubuntu-latest
timeout-minutes: 90

strategy:
matrix:
part: [1, 2]

services:
mongodb:
Expand Down Expand Up @@ -279,7 +285,9 @@ jobs:

- 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"
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
Expand All @@ -305,28 +313,45 @@ jobs:
cp cypress.config.sample.js cypress.config.js
sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js

- name: Run UI tests
- name: Split dashboard test files for parallel execution
shell: bash
working-directory: /opt/countly
working-directory: /opt/countly/ui-tests
run: |
/sbin/my_init &
cd ui-tests
npm install
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
npm run cy:run:dashboard
FILES=($(find cypress/e2e/dashboard -type f -name '*.cy.js' | sort))
SELECTED=()
for i in "${!FILES[@]}"; do
INDEX=$((i % 2 + 1))
if [ "$INDEX" -eq "${{ matrix.part }}" ]; then
SELECTED+=("${FILES[$i]}")
fi
done
echo "SELECTED_SPECS=${SELECTED[*]}" >> $GITHUB_OUTPUT

- name: Run dashboard Cypress tests
run: |
echo "Running specs: ${{ steps.split-dashboard-tests.outputs.SELECTED_SPECS }}"
npx cypress run --browser chrome --spec "${{ steps.split-dashboard-tests.outputs.SELECTED_SPECS }}"

- 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 }}-part-${{ matrix.part }}.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:
runs-on: ubuntu-latest
timeout-minutes: 90

strategy:
matrix:
part: [1, 2]

services:
mongodb:
Expand Down Expand Up @@ -362,7 +387,9 @@ jobs:

- 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"
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
Expand All @@ -384,22 +411,35 @@ jobs:
cp cypress.config.sample.js cypress.config.js
sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js

- name: Run UI tests
- name: Split onboarding test files for parallel execution
shell: bash
working-directory: /opt/countly
working-directory: /opt/countly/ui-tests
run: |
/sbin/my_init &
cd ui-tests
npm install
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
npm run cy:run:onboarding

FILES=($(find cypress/e2e/onboarding -type f -name '*.cy.js' | sort))
SELECTED=()
for i in "${!FILES[@]}"; do
INDEX=$((i % 2 + 1))
if [ "$INDEX" -eq "${{ matrix.part }}" ]; then
SELECTED+=("${FILES[$i]}")
fi
done
echo "SELECTED_SPECS=${SELECTED[*]}" >> $GITHUB_OUTPUT

- name: Run onboarding Cypress tests
run: |
echo "Running specs: ${{ steps.split-onboarding-tests.outputs.SELECTED_SPECS }}"
npx cypress run --browser chrome --spec "${{ steps.split-onboarding-tests.outputs.SELECTED_SPECS }}"


- 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 }}-part-${{ matrix.part }}.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"
6 changes: 5 additions & 1 deletion ui-tests/cypress.config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = defineConfig({
projectId: "000000",
chromeWebSecurity: false,
watchForFileChanges: true,
testReplay: {
enabled: false,
},
video: true,
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
Expand All @@ -36,7 +39,8 @@ module.exports = defineConfig({
launchOptions.args.push("--disable-gpu");
launchOptions.args.push("--disable-dev-shm-usage");
}
launchOptions.args.push('--js-flags="--max_old_space_size=3500 --max_semi_space_size=1024"');
launchOptions.args.push('--js-flags="--max_old_space_size=4096 --max_semi_space_size=1024"');
launchOptions.args.push("--disable-software-rasterizer");
}
return launchOptions;
});
Expand Down
Loading
Loading