Skip to content

Commit

Permalink
test: add test cases for CliKintoneTest-20, 21, and 22 (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanphamcybozu authored Nov 10, 2023
1 parent d878ee6 commit 4705ccf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ jobs:
TEST_KINTONE_API_TOKEN_FOR_IMPORT: ${{ secrets.TEST_KINTONE_API_TOKEN_FOR_IMPORT }}
TEST_KINTONE_API_TOKEN_FOR_IMPORT_DELETE: ${{ secrets.TEST_KINTONE_API_TOKEN_FOR_IMPORT_DELETE }}
TEST_KINTONE_API_TOKEN_FOR_DELETE: ${{ secrets.TEST_KINTONE_API_TOKEN_FOR_DELETE }}
TEST_KINTONE_USERNAME_UNPRIVILEGED: ${{ secrets.TEST_KINTONE_USERNAME_UNPRIVILEGED }}
TEST_KINTONE_PASSWORD_UNPRIVILEGED: ${{ secrets.TEST_KINTONE_PASSWORD_UNPRIVILEGED }}
TEST_KINTONE_APP_ID_GUEST_SPACE: ${{ vars.TEST_KINTONE_APP_ID_GUEST_SPACE }}
TEST_KINTONE_APP_ID_FOR_EXPORT: ${{ vars.TEST_KINTONE_APP_ID_FOR_EXPORT }}
TEST_KINTONE_APP_ID_FOR_IMPORT: ${{ vars.TEST_KINTONE_APP_ID_FOR_IMPORT }}
TEST_KINTONE_APP_ID_FOR_DELETE: ${{ vars.TEST_KINTONE_APP_ID_FOR_DELETE }}
TEST_KINTONE_APP_IN_SPACE_ID: ${{ vars.TEST_KINTONE_APP_IN_SPACE_ID }}
TEST_KINTONE_APP_IN_SPACE_FOR_IMPORT_DELETE: ${{ secrets.TEST_KINTONE_APP_IN_SPACE_FOR_IMPORT_DELETE }}
run: pnpm test:e2e
38 changes: 38 additions & 0 deletions features/import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,41 @@ Feature: cli-kintone import command
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |

Scenario: CliKintoneTest-20 Should return the error message when the user has no privilege to add records
Given The csv file "CliKintoneTest-20.csv" with content as below:
| Text | Number |
| Alice | 10 |
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $$TEST_KINTONE_APP_ID_FOR_IMPORT --username $$TEST_KINTONE_USERNAME_UNPRIVILEGED --password $$TEST_KINTONE_PASSWORD_UNPRIVILEGED --file-path CliKintoneTest-20.csv"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "ERROR: \[403\] \[CB_NO02\] No privilege to proceed."

Scenario: CliKintoneTest-21 Should import records to app in space successfully
Given The app "$$TEST_KINTONE_APP_IN_SPACE_ID" with "$$TEST_KINTONE_APP_IN_SPACE_FOR_IMPORT_DELETE" has no records
And The csv file "CliKintoneTest-21.csv" with content as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $$TEST_KINTONE_APP_IN_SPACE_ID --username $$TEST_KINTONE_USERNAME --password $$TEST_KINTONE_PASSWORD --file-path CliKintoneTest-21.csv"
Then I should get the exit code is zero
And The app "$$TEST_KINTONE_APP_IN_SPACE_ID" should has records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |

Scenario: CliKintoneTest-22 Should import records to app with --api-token and --username, --password successfully
Given The app "$$TEST_KINTONE_APP_ID_FOR_IMPORT" with "$$TEST_KINTONE_API_TOKEN_FOR_IMPORT_DELETE" has no records
And The csv file "CliKintoneTest-22.csv" with content as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $$TEST_KINTONE_APP_ID_FOR_IMPORT --api-token $$TEST_KINTONE_API_TOKEN_FOR_IMPORT --username $$TEST_KINTONE_USERNAME --password $$TEST_KINTONE_PASSWORD --file-path CliKintoneTest-22.csv"
Then I should get the exit code is zero
And The app "$$TEST_KINTONE_APP_IN_SPACE_ID" should has records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |

0 comments on commit 4705ccf

Please sign in to comment.