Skip to content

Commit

Permalink
feat: wip user-flows with puppeteer replay
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Mangabeira Gregio committed Feb 16, 2024
1 parent b20e4c2 commit 1361389
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/actions/replay/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:iron-alpine

RUN npm install -g puppeteer @puppeteer/replay

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

11 changes: 11 additions & 0 deletions .github/actions/replay/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -l

read -d '' COMMAND <<-EOF
if [ -f "$HOME/ignore" ] && grep "^ignore:$BUILD_DIR" "$HOME/ignore"; then
echo "$BUILD_DIR didn't change"
else
${BUILD_COMMAND:-echo} && npx @puppeteer/replay $*
fi
EOF

OUTPUT=$(sh -c "$COMMAND")
5 changes: 5 additions & 0 deletions .github/workflows/on_prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
uses: ./.github/actions/affected
id: checkForAffected

replay:
uses: ./github/actions/replay
with:
args: user-flows

articles-app:
needs: [affected]
if: contains(needs.affected.outputs.affected, 'articles-app')
Expand Down
24 changes: 24 additions & 0 deletions user-flows/navigation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"title": "creditas-site navigation",
"steps": [
{
"type": "navigate",
"url": "<https://www.creditas.com/?experiment=CRMIT-015b>"
},
{
"type": "waitForElement",
"target": "main",
"selectors": [
"aria/Use seu carro, imóvel ou salário e tenha o melhor crédito"
],
"visible": true
},
{
"type": "click",
"target": "main",
"selectors": [["xpath///*[@data-testid=\"button-cta\"]"]],
"offsetY": 18,
"offsetX": 111
}
]
}

0 comments on commit 1361389

Please sign in to comment.