Skip to content

Container debug 3

Container debug 3 #51

Workflow file for this run

name: Test
on: [push, pull_request]
jobs:
CypressMockTests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [1, 2, 3, 4, 5] # Creates 5 parallel executions for Cypress tests.
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '18.x'
- name: Install Node.js packages for Cypress
run: npm install
- name: Get test files
id: test-files
run: |
echo "Current working directory:"
pwd
TEST_DIR="frontend/src/__tests__/cypress/cypress/tests/mocked"
echo "Listing contents of the current directory:"
ls -la
echo "Checking for test files in $TEST_DIR"
echo "Listing contents of frontend/src/__tests__/cypress/cypress/tests:"
ls -la frontend/src/__tests__/cypress/cypress/tests/
if [ -d "$TEST_DIR" ]; then
echo "Listing contents of mocked directory:"
ls -la "$TEST_DIR"
TEST_FILES=$(find "$TEST_DIR" -name "*.cy.ts" | tr '\n' ',')
echo "Found test files: $TEST_FILES"
echo "files=$TEST_FILES" >> $GITHUB_OUTPUT
else
echo "Directory does not exist. No test files found." >> $GITHUB_OUTPUT
echo "files=" >> $GITHUB_OUTPUT # Set empty output if no files found
fi
- name: Run Cypress Mock Tests in Parallel
env:
CONTAINER_INDEX: ${{ matrix.container }}
run: |
echo "Running Cypress tests for container $CONTAINER_INDEX..."
cd ./frontend && npm run test:cypress-ci -- --headless --no-sandbox --spec $(echo "$TEST_FILES" | tr ',' '\n' | awk -v container="$CONTAINER_INDEX" 'NR % 5 == container - 1' | tr '\n' ',')
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: cypress-results-${{ strategy.job-index }}
path: ./frontend/src/__tests__/cypress/results/
overwrite: true