- Updated the getContentElement function to utilize the Race method for improved efficiency in finding content elements. - Added error handling for cases where no elements are found, ensuring better logging and debugging capabilities.
33 lines
605 B
Go
33 lines
605 B
Go
package xiaohongshu
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/xpzouying/xiaohongshu-mcp/browser"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPublish(t *testing.T) {
|
|
|
|
t.Skip("SKIP: 测试发布")
|
|
|
|
_ = browser.Init(false)
|
|
defer browser.Close()
|
|
|
|
page := browser.NewPage()
|
|
defer page.Close()
|
|
|
|
action, err := NewPublishImageAction(page)
|
|
require.NoError(t, err)
|
|
|
|
err = action.Publish(context.Background(), PublishImageContent{
|
|
Title: "Hello World",
|
|
Content: "Hello World",
|
|
ImagePaths: []string{"/tmp/1.jpg"},
|
|
})
|
|
assert.NoError(t, err)
|
|
}
|