Skip to content

Commit 0ae9f37

Browse files
committed
test playwright parsing
1 parent 73cf378 commit 0ae9f37

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

parsers/playwright_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)