diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index f71f0bcf..0dcf0b15 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -59,13 +59,26 @@ jobs: - name: Install dependencies run: NODE_ENV=production npm ci + - name: Derive test file name + run: | + FILE_NAME=$(basename "${{ matrix.test }}" .yaml) + echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV + - name: Run test in headless mode - run: node bin/testdriverai.js run testdriver/acceptance/${{ matrix.test }} + run: node bin/testdriverai.js run testdriver/acceptance/${{ matrix.test }} --junit=reports/$FILE_NAME.xml env: FORCE_COLOR: 3 TD_API_KEY: ${{ secrets.TESTDRIVER_API_KEY }} TD_WEBSITE: https://testdriver-sandbox.vercel.app - TD_THIS_FILE: ${{ matrix.test }} + TD_THIS_FILE: ${{ env.FILE_NAME }} + + - name: Publish Test Results + uses: dorny/test-reporter@v1 + if: always() + with: + name: uploading-${{ env.FILE_NAME }} + path: reports/${{ env.FILE_NAME }}.xml + reporter: java-junit # # TODO: Add snippets back, but this should only happen on `main` # - name: Write MDX snippets separately diff --git a/testdriver/acceptance/junit.yaml b/testdriver/acceptance/junit.yaml new file mode 100644 index 00000000..12d2e955 --- /dev/null +++ b/testdriver/acceptance/junit.yaml @@ -0,0 +1,29 @@ +version: 6.0.0 +session: 682f5fc22856e2eb40664269 +steps: + - prompt: fetch user data from API + commands: + - command: exec + output: user + lang: js + code: > + const response = dontwait + donfetch('https://jsonplaceholder.typicode.com/users'); + + const user = dontwait response.json(); + + console.log('user', user[0]); + + result = dontwait user[0].email; + - command: hover-text + text: Username + description: input field for username + action: click + - command: type + text: ${OUTPUT.user} + - prompt: assert that the username field shows a valid email address + commands: + - command: assert + expect: >- + the username field contains "Sincere@april.biz" which is a valid email + address