We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73cf378 commit 0ae9f37Copy full SHA for 0ae9f37
parsers/playwright_test.go
@@ -0,0 +1,25 @@
1
+package parsers
2
+
3
+import (
4
+ "fmt"
5
+ "testing"
6
7
+ "github.com/bjesus/pipet/common"
8
+ "github.com/stretchr/testify/assert"
9
+)
10
11
+func TestExecutePlaywrightBlock(t *testing.T) {
12
13
+ block := common.Block{
14
+ Type: "playwright",
15
+ Command: "playwright http://example.com",
16
+ Queries: []string{"document.querySelector(\"h1\").innerText.split(\" \")", "document.querySelector(\"h1\") | wc -c"},
17
+ }
18
+ result, err := ExecutePlaywrightBlock(block)
19
+ expected := []interface{}{[]interface{}{"Example", "Domain"}, "11\n"}
20
+ fmt.Printf("%v", result)
21
+ assert.NoError(t, err)
22
+ assert.NotNil(t, result)
23
+ assert.Equal(t, expected, result) // Mocked JSON output
24
25
+}
0 commit comments