Skip to content

Commit

Permalink
Instagram CI (webrecorder#5)
Browse files Browse the repository at this point in the history
* instagram behavior:
- add new status messages
- open first post in new window, inject behaviors with autofetch into new window, close when done
- add ci for instagram behavior test with profile
- ensure all tests use behaviors.js from current branch added as volume
- add logged in twitter behavior with profile
- load profiles from config specified in environment (loading from DigitalOcean)
- use browsertrix image as specified in $BROWSERTRIX_IMAGE env var loaded from test.env 
- Update README.md with badges for new tests
  • Loading branch information
ikreymer authored Mar 24, 2021
1 parent 24facc1 commit f666ca3
Show file tree
Hide file tree
Showing 16 changed files with 305 additions and 72 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/autoscroll.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull webrecorder/browsertrix-crawler
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run webrecorder/browsertrix-crawler crawl --url https://www.iana.org/numbers --limit 1 --logging behaviors --behaviors autoplay,autofetch,autoscroll > ./log
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js $BROWSERTRIX_IMAGE crawl --url https://www.iana.org/numbers --limit 1 --logging behaviors --behaviors autoplay,autofetch,autoscroll > ./log

- name: cat log
run: cat ./log
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/instagram.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Instagram Behavior (Logged In)"

on:
push:
pull_request:
schedule:
- cron: '15 1 * * *'

jobs:
instagram_test:
environment: DigitalOcean
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
SOURCE: 's3://dh-preserve/test-profiles/instagram/instagram.tar.gz'
DEST: './profile.tar.gz'

- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js -v $PWD/profile.tar.gz:/profile.tar.gz $BROWSERTRIX_IMAGE crawl --url https://instagram.com/capturesample --limit 1 --logging behaviors --profile /profile.tar.gz > ./log

- name: cat log
run: cat ./log

- name: compare crawl log to expected
run: grep '"state"' ./log | diff - ./test/expected-instagram.log

51 changes: 51 additions & 0 deletions .github/workflows/twitter-logged-in.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Twitter Behavior (Logged In)"

on:
push:
pull_request:
schedule:
- cron: '14 1 * * *'

jobs:
twitter_logged_in_test:
environment: DigitalOcean
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
SOURCE: 's3://dh-preserve/test-profiles/twitter/twitter.tar.gz'
DEST: './profile.tar.gz'

- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js -v $PWD/profile.tar.gz:/profile.tar.gz $BROWSERTRIX_IMAGE crawl --url https://twitter.com/CaptureSample --limit 1 --logging behaviors --profile /profile.tar.gz > ./log

- name: cat log
run: cat ./log

- name: compare crawl log to expected
run: grep '"state"' ./log | diff - ./test/expected-twitter-logged-in.log

8 changes: 6 additions & 2 deletions .github/workflows/twitter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull webrecorder/browsertrix-crawler
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js webrecorder/browsertrix-crawler crawl --url https://twitter.com/CaptureSample --limit 1 --logging behaviors > ./log
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js $BROWSERTRIX_IMAGE crawl --url https://twitter.com/CaptureSample --limit 1 --logging behaviors > ./log

- name: cat log
run: cat ./log
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/vimeo-autoplay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull webrecorder/browsertrix-crawler
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run -v $PWD/crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://oembed.link/https://vimeo.com/1084537 --limit 1 --generateCDX --collection test
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js -v $PWD/crawls:/crawls $BROWSERTRIX_IMAGE crawl --url https://oembed.link/https://vimeo.com/1084537 --limit 1 --generateCDX --collection test

- name: check mp4 capture
run: grep '"video/mp4"' ./crawls/collections/test/indexes/index.cdxj
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/youtube-autoplay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: install requirements
run: yarn install

- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: test/test.env

- name: get browsertrix image
run: docker pull webrecorder/browsertrix-crawler
run: docker pull $BROWSERTRIX_IMAGE

- name: run crawl
run: docker run -v $PWD/crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://oembed.link/https://www.youtube.com/watch?v=aT-Up5Y4uRI --limit 1 --generateCDX --collection test
run: docker run -v $PWD/dist/behaviors.js:/app/node_modules/browsertrix-behaviors/dist/behaviors.js -v $PWD/crawls:/crawls $BROWSERTRIX_IMAGE crawl --url https://oembed.link/https://www.youtube.com/watch?v=aT-Up5Y4uRI --limit 1 --generateCDX --collection test

- name: check mp4 capture
run: grep '"video/mp4"' ./crawls/collections/test/indexes/index.cdxj
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Browsertrix Behaviors

[![Twitter Behavior](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter.yaml)

[![Autoscroll Behavior](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/autoscroll.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/autoscroll.yaml)

[![Autoplay Behavior: Youtube](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/youtube-autoplay.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/youtube-autoplay.yaml)

[![Autoplay Behavior: Vimeo](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/vimeo-autoplay.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/vimeo-autoplay.yaml)

[![Instagram Behavior (Logged In)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/instagram.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/instagram.yaml)

[![Twitter Behavior](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter.yaml)

[![Twitter Behavior (Logged In)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter-logged-in.yaml/badge.svg)](https://github.com/webrecorder/browsertrix-behaviors/actions/workflows/twitter-logged-in.yaml)


A set of behaviors injected into the browser to perform certain operations on a page, such as scrolling, fetching additional URLs, or performing
customized actions for social-media sites.
Expand Down
Loading

0 comments on commit f666ca3

Please sign in to comment.