Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions testdriver/acceptance/junit.yaml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]" which is a valid email
address