diff options
Diffstat (limited to 'vendor/github.com/playwright-community/playwright-go/page_assertions.go')
| -rw-r--r-- | vendor/github.com/playwright-community/playwright-go/page_assertions.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/vendor/github.com/playwright-community/playwright-go/page_assertions.go b/vendor/github.com/playwright-community/playwright-go/page_assertions.go deleted file mode 100644 index 43bd0dc..0000000 --- a/vendor/github.com/playwright-community/playwright-go/page_assertions.go +++ /dev/null @@ -1,70 +0,0 @@ -package playwright - -import ( - "net/url" - "path" -) - -type pageAssertionsImpl struct { - assertionsBase - actualPage Page -} - -func newPageAssertions(page Page, isNot bool, defaultTimeout *float64) *pageAssertionsImpl { - return &pageAssertionsImpl{ - assertionsBase: assertionsBase{ - actualLocator: page.Locator(":root"), - isNot: isNot, - defaultTimeout: defaultTimeout, - }, - actualPage: page, - } -} - -func (pa *pageAssertionsImpl) ToHaveTitle(titleOrRegExp interface{}, options ...PageAssertionsToHaveTitleOptions) error { - var timeout *float64 - if len(options) == 1 { - timeout = options[0].Timeout - } - expectedValues, err := toExpectedTextValues([]interface{}{titleOrRegExp}, false, true, nil) - if err != nil { - return err - } - return pa.expect( - "to.have.title", - frameExpectOptions{ExpectedText: expectedValues, Timeout: timeout}, - titleOrRegExp, - "Page title expected to be", - ) -} - -func (pa *pageAssertionsImpl) ToHaveURL(urlOrRegExp interface{}, options ...PageAssertionsToHaveURLOptions) error { - var timeout *float64 - var ignoreCase *bool - if len(options) == 1 { - timeout = options[0].Timeout - ignoreCase = options[0].IgnoreCase - } - - baseURL := pa.actualPage.Context().(*browserContextImpl).options.BaseURL - if urlPath, ok := urlOrRegExp.(string); ok && baseURL != nil { - u, _ := url.Parse(*baseURL) - u.Path = path.Join(u.Path, urlPath) - urlOrRegExp = u.String() - } - - expectedValues, err := toExpectedTextValues([]interface{}{urlOrRegExp}, false, false, ignoreCase) - if err != nil { - return err - } - return pa.expect( - "to.have.url", - frameExpectOptions{ExpectedText: expectedValues, Timeout: timeout}, - urlOrRegExp, - "Page URL expected to be", - ) -} - -func (pa *pageAssertionsImpl) Not() PageAssertions { - return newPageAssertions(pa.actualPage, true, pa.defaultTimeout) -} |
