-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uitest: Add system for unit testing widgets (#534)
Adds a testscript-based system for testing terminal widgets. This is a generalized, in-memory, Windows-friendly version of with-term intended for use in unit tests instead of end-to-end tests. It uses testscript instead of a the custom commands format. With this in place, we're able to unit test a bunch of the terminal interactions that were previously untested, or became untested following RobotView in #480.
- Loading branch information
Showing
49 changed files
with
2,062 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package github | ||
|
||
import "flag" | ||
|
||
var UpdateFixtures = flag.Bool("update", false, "update test fixtures") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
init | ||
|
||
await Select an authentication method | ||
feed -r 3 <Down> | ||
snapshot | ||
await | ||
snapshot | ||
cmp stdout select | ||
feed <Enter> | ||
|
||
await | ||
snapshot | ||
cmp stdout prompt | ||
|
||
feed secret | ||
await | ||
snapshot | ||
cmp stdout filled | ||
|
||
feed <Enter> | ||
|
||
-- want_token -- | ||
secret | ||
-- select -- | ||
Select an authentication method: | ||
OAuth | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will get access to all repositories: public and private. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
OAuth: Public repositories only | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to public repositories. | ||
|
||
GitHub App | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to repositories where the git-spice GitHub | ||
App is installed explicitly. | ||
Use https://github.com/apps/git-spice to install the App on repositories. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
▶ Personal Access Token | ||
Enter a classic or fine-grained Personal Access Token generated from | ||
https://github.com/settings/tokens. | ||
Classic tokens need at least one of the following scopes: repo or | ||
public_repo. | ||
Fine-grained tokens need read/write access to Repository Contents and Pull | ||
requests. | ||
You can use this method if you do not have the ability to install a GitHub | ||
or OAuth App on your repositories. | ||
|
||
GitHub CLI | ||
Re-use an existing GitHub CLI (https://cli.github.com) session. | ||
You must be logged into gh with 'gh auth login' for this to work. | ||
You can use this if you're just experimenting and don't want to set up a | ||
token yet. | ||
-- prompt -- | ||
Select an authentication method: Personal Access Token | ||
Enter Personal Access Token: | ||
-- filled -- | ||
Select an authentication method: Personal Access Token | ||
Enter Personal Access Token: secret |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
init | ||
|
||
await Select an authentication method | ||
snapshot | ||
cmp stdout prompt | ||
|
||
# go through the list of options and roll back | ||
feed -r 3 <Down> | ||
await | ||
snapshot | ||
cmp stdout down | ||
|
||
feed -r 2 <Down> | ||
await | ||
snapshot | ||
cmp stdout prompt | ||
|
||
feed <Enter> | ||
|
||
-- want_type -- | ||
*github.DeviceFlowAuthenticator | ||
-- prompt -- | ||
Select an authentication method: | ||
▶ OAuth | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will get access to all repositories: public and private. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
OAuth: Public repositories only | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to public repositories. | ||
|
||
GitHub App | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to repositories where the git-spice GitHub | ||
App is installed explicitly. | ||
Use https://github.com/apps/git-spice to install the App on repositories. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
Personal Access Token | ||
Enter a classic or fine-grained Personal Access Token generated from | ||
https://github.com/settings/tokens. | ||
Classic tokens need at least one of the following scopes: repo or | ||
public_repo. | ||
Fine-grained tokens need read/write access to Repository Contents and Pull | ||
requests. | ||
You can use this method if you do not have the ability to install a GitHub | ||
or OAuth App on your repositories. | ||
|
||
GitHub CLI | ||
Re-use an existing GitHub CLI (https://cli.github.com) session. | ||
You must be logged into gh with 'gh auth login' for this to work. | ||
You can use this if you're just experimenting and don't want to set up a | ||
token yet. | ||
-- down -- | ||
Select an authentication method: | ||
OAuth | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will get access to all repositories: public and private. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
OAuth: Public repositories only | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to public repositories. | ||
|
||
GitHub App | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to repositories where the git-spice GitHub | ||
App is installed explicitly. | ||
Use https://github.com/apps/git-spice to install the App on repositories. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
▶ Personal Access Token | ||
Enter a classic or fine-grained Personal Access Token generated from | ||
https://github.com/settings/tokens. | ||
Classic tokens need at least one of the following scopes: repo or | ||
public_repo. | ||
Fine-grained tokens need read/write access to Repository Contents and Pull | ||
requests. | ||
You can use this method if you do not have the ability to install a GitHub | ||
or OAuth App on your repositories. | ||
|
||
GitHub CLI | ||
Re-use an existing GitHub CLI (https://cli.github.com) session. | ||
You must be logged into gh with 'gh auth login' for this to work. | ||
You can use this if you're just experimenting and don't want to set up a | ||
token yet. |
85 changes: 85 additions & 0 deletions
85
internal/forge/github/testdata/auth/select/oauth_public.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
init | ||
|
||
await Select an authentication method | ||
snapshot | ||
cmp stdout prompt | ||
|
||
feed <Down> | ||
await | ||
snapshot | ||
cmp stdout select | ||
|
||
feed <Enter> | ||
|
||
-- want_type -- | ||
*github.DeviceFlowAuthenticator | ||
-- prompt -- | ||
Select an authentication method: | ||
▶ OAuth | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will get access to all repositories: public and private. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
OAuth: Public repositories only | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to public repositories. | ||
|
||
GitHub App | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to repositories where the git-spice GitHub | ||
App is installed explicitly. | ||
Use https://github.com/apps/git-spice to install the App on repositories. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
Personal Access Token | ||
Enter a classic or fine-grained Personal Access Token generated from | ||
https://github.com/settings/tokens. | ||
Classic tokens need at least one of the following scopes: repo or | ||
public_repo. | ||
Fine-grained tokens need read/write access to Repository Contents and Pull | ||
requests. | ||
You can use this method if you do not have the ability to install a GitHub | ||
or OAuth App on your repositories. | ||
|
||
GitHub CLI | ||
Re-use an existing GitHub CLI (https://cli.github.com) session. | ||
You must be logged into gh with 'gh auth login' for this to work. | ||
You can use this if you're just experimenting and don't want to set up a | ||
token yet. | ||
-- select -- | ||
Select an authentication method: | ||
OAuth | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will get access to all repositories: public and private. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
▶ OAuth: Public repositories only | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to public repositories. | ||
|
||
GitHub App | ||
Authorize git-spice to act on your behalf from this device only. | ||
git-spice will only get access to repositories where the git-spice GitHub | ||
App is installed explicitly. | ||
Use https://github.com/apps/git-spice to install the App on repositories. | ||
For private repositories, you will need to request installation from a | ||
repository owner. | ||
|
||
Personal Access Token | ||
Enter a classic or fine-grained Personal Access Token generated from | ||
https://github.com/settings/tokens. | ||
Classic tokens need at least one of the following scopes: repo or | ||
public_repo. | ||
Fine-grained tokens need read/write access to Repository Contents and Pull | ||
requests. | ||
You can use this method if you do not have the ability to install a GitHub | ||
or OAuth App on your repositories. | ||
|
||
GitHub CLI | ||
Re-use an existing GitHub CLI (https://cli.github.com) session. | ||
You must be logged into gh with 'gh auth login' for this to work. | ||
You can use this if you're just experimenting and don't want to set up a | ||
token yet. |
Oops, something went wrong.