Skip to content

Commit

Permalink
chore: adding playwright for stage
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Apr 5, 2024
1 parent 947dbec commit c2900ad
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
"type": "header",
"text": {
"type": "plain_text",
"text": ":warning: Synthetic Monitoring Alert - E2E Cypress - Pokeshop Demo :warning:",
"text": ":warning: Synthetic Monitoring Alert - E2E Cypress - Pokeshop Demo STAGE :warning:",
"emoji": true
}
},
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/playwright-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Playwright Tests Stage
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *' # every hour

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
env:
TRACETEST_API_TOKEN: ${{secrets.TRACETEST_TOKEN_STAGE}}
POKESHOP_DEMO_URL: ${{secrets.POKESHOP_DEMO_URL_STAGE}}
TRACETEST_SERVER_URL: https://app-stage.tracetest.io
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Send message on Slack in case of failure
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
# check the block kit builder docs to understand how it works
# and how to modify it: https://api.slack.com/block-kit
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":warning: Synthetic Monitoring Alert - E2E Playwright - Pokeshop Demo STAGE :warning:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:*\nFailed"
},
{
"type": "mrkdwn",
"text": "*Pipeline:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow>"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SYNTETIC_MONITORING_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
4 changes: 2 additions & 2 deletions playwright/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
import Tracetest, { Types } from '@tracetest/playwright';

const { TRACETEST_API_TOKEN = '' } = process.env;
const { TRACETEST_API_TOKEN = '', TRACETEST_SERVER_URL = 'https://app-stage.tracetest.io' } = process.env;

let tracetest: Types.TracetestPlaywright | undefined = undefined;

Expand Down Expand Up @@ -30,7 +30,7 @@ spec:
`;

test.beforeAll(async () => {
tracetest = await Tracetest({ apiToken: TRACETEST_API_TOKEN });
tracetest = await Tracetest({ apiToken: TRACETEST_API_TOKEN, serverUrl: TRACETEST_SERVER_URL, serverPath: '' });

await tracetest.setOptions({
'Playwright: imports a pokemon': {
Expand Down

0 comments on commit c2900ad

Please sign in to comment.