Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests via TestDriverAI #1957

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

chottuthejimmy
Copy link

@chottuthejimmy chottuthejimmy commented Sep 24, 2024

Description

This PR contains the test cases to test the basic functionality of the stirling.io webpage.
The tests are written using testdriverai a next gen automation AI agent for end-to-end testing of web and desktop application.

Overview

This PR adds TestDriver tests that I generated using the testdriverai npm package. Instead of using selectors, TestDriver uses prompts and AI vision to complete tasks. This means the tests will still work even when code and design changes.

Another huge benefit is we can test PDF input and output because tests operate at the OS level.
You can see the schema of supported commands here.

Test Cases

  • Opens Google Chrome and interacts with various UI elements like buttons and icons.
  • Verifies opening and viewing of a PDF file.
  • Navigates back to the homepage after certain actions.
  • Changes the language from English to Spanish and back, verifying text translations.
  • Toggles the website theme using sun and moon icons.
  • Searches for specific terms and verifies correct navigation to related pages.
  • Hovers over buttons like "Merge" and checks for visual feedback (background changes).

Setup

In order to complete this PR you’ll need to add a API key as a GitHub action secret. Follow the directions here for more info.
Once you sign up, let us know your email and we’ll enroll you in the open source program for free Pro account.

Here's how to add more tests :

  • Install the testdriverai package via npm and start by creating tests by just prompting the cli using natural language prompts ( you can check the prompts field in the test file for motivation )
  • Once you are done writing the tests, just push it to the repo, here's where the magic happens.
  • Whenever there's a new PR, the VMs (maintained by us) will clone the feature branch and performs the tests and returns the result along with the screen recordings and its logs (thanks to dashcam.io)
  • Also feel free to check out our docs on how to improve performance and techniques like parallel testing

What’s next

We can set this up to build feature branches using our prerun scripts.

Checklist

  • I have read the Contribution Guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have read the section Add New Translation Tags (for new translation tags only)

testdriver/test.yml Outdated Show resolved Hide resolved
@ianjennings
Copy link

@Frooodle We need your approval to run the workflow.

CleanShot 2024-09-24 at 12 28 52

@Frooodle
Copy link
Member

I believe I need the
key: ${{secrets.TESTDRIVER_API_KEY}}

As well?
Additionally we should set it up to run on PR code not on web instance :p

@ianjennings
Copy link

Here is a preview of the test execution:

testdriverai/Stirling-PDF/refs/heads/main

Watch testdriverai/Stirling-PDF/refs/heads/main on Dashcam

@chottuthejimmy chottuthejimmy marked this pull request as ready for review September 24, 2024 18:04
@chottuthejimmy
Copy link
Author

Hey @Frooodle could you have another look at this.

It's a go from our side!

Cheers!

@Frooodle
Copy link
Member

Sorry been very busy should be able to properly check it end of week

@Frooodle
Copy link
Member

Added key but job still failed, does account need upgraded?

@ianjennings
Copy link

Added key but job still failed, does account need upgraded?

The API is reporting the key a null. Are you sure PRs have perms to access secrets? Or the variable name is correct?

@chottuthejimmy
Copy link
Author

Hey @Frooodle could please make sure you have got the API set up properly.
I would be happy to hop on a call and help you out, so let me know.

@Frooodle
Copy link
Member

Frooodle commented Oct 1, 2024

Secret is there along side other secrets used within this repo,
image

@chottuthejimmy
Copy link
Author

Hey @Frooodle, so I tried to recreate the issue by forking and making a PR.
I think its pretty much the API issue and nothing more. So could you try out a couple of things for us please.

Go to dashcam.io/team and click on the cycle button next to API Key, copy it and click on update. And replace the secret with this new key.
image

Try to re-run the failed job over here

If that doesn't work, make sure the right permissions are set here for PRs to access the secrets, or you can just merge this PR if you do not wish to change the permission.

@Frooodle
Copy link
Member

Frooodle commented Oct 3, 2024

All seems okay my side from what I can see,
Can we add a
- name: Debug - Print masked secret
run: |
echo "Secret is: ${{ secrets.TESTDRIVER_API_KEY }}"

to the job just to see if it can grab it or if its being lost in the call to the github action

@chottuthejimmy
Copy link
Author

yes, lets try that.
I made a commit, could try to run the workflow here

@Frooodle
Copy link
Member

Frooodle commented Oct 3, 2024

Hmm printing nope
I'll check more my side

@chottuthejimmy
Copy link
Author

Hmm printing nope I'll check more my side

It printed yes for me when I tried on my fork

@chottuthejimmy
Copy link
Author

Is it because of this code ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants