karol-brejna-i is testing out GitHub Actions 🚀 #143
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: "Manual run of the action" | |
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 | |
on: | |
workflow_dispatch: | |
jobs: | |
readme_whole_page: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
output: readme-full-screenshot.png | |
mode: wholePage | |
- run: | | |
ls -lah *.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ${{ github.workspace }}/*.png | |
readme_page: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: page | |
output: readme-page-screenshot.png | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: element | |
xpath: //table[1] | |
output: element.png | |
- run: | | |
ls -lah *.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ${{ github.workspace }}/*.png | |
setup_chrome: | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
google-chrome --version | |
google-chrome-stable --version | |
- uses: logikal-io/[email protected] | |
with: | |
version: 108.0.5359.94-1 | |
- run: | | |
google-chrome --version | |
google-chrome-stable --version | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
output: dedicated-chrome-screenshot.png | |
mode: wholePage | |
- run: | | |
ls -lah *.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ${{ github.workspace }}/*.png | |
check_text: | |
name: Check if given text is present in the page (here, we are looking for 'world') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions | |
scriptBefore: | | |
if (element.innerText.toUpperCase().includes('WORLD')) { | |
console.log("Found!"); | |
result = true; | |
} else { | |
console.log("Not found!"); | |
result = false; | |
} | |
- run: | | |
ls | |
by_xpath: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: scrollToElement | |
xpath: //table[1] | |
output: scroll-to-element-xpath-screenshot.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: simple-screenshot | |
path: ${{ github.workspace }}/*.png | |
by_selector: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: scrollToElement | |
selector: table | |
output: scroll-to-element-selector-screenshot.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: simple-screenshot | |
path: ${{ github.workspace }}/*.png | |
element_by_xpath: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: element | |
xpath: //table[1] | |
output: element-by-xpath-screenshot.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: simple-screenshot | |
path: ${{ github.workspace }}/*.png | |
element_by_selector: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
with: | |
url: https://github.com/karol-brejna-i/webpage-screenshot-action/blob/main/README.md | |
mode: element | |
xpath: //table[1] | |
output: element-by-selector-screenshot.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: simple-screenshot | |
path: ${{ github.workspace }}/*.png | |
screenshots: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{ steps.screenshot.outputs.scriptResult }} | |
steps: | |
- uses: karol-brejna-i/webpage-screenshot-action@develop | |
id: screenshot | |
with: | |
url: https://google.com | |
- run: | | |
ls | |
job2: | |
runs-on: ubuntu-latest | |
needs: screenshots | |
steps: | |
- run: | | |
echo "-----------------------------------" | |
echo ${{needs.screenshots.outputs.result}} | |
echo "-----------------------------------" |