Executes Playwright commands within a bash shell

The previous implementation encountered issues with command execution within the docker container. This change wraps the Playwright commands in a bash shell, ensuring proper execution and resolving potential errors during the report merging and related processes.
This commit is contained in:
maguire-arman 2025-07-10 14:03:53 -04:00
parent 9e121c906c
commit 36fa8fb3f3

View file

@ -247,20 +247,23 @@ jobs:
export PLAYWRIGHT_PATH="${{ parameters.playwrightTestsPath }}"
export JIRA_CARD_NUMBER="$JIRA_CARD_NUMBER"
container_id=$(docker create \
--ipc=host \
--env-file "${{ parameters.envFileName }}" \
-e JIRA_CARD_NUMBER="$JIRA_CARD_NUMBER" \
${{ parameters.dockerImageName }}:${{ parameters.imageTag }} \
echo 'Moving Playwright reports out of subfolders...'; \
find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; ; \
echo 'Merging reports...'; \
PLAYWRIGHT_JUNIT_OUTPUT_DIR='/app/test-results' PLAYWRIGHT_JUNIT_OUTPUT_NAME='junit_results.xml' npx --prefix $PLAYWRIGHT_PATH playwright merge-reports ./playwright-reports; \
echo 'Contents of ortoni-report:' && ls ./ortoni-report; \
echo 'Current dir: ' && pwd; \
echo 'Contents of current dir: ' && ls; \
echo 'Contents of /app/test-results' && ls /app/test-results; \
bash -c "
echo 'Moving Playwright reports out of subfolders...'
find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;
echo 'Merging reports...'
PLAYWRIGHT_JUNIT_OUTPUT_DIR='/app/test-results' PLAYWRIGHT_JUNIT_OUTPUT_NAME='junit_results.xml' npx --prefix $PLAYWRIGHT_PATH playwright merge-reports ./playwright-reports
echo 'Contents of ortoni-report:' && ls ./ortoni-report
echo 'Current dir: ' && pwd
echo 'Contents of current dir: ' && ls
echo 'Contents of /app/test-results' && ls /app/test-results
"
)
# Start container and stream logs
echo "Starting merge"
docker start -a $container_id