Add tests via TestDriverAI (#1957)

* initial Commit

* update prerun

* tweak the prompt

* update the test

* finetune prompt

* change the prompt

* minor change to retry test

* add debug

---------

Co-authored-by: Ian Jennings <ian@meetjennings.com>
This commit is contained in:
Tarun Kumar S 2024-10-10 01:48:22 +05:30 committed by GitHub
parent ceeecc37ab
commit 6ad1fa08f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 201 additions and 0 deletions

36
.github/workflows/testdriver.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: TestDriver.ai
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
test:
name: "TestDriver"
runs-on: ubuntu-latest
steps:
- name: Debug - Print masked secret
run: |
if [ -n "${{secrets.TESTDRIVER_API_KEY}}" ];
then
echo "yes the api is there"
else
echo "nope"
fi
- uses: testdriverai/action@main
with:
version: v4.0.44
key: ${{secrets.TESTDRIVER_API_KEY}}
prerun: |
npm install
npm run build
npm install dashcam-chrome --save
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "--load-extension=$(pwd)/node_modules/dashcam-chrome/build", "https://stirlingpdf.io"
Start-Sleep -Seconds 20
prompt: |
1. /run testdriver/test.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FORCE_COLOR: "3"

165
testdriver/test.yml Normal file
View File

@ -0,0 +1,165 @@
version: 4.0.44
steps:
- prompt: open chrome
commands:
- command: focus-application
name: Google Chrome
- prompt: click on view PDF
commands:
- command: focus-application
name: Google Chrome
- command: hover-text
text: View PDF
description: button to view PDF
action: click
- prompt: click on view PDF
commands:
- command: assert
expect: a pdf is open
- prompt: go back to the previous page
commands:
- command: focus-application
name: Google Chrome
- command: press-keys
keys:
- alt
- left
- prompt: go back to the previous page
commands:
- command: assert
expect: it is in homepage
- prompt: >-
click on the globe icon and select Español and check if the texts are in
Spanish
commands:
- command: focus-application
name: Google Chrome
- command: hover-image
description: globe icon in the header
action: click
- command: hover-text
text: Español
description: language option for Spanish
action: click
- command: assert
expect: los textos están en español
- prompt: Change it back to English(US)
commands:
- command: focus-application
name: Google Chrome
- command: hover-image
description: globe icon in the header
action: click
- command: hover-text
text: English (US)
description: language option for English
action: click
- command: assert
expect: The texts are in english
- prompt: >-
click on sun icon in the header section and make sure the theme of the
website changes, if it does then change it back by clicking on the moon
icon at the exact same place
commands:
- command: focus-application
name: Google Chrome
- command: hover-image
description: sun icon in the header section
action: click
- command: assert
expect: the theme of the website has changed
- command: hover-image
description: moon icon in the header section
action: click
- prompt: >-
click on search icon in the header section and search for "rotate", click
on it in the drop down, you will be taken to the rotate pdf page, if so
then go back to the homepage
commands:
- command: focus-application
name: Google Chrome
- command: hover-image
description: search icon in the header section
action: click
- command: type
text: rotate
- command: wait
timeout: 2000
- command: hover-text
text: Rotate
description: dropdown option for rotate
action: click
- command: wait
timeout: 5000
- command: assert
expect: the page title is "Rotate PDF"
- command: press-keys
keys:
- alt
- left
- prompt: >-
click on search bar and search for "rotate", click on it in the drop down,
you will be taken to the rotate pdf page, if so then go back to the
homepage
commands:
- command: focus-application
name: Google Chrome
- command: hover-text
text: Search for features...
description: search bar
action: click
- command: type
text: rotate
- command: wait
timeout: 2000
- command: hover-text
text: Rotate
description: dropdown option for rotate
action: click
- command: wait
timeout: 5000
- command: assert
expect: the page title is "Rotate PDF"
- command: press-keys
keys:
- alt
- left
- command: wait
timeout: 2000
- prompt: >-
click on Tools button in the header section and hover over merge button
and check if the background for the button is changed, similarly hover
over all the rest of the buttons and check for the background of the
button to change
commands:
- command: focus-application
name: Google Chrome
- command: hover-text
text: Tools
description: Tools button in the header section
action: click
- command: hover-text
text: Merge
description: Merge button
action: hover
- command: assert
expect: the background of the Merge button is changed
- command: hover-text
text: PDF to Image
description: PDF to Image button
action: hover
- command: assert
expect: the background of the PDF to Image button is changed
- command: hover-text
text: PDF to CSV
description: PDF to CSV button
action: hover
- command: assert
expect: the background of the PDF to CSV button is changed
- command: hover-text
text: Sign
description: Sign button
action: hover
- command: assert
expect: the background of the Sign button is changed