Add Acceptance tests for `issue` command by williammartin · Pull Request #9757 · cli/cli · GitHub
Skip to content
Merged
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
14 changes: 11 additions & 3 deletions acceptance/acceptance_test.go
20 changes: 20 additions & 0 deletions acceptance/testdata/issue/issue-comment.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Create a repository with a file so it has a default branch
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private

# Defer repo cleanup
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Clone the repo
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
exec gh issue create --title 'Feature Request' --body 'Feature Body'
stdout2env ISSUE_URL

# Comment on the issue
exec gh issue comment $ISSUE_URL --body 'Looks like a great feature!'

# View the issue
exec gh issue view $ISSUE_URL --comments
stdout 'Looks like a great feature!'
17 changes: 17 additions & 0 deletions acceptance/testdata/issue/issue-create-basic.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Create a repository with a file so it has a default branch
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private

# Defer repo cleanup
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Clone the repo
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
exec gh issue create --title 'Feature Request' --body 'Feature Body'
stdout2env ISSUE_URL

# Check the issue was created
exec gh issue view $ISSUE_URL
stdout 'title:\tFeature Request$'
19 changes: 19 additions & 0 deletions acceptance/testdata/issue/issue-create-with-metadata.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Create a repository with a file so it has a default branch
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private

# Defer repo cleanup
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Clone the repo
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
exec gh issue create --title 'Feature Request' --body 'Feature Body' --assignee '@me' --label 'bug'
stdout2env ISSUE_URL

# Check the issue was create
exec gh issue view $ISSUE_URL
stdout 'title:\tFeature Request$'
stdout 'assignees:\t.+$'
stdout 'labels:\tbug$'
16 changes: 16 additions & 0 deletions acceptance/testdata/issue/issue-list.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Create a repository with a file so it has a default branch
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private

# Defer repo cleanup
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Clone the repo
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
exec gh issue create --title 'Feature Request' --body 'Feature Body'

# Check the issue is included in the list output
exec gh issue list
stdout 'OPEN\tFeature Request'
17 changes: 17 additions & 0 deletions acceptance/testdata/issue/issue-view.txtar