All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning
- feat(mocks): provide all request informations when calling
lastUpdated
on a mock
- feat(fluent-api): add helper methods on registered mocks :
getAllMocksWithDisplayName
,getLastMockWithDisplayName
to the fluent API.
- fix(hover): use native playwright hover only inside iframes
- feat(selector-fluent): add
withAriaLabel(text)
to the Selector API
- fix(hover): invoke hover after moving mouse (the hover method from playwright was placed in an unreachable code)
- fix(mocks): fix type comparison when comparing a mocked response with the real one
- fix(mocks): be able to track outdated mocks that respond with an http status 4xx
- add
ignoreHttpsErrors()
to the fluent API : provided by osolomin90
- The
isVisible()
andisNotVisible()
fluent assertions randomly failed when thePlaywright
.isVisible()
method was internally called while the element was removed from the DOM by React. Those two assertions does not throw an error anymore while the element is being removed from the DOM.
-
The
isNotVisible()
assertion will now fail for elements that are out of the current viewport but would be visible after scrolling and hovering over them : in this case you must replace theisNotVisible()
assertion withisNotVisibleInViewport()
. -
The
isVisible()
assertion has been 'relaxed' and will succeed for elements that are visible in the current viewport but will also succeed for elements that are outside the current viewport but would be visible after scrolling and hovering over them. -
If you need to check visibility only in the current viewport, you must replace the
isVisible()
assertion byisVisibleInViewport()
.
This change has been done to prevent you to always do a hover(selector)
before the isVisible()
assertion.
- feat(assertion): add
expectThat(selector).isNotVisibleInViewport()
to the Assertion API
- fix(mocks): be able to compare json responses that embed dictionaries
-
feat(assertion): add
expectThat(selector).isVisibleInViewport()
to the Assertion API -
added ability to start microsoft edge : provided by osolomin90
-
added aliases to the
runStory
method (provided by osolomin90) :do
,and
,attemptsTo
,verifyIf
.const p = new PlaywrightFluent(); p.runStory(do_something) .runStory(do_something_else) .runStory(act_on_something) .runStory(check_that_action_has_succeeded); // you can rewrite the above code as: p.do(do_something) .and(do_something_else) .attemptsTo(act_on_something) .verifyIf(action_has_succeeded);
playwright
dependency must be >=v1.12.0
- Typescript type
StorageState
provided byplaywright-fluent
has been aligned with the one provided byplaywright
: optional properties are now mandatory.
- fix(iframe): be able to switch to an iframe on a newly opened tab
- fix(browser): get correct path to chrome on Linux; fixed by osolomin90; fixes #19
- feat(fluent-api): add tracing API
-
feat(mocks): add helper method
removeMocksWithDisplayName
to remove a registered mock -
feat(mocks): add helper method
hasMockWithDisplayName
to check if a mock with a specific display name is registered
- feat(mocks): add a
customMatcher
to mock definition so that a mock can be configured to intercept a request based on complex conditions (for example, the request url must contain a specific guid that must match an entry in the shared context).
playwright
dependency must be >=v1.9.0
Add a way to click at a given position on the page. This is useful when you want to click on some element (typically a checkbox or a switch without a label) that has been designed by using bootstrap 4 or 5 together with some flex box and CSS grid rules. In some tricky cases the center of the client rectangle of such elements is visually offset from its real place on the page, so a traditional click will click outside the element.
- feat(fluent-api): add
clickAtPosition(position)
to the fluent API - feat(selector-api): add helper method
clientRectangle()
to the Selector API - feat(selector-api): add helper method
position()
to the Selector API - feat(selector-api): add helper method
leftPosition()
to the Selector API - feat(selector-api): add helper method
rightPosition()
to the Selector API
New API to handle page dialogs :
- feat(fluent-api): add
withDialogs()
to the fluent API - feat(fluent-api): add
waitForDialog()
to the fluent API - feat(fluent-api): add
expectThatDialog().isOfType(dialogType,[options])
to the fluent API - feat(fluent-api): add
expectThatDialog().hasMessage(message,[options])
to the fluent API - feat(fluent-api): add
expectThatDialog().hasValue(value,[options])
to the fluent API - feat(fluent-api): add
expectThatDialog().hasExactValue(value,[options])
to the fluent API - feat(fluent-api): add
acceptDialog()
to the fluent API - feat(fluent-api): add
cancelDialog()
to the fluent API - feat(fluent-api): add
typeTextInDialogAndSubmit(text)
to the fluent API - feat(fluent-api): add helper method
isDialogOpened()
to the fluent API - feat(fluent-api): add helper method
isDialogClosed()
to the fluent API
- fix(mock): apply update policy on mock with empty response
- fix(wait-until): prevent false negative when
timeoutInMilliseconds
option = 0
-
fix(mocks): be able to configure the update policy through the mock creators.
This might be a breaking change for those who are using mock creators
Before:
mockGetWithJsonResponse('/api/foo', response, onOutdated);
Must be rewritten as:
mockGetWithJsonResponse('/api/foo', response, { updateData: onOutdated });
-
Unplug
@types/web
and re-plug thedom
lib.The
@types/web
has a side effect onplaywright-fluent
package consumers, because it forces them to upgrade their own typescript version to v4.4 or later.
ClientRect
type is replaced bySerializableDOMRect
-
feat(mocks): be able to set up an update policy to prevent a mock to be updated too often.
To set up an update policy just add these two properties to the mock declaration:
const mock = { // other properties omited for brevity lastUpdated: () => Date; updatePolicy: 'always' | 'never' | '1/d' | '1/w' | '1/m'; } // 1/d => update only once per day // 1/w => update only once per week // 1/m => update only once per month
- fix(fluent-api): add missing keyboard keys for the
pressKey(key)
method
- feat(fluent-api): provide custom context to store and share data at runtime
- feat(selector-api): add
withExactText()
to the selector API - feat(mock-api): first release of the mock API
- fix(selector-api): add missing index parameter in
forEach()
callback
- fix(mocks): fix array comparison.
- feat(mocks): provide a shared context between all mocks.
- fix(mocks): extract postdata either as JSON or as string.
- fix(mocks): prevent internal errors from stopping the parent caller.
- feat(mocks): be able to infer missing mocks from existing mocks
- feat(mocks): let mock updates itself its data source when it is found to be outdated
- fix(mocks): detect outdated mocks for all type of mocks
- feat(mocks): be able to add mocks on the fly
- feat(mocks): add mock creators
mockGetWithJsonResponse
mockGetWithJsonResponseDependingOnQueryString
mockGetWithJavascriptResponse
mockGetWithEmptyResponseAndStatus
mockPostWithEmptyResponseAndStatus
mockGetWithUnauthorizedResponse
mockGetWithForbiddenResponse
- feat(mocks): be able to mock javascript and empty responses
- feat(mocks): provide infrastructure to detect outdated mocks
- feat(mocks): expose mock creators
mockGetWithJsonResponse
andmockGetWithJsonResponseDependingOnQueryString
-
feat(mocks): be able to dynamically build the response HTTP status.
- The
withMocks(mocks)
feature enables you to provide a set of mocks in order to automatically handle many request interceptions. - It's an experimental feature. The purpose of that feature is to provide a generic and simple infrastructure for massive request interception and response mocking. The ultimate goal is to be able to mock all HTTP requests in order to test the front in complete isolation from the backend.
- The
- feat(mocks): be able to delay a mock response
- feat(mocks): validate mocks before registering them
- The
withMocks(mocks)
feature enables you to provide a set of mocks in order to automatically handle request interceptions. - This feature is undocumented and only for beta testing.
- The
- feat(fluent-api): add
withMocks(mocks)
to the Fluent API- This feature enables you to provide a set of mocks in order to automatically handle request interceptions.
- This feature is undocumented and only for beta testing.
- feat(fluent-api): add options parameter to
onRequestTo(url).respondWith(response)
Examples:
// intercept all requests to url with the 'POST' verb
onRequestTo(url, { method: 'POST' }).respondWith(response);
// intercept all requests to url with the 'GET' verb
onRequestTo(url, { method: 'GET' }).respondWith(response);
// intercept all requests to url for all verbs
onRequestTo(url).respondWith(response);
- Request interceptions using the
bypassPredicate
parameter must now be done like this:
onRequestTo(url, { bypassPredicate }).respondWith(response);
- feat(assertion): add
expectThat(selector).isReadOnly()
to the Assertion API - feat(selector): add helper method
isReadOnly()
to the Selector API - feat(selector): add helper method
isNotReadOnly()
to the Selector API
- feat(fluent-api): enhance options in
onRequestTo(url).respondFromHar(harFiles [, options])
-
Viewport
type is deprecated in favor ofViewportSize
-
some options properties have been renamed in
onRequestTo(url).respondFromHar(harFiles [, options])
. See the HarRequestResponseOptions documentation.
-
new devices can be emulated :
Galaxy S8
,Galaxy S9+
,Galaxy Tab S4
,iPhone 12
,Pixel 3
,Pixel 4
,Pixel 5
,Moto G4
-
feat(fluent-api): enhance options in
onRequestTo(url).respondFromHar(harFiles [, options])
- feat(fluent-api): add method
onRequestTo(url).respondFromHar(harFiles [, options])
- feat(fluent-api): assertion
expectThat(selector).isDisabled()
passes when the selector is a read-only input (but not disabled) or is disabled.
- feat(fluent-api): add helper method
getToday(format)
to the Fluent API
- feat(wait-until): add optional parameter
wrapPredicateExecutionInsideTryCatch
to theWaitUntilOptions
options object.
- feat(assertion): add
expectThatSelector(selector).doesNotExist()
to the Assertion API - feat(fluent-api): add optional predicate parameter to
recordRequestsTo(url[, ignorePredicate])
- Typescript type :
Headers
has been renamed toHttpHeaders
HarContent
has been renamed toHarData
readHarFileAsJson
has been renamed togetHarDataFrom
-
feat(fluent-api): add optional predicate parameter to
onRequestTo(url).respondWith(response[, bypassPredicate])
-
helper methods on HAR file processing and parsing has been added in order to be able to mock HTTP responses by getting the response data from a given HAR file:
getHarDataFrom
,getHarResponseContentAs
,getHarResponseFor
,harHeadersToHttpHeaders
,
- feat(fluent-api): add
switchToIframe(selector[, options])
andswitchBackToPage()
to the fluent API
- feat(fluent-api): add
recordDownloadsTo(directory)
to the fluent API
- feat(fluent-api): enable downloads by default
- feat(fluent-api): add
clearExistingContent
inpasteText
options
- feat(fluent-api): add
recordVideo(options)
to the fluent API - feat(fluent-api): add helper method
clearVideoFilesOlderThan()
to the Fluent API - feat(fluent-api): add helper method
getRecordedVideoPath()
to the Fluent API
- feat(assertion): add
expectThatSelector(selector).exists()
to the Assertion API - feat(fluent-api): add helper method
exists()
to the Fluent API
- fix(delay-request): delay the request without blocking test execution
- feat(fluent-api): add
recordNetworkActivity(options)
to the fluent API - feat(fluent-api): add helper method
getRecordedNetworkActivity()
to the Fluent API - feat(fluent-api): add
delayRequestsTo(url, durationInSeconds)
to the fluent API - feat(selector-fluent): add
forEach()
to the Selector API
- feat(fluent-api): add
switchToPreviousTab()
to the fluent API - feat(fluent-api): add helper method
hasBeenRedirectedToAnotherTab()
to the fluent API
-
feat(fluent-api): automatically switch the page object to the newly opened tab
This enables to smoothly continue test execution on the new opened tab (for example when clicking on a link opens a new tab in the same browser)
- feat(fluent-api): add
pause()
to the fluent API
- feat(fluent-api): add
invokeMethod()
to the fluent API
- fix(request-interception): set response content-type to text/plain when the response body is a string
- fix(request-interception): add CORS headers
- fix(browser): use X64 chrome path on Windows by default
- feat(selector-fluent): add
previousSibling()
to the Selector API
- feat(fluent-api): add
selectByValue(values).inFocused()
to the fluent API - feat(fluent-api): add
selectByValue(values).in(selector)
to the fluent API - feat(selector): add helper method
allSelectedOptions()
to the Selector API - feat(selector): add helper method
selectedOption()
to the Selector API - feat(fluent-api): add helper method
getAllSelectedOptionsOf(selector)
to the Fluent API
- support node >= 12
- feat(fluent-api): add
withStorageState(state)
to the Fluent API - feat(fluent-api): add
saveStorageStateTo(file)
to the Fluent API - feat(fluent-api): add
currentStorageState()
to the Fluent API
- update of all dependencies
- fix(fluent-api): replace character #160 by a standard white space when reading the innerText of a selector
- feat(fluent-api): add
withDefaultAssertOptions(options)
to the Fluent API
- fix(fluent-api): remove default value for optional parameters
-
feat(fluent-api): add option
clearExistingTextBeforeTyping
fortypeText(options)
of the Fluent API -
feat(fluent-api): add console.error logs tracking when using
recordPageErrors()
- playwright peer-dependency version must be >= 1.0.0
- feat(fluent-api): add
withDefaultWaitOptions(options)
to the Fluent API
- feat(fluent-api): be able to mock response by using the request object
- feat(fluent-api): add
clear()
as an alias ofclearText()
- feat(selector-fluent): add helper method
hasAttributeWithValue()
to the Selector API - feat(assertion): add
expectThatSelector(selector).hasAttributeWithValue()
to the Assertion API
- fix(keyboard-actions): add missing keyboard keys
- fix(utils): do not throw an error on Linux when trying to get Chrome path
- feat(selector-fluent): add helper method
isDisabled()
to the Selector API - feat(selector-fluent): add helper method
doesNotExist()
to the Selector API - feat(fluent-api): be able to pass a custom error message to the
waitUntil()
method
- feat(assertion): add
expectThat(selector)
as an alias ofexpectThatSelector(selector)
- feat(selector-fluent): add helper method
isEnabled()
to the Selector API - feat(selector-fluent): add helper method
hover()
to the Selector API - feat(selector-fluent): add helper method
click()
to the Selector API
- feat(fluent-api): add
withTimezone(timezoneId)
to the Fluent API
- feat(fluent-api): add
doubleClick(selector)
to the Fluent API - feat(fluent-api): add helper method
getSelectedText()
to the Fluent API
- feat(selector-fluent): add
nextSibling()
to the Selector API
- feat(selector-fluent): add
withPlaceholder(text)
to the Selector API
playwright
is made a peer dependency with version >= 0.14.0
- feat(assertion): add
expectThatSelector(selector).hasPlaceholder(text)
to the Assertion API - feat(selector-fluent): add helper method
getAttribute(attributeName)
to the Selector API - feat(selector-fluent): add helper method
placeholder()
to the Selector API
- feat(fluent-api): add
withExtraHttpHeaders(headers)
to the Fluent API
- feat(browser-actions): default browser close timeout to 3000 milliseconds
- feat(selector-fluent): add helper method
hasClass(class)
to the Selector API - feat(selector-fluent): add helper method
doesNotHaveClass(class)
to the Selector API - feat(assertion): add
expectThatSelector(selector).doesNotHaveClass(className)
to the Assertion API
- feat(browser): add timeout option on closing the browser. This mechanism prevents a test to fail if closing the browser does not work as expected. It has been added to prevent a use case observed on windows where calling
close()
on the browser does close the browser but execution of this method never finishes, causing a timeout injest
orcucumber
.
playwright
is made a peer dependency with version >= 0.13.0
- feat(fluent-api): add
withWindowSize(size)
to the Fluent API - feat(fluent-api): add
withViewport(viewport)
to the Fluent API
- feat(utils): add toQueryString(url) utility method
- feat(utils): add toRequestInfo() utility method
- feat(fluent-api): add
uncheck(selector)
to the Fluent API - feat(selector): add helper method
isUnchecked()
to the Selector API - feat(fluent-api): add helper method
isUnchecked()
to the Fluent API - feat(assertion): add
expectThat(selector).isUnchecked()
to the Assertion API
- feat(fluent-api): add
check(selector)
to the Fluent API
- feat(fluent-api): add
withGeolocation(location)
to the Fluent API - feat(fluent-api): add
withPermissions(permissionA, permissionB, ...)
to the Fluent API
- feat(fluent-api): add
onRequestTo(url).respondWith(response)
to the Fluent API
- feat(fluent-api): add
select(labels).inFocused()
to the Fluent API
- option
throwOnTimeout
inWaitUntilOptions
now always defaults to true
- fix(utils): HTML encode not-a-json payload in method
stringifyRequest()
- fix(handle-actions): disable smooth scrolling
the scrollIntoView method becomes unresponsive after a few scrolling when the smooth option is enabled. Therefore this option has been removed until fixed.
- feat(selector): add helper method
options()
to the Selector API - feat(fluent-api): add helper method
getAllOptionsOf(selector)
to the Fluent API
- feat(assertion): add
expectThatSelector(selector).isChecked()
to the Assertion API - feat(selector): add helper method
isChecked()
to the Selector API - feat(fluent-api): add helper method
isChecked()
to the Fluent API
- feat(assertion): add
expectThatSelector(selector).hasClass(className)
to the Assertion API - feat(selector): add helper method
classList()
to the Selector API
- feat(assertion): add
expectThatSelector(selector).hasExactValue(value)
to the Assertion API
- feat(fluent-api): add
holdDownKey(key)
andreleaseKey(key)
to the Fluent API
- feat(fluent-api): add method
runStory(story)
to the Fluent API
- feat(fluent-api): add
pasteText(text)
to the Fluent API
- feat(fluent-api): add
clearText()
to the Fluent API
expectThat
method is renamed toexpectThatSelector
on the Fluent API
Though a major version should have been published, and because this library has still little usage, I decided to postpone the major version until the Playwright team publishes a new major version.
- refactor(fluent-api): rename
expectThat
method toexpectThatSelector
- feat(fluent-api): add
recordFailedRequests()
to the Fluent API - feat(assertion): add
expectThatSelector(selector).hasValue(value)
to the Assertion API - feat(assertion): add
expectThatAsyncFunc(func).resolvesTo(value)
to the Assertion API - feat(selector): add helper method
value()
to the Selector API - feat(fluent-api): add helper method
cast()
to the Fluent API
- feat(fluent-api): add helper method
takeFullPageScreenshotAsBase64()
to the Fluent API
- feat(assertion): add
expectThat(selector).hasText(text)
to the Assertion API - feat(fluent-api): add
recordPageErrors()
to the Fluent API - feat(fluent-api): add
select(option).in(selector)
to the Fluent API - feat(fluent-api): add helper method
getInnerTextOf(selector)
to the Fluent API - feat(fluent-api): add helper method
getPageErrors()
to the Fluent API - feat(fluent-api): add helper method
clearPageErrors()
to the Fluent API - feat(selector): add helper method
innerText()
to the Selector API
- feat(fluent-api): add
waitForStabilityOf(func)
to the Fluent API - feat(fluent-api): add
recordRequestsTo(url)
to the Fluent API - feat(fluent-api): add helper method
getRecordedRequestsTo(url)
to the Selector API - feat(fluent-api): add helper method
getLastRecordedRequestTo(url)
to the Selector API - feat(fluent-api): add helper method
clearRecordedRequestsTo(url)
to the Selector API
- PlaywrightController class is renamed to PlaywrightFluent
- SelectorController class is renamed to SelectorFluent
Though a major version should have been published, and because this library has still little usage, I decided to postpone the major version until the Playwright team publishes a new major version.
- project and package are renamed to
playwright-fluent
Though a major version should have been published, and because this library has still little usage, I decided to postpone the major version until the Playwright team publishes a new major version.
- feat(controller): the method
withBrowser()
can now target chrome - feat(controller): add
waitUntil(predicate)
to the Controller API - feat(controller): add
pressKey(key)
method to the Controller API - feat(controller): add
click(selector)
method to the Controller API - feat(controller): add
typeText(text)
to the Controller API - feat(selector): add helper method
.isVisible()
to the Selector API - feat(selector): add helper method
.isNotVisible()
to the Selector API - feat(assertion): add
expectThat(selector).isNotVisible()
to the Assertion API
- fix(browser-actions): close browser contexts first before closing the browser and do not throw but just log a warning on error while closing the browser.
- feat(assertion): add
expectThat(selector).isDisabled()
to the Assertion API - feat(assertion): add
expectThat(selector).isEnabled()
to the Assertion API - feat(controller): add
isEnabled(selector[, options])
to the Controller API - feat(controller): add
isDisabled(selector[, options])
to the Controller API - feat(controller): add
isVisible(selector[, options])
to the Controller API
- feat(assertion): add
expectThat(selector).isVisible()
to the Assertion API
- feat(assertion): add
expectThat(selector).hasFocus()
to the Assertion API - feat(controller): introduce Assertion API
expectThat(selector)
- feat(controller): add helper method
hasFocus(selector)
on controller API
- feat(controller): be able to hover on a Selector object created by the Selector API
- feat(controller): add method wait(duration) in Controller API
- feat(selector): add helper method getHandle() in Selector API
- feat(selector): add helper method exists() in Selector API
- fix(controller): expose executablePath in LaunchOptions
- feat(controller): introduce Selector API
- feat(controller): add method hover(selector) on Controller API
- feat(controller): add helper method getValueOf(selector) on Controller API
- feat(controller): add withCursor() to the Controller API
- feat(controller): add emulateDevice() to the Controller API
- feat(controller): disable internal playwright default viewport of 800x600
- feat(controller): add withOptions() to the controller API
- feat(controller): add helper method getCurrentWindowState() to the controller API
- implement minimalist fluent API around playwright