Acceptance test issue/pr create/edit with project
This commit is contained in:
parent
e30244686c
commit
cf9ac4447a
2 changed files with 94 additions and 0 deletions
43
acceptance/testdata/issue/issue-create-edit-with-project.txtar
vendored
Normal file
43
acceptance/testdata/issue/issue-create-edit-with-project.txtar
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
env REPO=${SCRIPT_NAME}-${RANDOM_STRING}
|
||||
|
||||
# Create a repository with a file so it has a default branch
|
||||
exec gh repo create ${ORG}/${REPO} --add-readme --private
|
||||
|
||||
# Defer repo cleanup
|
||||
defer gh repo delete --yes ${ORG}/${REPO}
|
||||
|
||||
# Create a project
|
||||
env PROJECT_TITLE=${REPO}-project
|
||||
exec gh project create --owner=${ORG} --title=${PROJECT_TITLE} --format='json' --jq='.number'
|
||||
stdout2env PROJECT_NUMBER
|
||||
|
||||
defer gh project delete --owner=${ORG} ${PROJECT_NUMBER}
|
||||
|
||||
# Clone the repo
|
||||
exec gh repo clone ${ORG}/${REPO}
|
||||
|
||||
# Create an issue in the repo
|
||||
cd ${REPO}
|
||||
exec gh issue create --title 'Feature Request' --body 'Feature Body' --project ${PROJECT_TITLE}
|
||||
stdout2env ISSUE_URL
|
||||
|
||||
# Check that default issue view is working
|
||||
exec gh issue view ${ISSUE_URL}
|
||||
|
||||
# Check the issue was added to the project
|
||||
exec gh issue view ${ISSUE_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
stdout ${PROJECT_TITLE}
|
||||
|
||||
# Remove the issue from the project
|
||||
exec gh issue edit ${ISSUE_URL} --remove-project ${PROJECT_TITLE}
|
||||
|
||||
# Check the issue was removed from the project
|
||||
exec gh issue view ${ISSUE_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
! stdout ${PROJECT_TITLE}
|
||||
|
||||
# Re add the issue to the project
|
||||
exec gh issue edit ${ISSUE_URL} --add-project ${PROJECT_TITLE}
|
||||
|
||||
# Check the issue was added to the project
|
||||
exec gh issue view ${ISSUE_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
stdout ${PROJECT_TITLE}
|
||||
51
acceptance/testdata/pr/pr-create-edit-with-project.txtar
vendored
Normal file
51
acceptance/testdata/pr/pr-create-edit-with-project.txtar
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Use gh as a credential helper
|
||||
exec gh auth setup-git
|
||||
|
||||
env REPO=${SCRIPT_NAME}-${RANDOM_STRING}
|
||||
|
||||
# Create a repository with a file so it has a default branch
|
||||
exec gh repo create ${ORG}/${REPO} --add-readme --private
|
||||
|
||||
# Defer repo cleanup
|
||||
defer gh repo delete --yes ${ORG}/${REPO}
|
||||
|
||||
# Create a project
|
||||
env PROJECT_TITLE=${REPO}-project
|
||||
exec gh project create --owner=${ORG} --title=${PROJECT_TITLE} --format='json' --jq='.number'
|
||||
stdout2env PROJECT_NUMBER
|
||||
|
||||
defer gh project delete --owner=${ORG} ${PROJECT_NUMBER}
|
||||
|
||||
# Clone the repo
|
||||
exec gh repo clone ${ORG}/${REPO}
|
||||
|
||||
# Prepare a branch to PR
|
||||
cd ${REPO}
|
||||
exec git checkout -b feature-branch
|
||||
exec git commit --allow-empty -m 'Empty Commit'
|
||||
exec git push -u origin feature-branch
|
||||
|
||||
# Create the PR
|
||||
exec gh pr create --title 'Feature Title' --body 'Feature Body' --project ${PROJECT_TITLE}
|
||||
stdout2env PR_URL
|
||||
|
||||
# Check that default pr view is working
|
||||
exec gh pr view ${PR_URL}
|
||||
|
||||
# Check the pr was added to the project
|
||||
exec gh pr view ${PR_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
stdout ${PROJECT_TITLE}
|
||||
|
||||
# Remove the pr from the project
|
||||
exec gh pr edit ${PR_URL} --remove-project ${PROJECT_TITLE}
|
||||
|
||||
# Check the pr was removed from the project
|
||||
exec gh pr view ${PR_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
! stdout ${PROJECT_TITLE}
|
||||
|
||||
# Re add the pr to the project
|
||||
exec gh pr edit ${PR_URL} --add-project ${PROJECT_TITLE}
|
||||
|
||||
# Check the pr was added to the project
|
||||
exec gh pr view ${PR_URL} --json projectItems --jq '.projectItems[0].title'
|
||||
stdout ${PROJECT_TITLE}
|
||||
Loading…
Add table
Add a link
Reference in a new issue