diff --git a/.github/actions/replay/Dockerfile b/.github/actions/replay/Dockerfile new file mode 100644 index 0000000..97832d3 --- /dev/null +++ b/.github/actions/replay/Dockerfile @@ -0,0 +1,8 @@ +FROM node:iron-alpine + +RUN npm install -g puppeteer @puppeteer/replay + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/.github/actions/replay/entrypoint.sh b/.github/actions/replay/entrypoint.sh new file mode 100644 index 0000000..c0b571b --- /dev/null +++ b/.github/actions/replay/entrypoint.sh @@ -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") diff --git a/.github/workflows/on_prs.yaml b/.github/workflows/on_prs.yaml index c391ed3..dd0886c 100644 --- a/.github/workflows/on_prs.yaml +++ b/.github/workflows/on_prs.yaml @@ -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') diff --git a/user-flows/navigation.json b/user-flows/navigation.json new file mode 100644 index 0000000..a37da78 --- /dev/null +++ b/user-flows/navigation.json @@ -0,0 +1,24 @@ +{ + "title": "creditas-site navigation", + "steps": [ + { + "type": "navigate", + "url": "" + }, + { + "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 + } + ] +}