diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-12 16:33:27 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-12 16:33:27 -0600 |
| commit | 29b59441a4bbada64d8d07bd2609f15dfde670e5 (patch) | |
| tree | 3b3583edb261279cfcdfd9eed904d118c4bf67b1 /vendor/github.com/playwright-community/playwright-go/selectors.go | |
| parent | 78ccd9a4312eab7e11da4413733a12953f88a4fe (diff) | |
test: remove UI tests
Diffstat (limited to 'vendor/github.com/playwright-community/playwright-go/selectors.go')
| -rw-r--r-- | vendor/github.com/playwright-community/playwright-go/selectors.go | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/vendor/github.com/playwright-community/playwright-go/selectors.go b/vendor/github.com/playwright-community/playwright-go/selectors.go deleted file mode 100644 index 1151647..0000000 --- a/vendor/github.com/playwright-community/playwright-go/selectors.go +++ /dev/null @@ -1,88 +0,0 @@ -package playwright - -import ( - "errors" - "os" - "sync" -) - -type selectorsOwnerImpl struct { - channelOwner -} - -func (s *selectorsOwnerImpl) setTestIdAttributeName(name string) { - s.channel.SendNoReply("setTestIdAttributeName", map[string]interface{}{ - "testIdAttributeName": name, - }) -} - -func newSelectorsOwner(parent *channelOwner, objectType string, guid string, initializer map[string]interface{}) *selectorsOwnerImpl { - obj := &selectorsOwnerImpl{} - obj.createChannelOwner(obj, parent, objectType, guid, initializer) - return obj -} - -type selectorsImpl struct { - channels sync.Map - registrations []map[string]interface{} -} - -func (s *selectorsImpl) Register(name string, script Script, options ...SelectorsRegisterOptions) error { - if script.Path == nil && script.Content == nil { - return errors.New("Either source or path should be specified") - } - source := "" - if script.Path != nil { - content, err := os.ReadFile(*script.Path) - if err != nil { - return err - } - source = string(content) - } else { - source = *script.Content - } - params := map[string]interface{}{ - "name": name, - "source": source, - } - if len(options) == 1 && options[0].ContentScript != nil { - params["contentScript"] = *options[0].ContentScript - } - var err error - s.channels.Range(func(key, value any) bool { - _, err = value.(*selectorsOwnerImpl).channel.Send("register", params) - return err == nil - }) - if err != nil { - return err - } - s.registrations = append(s.registrations, params) - return nil -} - -func (s *selectorsImpl) SetTestIdAttribute(name string) { - setTestIdAttributeName(name) - s.channels.Range(func(key, value any) bool { - value.(*selectorsOwnerImpl).setTestIdAttributeName(name) - return true - }) -} - -func (s *selectorsImpl) addChannel(channel *selectorsOwnerImpl) { - s.channels.Store(channel.guid, channel) - for _, params := range s.registrations { - channel.channel.SendNoReply("register", params) - channel.setTestIdAttributeName(getTestIdAttributeName()) - } -} - -func (s *selectorsImpl) removeChannel(channel *selectorsOwnerImpl) { - s.channels.Delete(channel.guid) -} - -func newSelectorsImpl() *selectorsImpl { - return &selectorsImpl{ - channels: sync.Map{}, - registrations: make([]map[string]interface{}, 0), - } -} |
