Skip to content

Commit

Permalink
🔥 feat : added automated script for taking 📸
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-madhurendra committed Feb 5, 2024
1 parent 6b82da9 commit 41237ce
Show file tree
Hide file tree
Showing 5 changed files with 1,208 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/frontendBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
sonarscan:
if: ( startsWith(github.head_ref, 'FE_') && github.event.pull_request.merged == false ) || ( github.event_name == 'push' )
if: (startsWith(github.head_ref, 'FE_') && github.event.pull_request.merged == false) || (github.event_name == 'push')
name: FE Sonar Analysis
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -50,4 +50,10 @@ jobs:
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Take Snapshot of Coverage
run:
cd ../script/
npm install puppeteer
node fe-coverage-script.js
1 change: 1 addition & 0 deletions script/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 21 additions & 0 deletions script/fe-coverage-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const puppeteer = require('puppeteer');

async function takeScreenshot() {
const browser = await puppeteer.launch();
const page = await browser.newPage();

try {
await page.goto('https://sonarcloud.io/summary/overall?id=dev-madhurendra_short-my-url-frontend', {
waitUntil: 'networkidle0',
timeout: 60000,
});

await page.screenshot({ path: '../coverage/FE-SONAR-COVERAGE.png', fullPage: true });
} catch (error) {
console.error('Error during navigation:', error);
} finally {
await browser.close();
}
}

takeScreenshot();
Loading

0 comments on commit 41237ce

Please sign in to comment.