|
1 | 1 | # smartui-github-testing |
2 | 2 |
|
3 | | - |
4 | 3 | For Testing Github App Integration with SmartUI |
5 | 4 |
|
6 | | -- Just do a commit |
7 | 5 |
|
| 6 | + |
| 7 | +### Getting Started Github App Integration with SmartUI Product - Selenium Automation |
| 8 | + |
| 9 | +Steps 1: Setup Github App with lambdatest from link github setup |
| 10 | + |
| 11 | +- Using OAuth |
| 12 | + |
| 13 | +- Cloud, or |
| 14 | + |
| 15 | +- Self Hosted |
| 16 | + |
| 17 | + |
| 18 | +Step 2: Once setup is done, you will see like |
| 19 | + |
| 20 | + |
| 21 | +Step 3: Now you need to setup a sample repository where your test case are mentioned, [smartui-github-testing](https://github.com/LambdaTest/smartui-github-testing) |
| 22 | + |
| 23 | +Step 4: For Github Status updates on PR/ commit need to add capabilities in test suite, code snippet |
| 24 | + |
| 25 | +``` |
| 26 | + github: { |
| 27 | + "url": "https://api.github.com/repos/OWNER/REPO/statuses/commitId", |
| 28 | + "owner": "{OWNER}", //Optional |
| 29 | + "repo": "{REPO}", //Optional |
| 30 | + "commit": "{commitId}" //Optional |
| 31 | + }, |
| 32 | +``` |
| 33 | + |
| 34 | +Step5: How to get the github.url value in test suite |
| 35 | + |
| 36 | +Here we have taken an example of github action to get the github.url |
| 37 | + |
| 38 | +Add below steps in your github action file .github/workflows/ci.yml |
| 39 | +``` |
| 40 | + name: Execute SmartUI Test with Github App Integration |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v1 |
| 44 | +
|
| 45 | + - name: Create commit status |
| 46 | + run: | |
| 47 | + API_HOST=https://api.github.com |
| 48 | + # Check out the PR branch |
| 49 | + git checkout $GITHUB_HEAD_REF |
| 50 | + # Get the commit ID of the last commit |
| 51 | + COMMIT_ID=$(git rev-parse HEAD) |
| 52 | + echo "Last commit ID of PR: $COMMIT_ID" |
| 53 | + GITHUB_URL=$API_HOST/repos/$GITHUB_REPOSITORY/statuses/$COMMIT_ID |
| 54 | + echo "GITHUB_URL: $GITHUB_URL" |
| 55 | + echo "GITHUB_URL=$GITHUB_URL" >> $GITHUB_ENV |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | +Step 6: Commit you changes over git on a branch and raise the PR to main branch |
| 60 | + |
| 61 | +Step 7: Now you will see the `lambdatest-smartui-app` check in the PR |
0 commit comments