Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.16.0] - 2025-12-15

### Added
- State support for ReadySelector

## [0.15.0] - 2025-12-15

### Removed
Expand Down Expand Up @@ -105,6 +110,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[0.16.0]: https://github.com/gooddata/gooddata-neobackstop/compare/v0.15.0...v0.16.0
[0.15.0]: https://github.com/gooddata/gooddata-neobackstop/compare/v0.14.0...v0.15.0
[0.14.0]: https://github.com/gooddata/gooddata-neobackstop/compare/v0.13.0...v0.14.0
[0.13.0]: https://github.com/gooddata/gooddata-neobackstop/compare/v0.12.0...v0.13.0
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.0
0.16.0
2 changes: 1 addition & 1 deletion internals/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Scenario struct {
Id string `json:"id"`
Label string `json:"label"`
Url string `json:"url"`
ReadySelector *string `json:"readySelector"`
ReadySelector *scenario.ReadySelector `json:"readySelector"`
ReloadAfterReady bool `json:"reloadAfterReady"`
Delay *scenario.Delay `json:"delay"`
KeyPressSelector *scenario.KeyPressSelector `json:"keyPressSelector"`
Expand Down
8 changes: 7 additions & 1 deletion scenario/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ import (
"time"

"github.com/gooddata/gooddata-neobackstop/browser"
"github.com/gooddata/gooddata-neobackstop/state"
"github.com/gooddata/gooddata-neobackstop/viewport"
)

type ReadySelector struct {
Selector string `json:"selector"`
State state.State `json:"state"`
}

type Delay struct {
PostReady time.Duration `json:"postReady"`
PostOperation time.Duration `json:"postOperation"`
Expand Down Expand Up @@ -92,7 +98,7 @@ type Scenario struct {
Id string `json:"id"`
Label string `json:"label"`
Url string `json:"url"`
ReadySelector *string `json:"readySelector"`
ReadySelector *ReadySelector `json:"readySelector"`
ReloadAfterReady bool `json:"reloadAfterReady"`
Delay *Delay `json:"delay"`
KeyPressSelector *KeyPressSelector `json:"keyPressSelector"`
Expand Down
11 changes: 6 additions & 5 deletions screenshotter/operations/readySelector.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package operations

import (
"github.com/gooddata/gooddata-neobackstop/scenario"
"github.com/playwright-community/playwright-go"
)

func ReadySelector(page playwright.Page, value *string) *string {
func ReadySelector(page playwright.Page, value *scenario.ReadySelector) *string {
if value != nil {
rs := *value
state := playwright.WaitForSelectorState(value.State)
// there is a ReadySelector, wait for it
_, err := page.WaitForSelector(rs, playwright.PageWaitForSelectorOptions{
State: playwright.WaitForSelectorStateAttached,
_, err := page.WaitForSelector(value.Selector, playwright.PageWaitForSelectorOptions{
State: &state,
Timeout: playwright.Float(30000), // todo: add timeout to config
})
if err != nil {
e := "ReadySelector " + rs + " didn't appear"
e := "ReadySelector " + value.Selector + " didn't appear"
return &e
}
}
Expand Down
10 changes: 10 additions & 0 deletions state/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package state

type State string

const (
Attached State = "attached"
Detached State = "detached"
Visible State = "visible"
Hidden State = "hidden"
)