-
Notifications
You must be signed in to change notification settings - Fork 583
test: add e2e tests and coverage #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dccdb71
test: add mail and wiki shortcut e2e coverage
3ab45fb
test: remove mail shortcut e2e coverage
819d09e
test: add base shortcut e2e coverage
22efa4f
test: document cli e2e coverage and refine workflows
c7b71f8
Merge branch 'larksuite:main' into feat/cli-shortcut-e2e-tests
yxzhaao 59c23ca
test: clarify workflow coverage comments
02769f7
feat(test): optimize cli-e2e-testcase-writer skill add coverage.md
yaozhen00 a2d3dd0
Merge branch 'feat/e2e_test_coverage' of https://github.com/larksuite…
2f17ac1
test: add e2e tests for calendar, im, sheets, drive
iFish007 39703df
test: add base and wiki coverage docs
e94ba11
Merge branch 'feat/cli-shortcut-e2e-tests' of github.com:yxzhaao/cli …
iFish007 42df0dd
test: refine domain e2e coverage and assertions
8447621
test: simplify domain workflow comments and add global e2e coverage s…
7bcc7b2
test: add 'contact' e2e test case
jinzemo 7813d74
docs: simplify cli e2e run command with gotestsum report output
8477a8c
test: add docs e2e tests
iFish007 5231aa9
docs: update docs and contact e2e coverage summaries
yxzhaao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -34,3 +34,4 @@ tests/mail/reports/ | |
| # Generated / test artifacts | ||
| internal/registry/meta_data.json | ||
| cmd/api/download.bin | ||
| app.log | ||
This file contains hidden or 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 hidden or 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,46 @@ | ||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package base | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
| "time" | ||
|
|
||
| clie2e "github.com/larksuite/cli/tests/cli_e2e" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestBase_AdvpermWorkflow(t *testing.T) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute) | ||
| t.Cleanup(cancel) | ||
|
|
||
| baseToken := createBase(t, ctx, "lark-cli-e2e-base-advperm-"+testSuffix()) | ||
|
|
||
| t.Run("enable", func(t *testing.T) { | ||
| result, err := clie2e.RunCmd(ctx, clie2e.Request{ | ||
| Args: []string{"base", "+advperm-enable", "--base-token", baseToken}, | ||
| DefaultAs: "bot", | ||
| }) | ||
| require.NoError(t, err) | ||
| if result.ExitCode != 0 { | ||
| skipIfBaseUnavailable(t, result, "requires bot advanced permission enable capability") | ||
| } | ||
| result.AssertExitCode(t, 0) | ||
| result.AssertStdoutStatus(t, true) | ||
| }) | ||
|
|
||
| t.Run("disable", func(t *testing.T) { | ||
| result, err := clie2e.RunCmd(ctx, clie2e.Request{ | ||
| Args: []string{"base", "+advperm-disable", "--base-token", baseToken, "--yes"}, | ||
| DefaultAs: "bot", | ||
| }) | ||
| require.NoError(t, err) | ||
| if result.ExitCode != 0 { | ||
| skipIfBaseUnavailable(t, result, "requires bot advanced permission disable capability") | ||
| } | ||
| result.AssertExitCode(t, 0) | ||
| result.AssertStdoutStatus(t, true) | ||
| }) | ||
| } | ||
This file contains hidden or 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,41 @@ | ||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package base | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
| "time" | ||
|
|
||
| clie2e "github.com/larksuite/cli/tests/cli_e2e" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "github.com/tidwall/gjson" | ||
| ) | ||
|
|
||
| func TestBase_CoreWorkflow(t *testing.T) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) | ||
| t.Cleanup(cancel) | ||
|
|
||
| baseToken := createBase(t, ctx, "lark-cli-e2e-base-"+testSuffix()) | ||
|
|
||
| t.Run("get base", func(t *testing.T) { | ||
| result, err := clie2e.RunCmd(ctx, clie2e.Request{ | ||
| Args: []string{"base", "+base-get", "--base-token", baseToken}, | ||
| DefaultAs: "bot", | ||
| }) | ||
| require.NoError(t, err) | ||
| if result.ExitCode != 0 { | ||
| skipIfBaseUnavailable(t, result, "requires bot base get capability") | ||
| } | ||
| result.AssertExitCode(t, 0) | ||
| result.AssertStdoutStatus(t, true) | ||
| assert.NotEmpty(t, gjson.Get(result.Stdout, "data.base.name").String(), "stdout:\n%s", result.Stdout) | ||
| }) | ||
|
|
||
| t.Run("copy base", func(t *testing.T) { | ||
| copiedToken := copyBase(t, ctx, baseToken, "lark-cli-e2e-base-copy-"+testSuffix()) | ||
| assert.NotEqual(t, baseToken, copiedToken) | ||
| }) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isolate CLI config state for this E2E test.
Please set a per-test config directory at test start to avoid cross-test/config pollution.
func TestBase_AdvpermWorkflow(t *testing.T) { + t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute) t.Cleanup(cancel)As per coding guidelines
**/*_test.go: "Isolate config state in Go tests by usingt.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())."📝 Committable suggestion
🤖 Prompt for AI Agents