forked from LambdaTest/smartui-node-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 1.97 KB
/
Pr-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: SmartUI PR Check with NodeJS SDK
on:
pull_request:
branches:
- main
- stage
env:
LT_USERNAME: ${{ secrets.LT_USERNAME }}
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
PROJECT_TOKEN: ${{ secrets.PROJECT_TOKEN }}
LT_SDK_DEBUG: true
SMARTUI_DEBUG: true
jobs:
smartui-pr-check:
name: Execute SmartUI PR Check with NodeJS SDK
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Find Last CommitId
run: |
API_HOST=https://api.github.com
# Get the commit ID of the last commit
COMMIT_ID=$(git rev-parse HEAD)
echo "Last commit ID of PR: $COMMIT_ID"
GITHUB_URL=$API_HOST/repos/$GITHUB_REPOSITORY/statuses/$COMMIT_ID
echo "GITHUB_URL: $GITHUB_URL"
echo "GITHUB_URL=$GITHUB_URL" >> $GITHUB_ENV
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Use the appropriate Node.js version for your project
- name: Install SmartUI SDK
run: |
npm install @lambdatest/smartui-cli@latest
npm install @lambdatest/selenium-driver
npm install selenium-webdriver
- name: Set up SmartUI Config
run: |
npx smartui config:create smartui-config.json
- name: Execute SmartUI Tests
run: |
npx smartui --config smartui-config.json exec -- npm run smartui-cloud
env:
SMARTUI_PROJECT_NAME: "your-project-name" # Replace with your SmartUI project name
SMARTUI_BUILD_NAME: ${{ github.sha }}
- name: Check for Visual Changes
run: |
echo "Checking for visual differences..."
- name: Comment on PR with Results
if: failure()
run: |
echo "Visual differences found. Please review the SmartUI report."
# You can add code to post this comment to the PR using GitHub API