From cee702c99d1b703a7372b379d344ecee14aecb3c Mon Sep 17 00:00:00 2001 From: tuanphamcybozu <41720778+tuanphamcybozu@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:26:53 +0700 Subject: [PATCH] test: add CliKintoneTest-30, CliKintoneTest-31, CliKintoneTest-32 (#572) --- .github/workflows/test-e2e.yml | 2 ++ features/import.feature | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index f03fb6523f..4450075607 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -54,4 +54,6 @@ jobs: TEST_KINTONE_CREDENTIAL_MANAGEMENT_API_TOKEN: ${{ secrets.TEST_KINTONE_CREDENTIAL_MANAGEMENT_API_TOKEN }} TEST_KINTONE_USERNAME_UNPRIVILEGED: ${{ secrets.TEST_KINTONE_USERNAME_UNPRIVILEGED }} TEST_KINTONE_PASSWORD_UNPRIVILEGED: ${{ secrets.TEST_KINTONE_PASSWORD_UNPRIVILEGED }} + TEST_KINTONE_USERNAME_ADD_PERMISSION: ${{ secrets.TEST_KINTONE_USERNAME_ADD_PERMISSION }} + TEST_KINTONE_PASSWORD_ADD_PERMISSION: ${{ secrets.TEST_KINTONE_PASSWORD_ADD_PERMISSION }} run: pnpm test:e2e diff --git a/features/import.feature b/features/import.feature index e12514ef09..c4b3ab0302 100644 --- a/features/import.feature +++ b/features/import.feature @@ -131,3 +131,51 @@ Feature: cli-kintone import command When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN_IMPORT --file-path CliKintoneTest-29.csv --update-key Record_number" Then I should get the exit code is non-zero And The output error message should match with the pattern: "\[403\] \[GAIA_NO01\] Using this API token, you cannot run the specified API." + + Scenario: CliKintoneTest-30 Should import the records successfully with username and password + Given The app "app_for_import" has no records + And The csv file "CliKintoneTest-30.csv" with content as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 | + And Load app ID of app "app_for_import" as env var: "APP_ID" + When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --username $$TEST_KINTONE_USERNAME_ADD_PERMISSION --password $$TEST_KINTONE_PASSWORD_ADD_PERMISSION --file-path CliKintoneTest-30.csv" + Then I should get the exit code is zero + And The app "app_for_import" should has records as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 | + + Scenario: CliKintoneTest-31 Should import the records successfully with username (-u option) and password + Given The app "app_for_import" has no records + And The csv file "CliKintoneTest-31.csv" with content as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 | + And Load app ID of app "app_for_import" as env var: "APP_ID" + When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID -u $$TEST_KINTONE_USERNAME_ADD_PERMISSION --password $$TEST_KINTONE_PASSWORD_ADD_PERMISSION --file-path CliKintoneTest-31.csv" + Then I should get the exit code is zero + And The app "app_for_import" should has records as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 | + + Scenario: CliKintoneTest-32 Should import the records successfully with username and password (-p option) + Given The app "app_for_import" has no records + And The csv file "CliKintoneTest-32.csv" with content as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 | + And Load app ID of app "app_for_import" as env var: "APP_ID" + When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --username $$TEST_KINTONE_USERNAME_ADD_PERMISSION -p $$TEST_KINTONE_PASSWORD_ADD_PERMISSION --file-path CliKintoneTest-32.csv" + Then I should get the exit code is zero + And The app "app_for_import" should has records as below: + | Text | Number | + | Alice | 10 | + | Bob | 20 | + | Jenny | 30 |