Playwright Tests #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 14 * * *' | |
jobs: | |
run-tests: | |
name: Run Playwright Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main # Use the main branch here | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Create .env file from secrets | |
run: | | |
echo "CREDENTIALS={\"codioemail\":\"${{ secrets.CODIOEMAIL }}\",\"codiopass\":\"${{ secrets.CODIOPASS }}\"}" > .env | |
- name: Install Dependencies | |
run: npm install | |
- name: Install Browsers | |
run: npx playwright install | |
- name: Install Allure Command-Line Tool | |
run: npm install -g allure-commandline | |
- name: Manage Historical Reports | |
# Remove All json from previous runs and keep the history folder | |
run: | | |
if [ -d "allure-results" ]; then | |
find "allure-results" -type f -name "*.json" -delete | |
fi | |
REPORTS_DIR="allure-results/history" | |
if [ ! -d "$REPORTS_DIR" ]; then | |
mkdir -p "$REPORTS_DIR" | |
fi | |
if [ -d ".github/history" ]; then | |
cp -R ".github/history"/* "$REPORTS_DIR/" | |
fi | |
- name: Run Playwright Tests | |
env: | |
codioemail: secrets.CODIOEMAIL | |
codiopass: secrets.CODIOPASS | |
run: npx playwright test | |
- name: Generate Allure Report | |
run: allure generate allure-results --clean -o allure-report | |
- name: Save historical data | |
# Remove All json from previous runs and keep the history folder | |
run: | | |
if [ -d "allure-report" ]; then | |
cp -R "allure-report/history"/* ".github/history" | |
fi | |
- name: Commit and Push Allure Results and Reports | |
if: always() | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add .github/history | |
git commit -m "Update historical Data Allure" || echo "No changes to commit" | |
git push origin main | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./allure-report |