Repository navigation
Patch Changes
-
#60
e231dc2- Overlapping session storage calls on anabout:blankpage that inherited an origin, such as a popup fromwindow.open(), act in the order they were made, also when one comes from a page object's helper and another from a standalone one; before, the earlier value could win. -
#60
80cb5ea- A page object whosedefineLocators()returns a Promise, as anasyncone does, fails with a labeled error saying it must register synchronously; before, it was verified before the rest of its definition ran, and an error after its firstawaitescaped unlabeled. Move awaited work into the fixture and pass the result to the constructor. -
#60
e8831b8- Every session storage call checks the page's origin before and after each storage call it makes, and after each that the page's document is still the one it started in: a batch (set,clearwith several keys, aseedon the origin already), a single call, and each read ofget. When the page has left for another origin, or its document was replaced during the call (a reload or a redirect within the origin, during one of its storage calls or between two), the call fails with the helper's label, says where the page went (its origin and path, without the query or fragment), and names the keys already done, which stay, and the one in flight, which may have reached the new document:
Shop.SessionStorage.set: the page navigated to https://shop.example/home while set() was writing to https://shop.example; 2 of 60 keys were written ("k0", "k1"); "k2" was being written and may have reached the new document.
Agetfails rather than return what it may have read from the new document. Before, a navigation between two calls that both succeeded let the rest of a batch write into, or remove from, the other origin's storage, and a call the navigation interrupted failed with Playwright's rawExecution context was destroyed. Any other error from Playwright now gets the helper's label in front of its message, with the original ascause. -
#60
333a928-@step({ box: true })reports the step, and an error thrown inside it, at the line that called the method, as the docs
said. Before, a boxed step called from a test had no location and its error lost every stack frame, and one called from
another method was reported one frame too far out. A boxed step inside another boxed step, a boxed@stepor
a test's own boxedtest.step, was reported inside POMWright's bundle; boxed@stepmethods and the navigation and
session storage helpers now passtest.stepthe line that called them as itslocation, so they are reported there
however they are nested. An error in a nested boxed step keeps Playwright's rule: it is reported at the outermost boxed
call.@stepwithoutboxwas right and is unchanged, and so is how@stepis written. -
#60
b1ee8dc- Anupdate()orreplace()builder taken beforeskip()now throws when it applies its change to the skipped segment,
asupdate()andreplace()on a skipped segment already did. A skipped segment is never changed untilunskip():const query = getLocatorSchema("main.list.item"); const pending = query.update("main.list"); query.skip("main.list"); pending.locator("ol"); // update() cannot apply to "main.list": it is skipped in this query; call unskip("main.list") first.
Before, the change went through silently and appeared after
unskip(). -
#60
27f8d12-goto(target)names the page object when the target cannot be resolved against itsbaseUrl, as every other navigation message does:LoginPage: goto("http://") cannot be resolved against baseUrl "https://shop.example", with the URL parser's error ascause. Before, the message had no label. -
#60
54cdada- On Node 20 and 22, a stringurlPathcontaining^matches the page:expectThisPage()finds it, and
expectAnotherPage()no longer passes while the browser is still on it. Every browser reports a^in the path as
%5E, asnew URLdoes on Node 24, but Node 20 and 22'snew URLkeeps it, so the two never compared equal there.
A string path now treats^and%5Ein its path part as one, as it already did|and%7C, and a stringfullUrl
writes a^in its path as%5E, soexpect(page).toHaveURL(fullUrl)matches on every Node version. For a path with
|, which Chromium reports as%7C, useexpectThisPage(), which matches on every browser. -
#60
7f90436- A function that returnscreateRegistryWithAccessors()'s result, itsadd, a page object'sadd,registry.addorregistry.createReusablecan be exported from a project built withdeclaration: true; before, the emit failed with TS4023 and TS4094.createReusable's type is exported asReusableLocatorFactory. -
#60
ea330ef- A stored value that its codec cannot decode makesgetfail with the codec's reason in the message, then the value's
length and the whole value, quoted, so an empty or whitespace value shows:
Shop.SessionStorage.get: value for "user" could not be decoded (SyntaxError: …); stored value, 9 characters: "{not json".
Before, the reason was only in the error'scause, and the value followed unquoted. -
#60
c75ab43-expectThisPage()andexpectAnotherPage()treat a URL with an empty query or fragment (/orders?,/orders#) as a
different URL from/orders, as Playwright'stoHaveURLandwaitForURLdo and as the docs said ("a page's identity
is its exact URL").The matcher compared the path against
pathname + search + hash, where the URL API reports an empty query or fragment
as"", soexpectThisPage()passed on/orders?whileexpect(page).toHaveURL(ordersPage.fullUrl)failed. A RegExp
path is now tested against the same rest of the URL, the empty?or#included.If a page of yours may land with an empty query or fragment, give it a RegExp path that allows one, for example
/^\/orders\??$/. -
#60
a6ecacf-seed({}), for example from entries that turn out to be empty at run time, does nothing, asget([])andclear([])
with an empty list already did. Before, it registered a seed without keys, and a test that never went to that origin
failed at close with "the seed for … (keys: ) was never applied". -
#60
2accf34- The error for a registration that has ended names the registry call that ended it. When that call may have run in the
arguments offilteror the options oflocator, the two methods that take ahaslocator, the message also shows how
to write it.A registration ends at the next call on its registry, and JavaScript runs a call's arguments before the call, so a
getLocatorinside a filter's arguments ends the registration the filter belongs to:add("list.item@open").getByRole("listitem").filter({ has: getLocator("badge") });
filter() cannot apply to "list.item@open": its registration was ended by getLocator("badge"). If that call is in this filter's arguments, which run first, resolve the locator before add(…), or pass a path, which resolves to that path's own locator: filter({ has: "badge" }). Otherwise, give a registration all its steps in its add(…) chain, or query the path for one use.In
locator()'s options the path goes in afilterstep, and a query in the arguments (getLocatorSchema(…)) gets
the advice to resolve it beforeadd(…), without the path, which would drop the query's changes:locator() cannot apply to "section@inline": its registration was ended by getLocator("heading@explorer"). If that call is in this locator's options, which run first, resolve the locator before add(…), or filter by a path in a step: .filter({ has: "heading@explorer" }). Otherwise, give a registration all its steps in its add(…) chain, or query the path for one use. filter() cannot apply to "section@inline": its registration was ended by getLocatorSchema("heading@explorer"). If that query is in this filter's arguments, which run first, resolve it before add(…). Otherwise, give a registration all its steps in its add(…) chain, or query the path for one use.Before, the message said only that the registration had ended and to give it all its steps in its
add(…)chain,
which is what that line does. Every other ended registration now names its call too, for example
its registration was ended by add("main.list.item"). The rule itself is unchanged. Filters and indices has a new
section on passing a path, a locator or a chain tohas. -
#60
7447754-AllEntries,Decoded,SeedOptionsandSessionStorageOptionsare exported frompomwright, so a consumer can name
whatgetreturns and the options ofseedand ofnew SessionStorage(). The docs say every type is imported from
pomwright; these four were used in public signatures but not exported. Each has a section on theSessionStorageAPI
page, marked as added in 3.0.2. -
#60
2bab383- The package'sexportsmap has adefaultcondition afterimportandrequire, pointing at the CommonJS build, as
@playwright/test's map does. Node and TypeScript always matchedimportorrequire, so nothing changes for them; a
resolver that matches neither now finds the package instead of failing. -
#60
f46b982- A locator method that throws because its path is registered already leaves the registration as it was, so calling it
again reports the same error, not "has already been provided":A locator schema with the path "main" already exists.Before, the registration took the definition before the registry refused it, so a second call said
A locator definition for "main" has already been provided; only one locator type can be set for a registration.
for a locator that was never registered. -
#60
4e3a361-getByIdwith auorvRegExp that holds a quote, an apostrophe, a backtick or>>finds its element; before, it
failed with Playwright's selector parse error. The selector writes those characters by their code (\x22,\x27,
\x60, and\x3efor the second>), and the pattern stays the same. Withoutuorv, a RegExp with two quotes in
a row (/say["']hi/) or a named group closed right before a>(/(?<g>>)>/) failed the same way, and one with\>
before a>(/a\>>b/) was turned into another pattern: the pattern is now read whole, its escapes included. The
locators Playwright builds itself (getByRole'sname, the text methods,getByTestId,filter'shasText) keep
Playwright's limitations, which every POMWright locator meets because its description follows it: write the character
by its code (/don\x27t save/iu,/don["\x27]t save/i), or leave outu
(microsoft/playwright#40446); Registering locators lists them. -
#60
088f46c- On a page object whosebaseUrlis a RegExp,goto(target)no longer compiles for a relative target that holds a
colon ("/orders?at=12:00","?at=12:00","1:2"), which it always rejected at run time: the target's type now
requires a scheme that starts with a letter. Astringthat holds a URL narrows with a cast,
goto(url as `https://${string}`). -
#60
fa424ad- From JavaScript,navigation.goto()with aURLobject, or any first argument that is neither a URL string nor
options, throws as Playwright'spage.goto()does:LoginPage: goto() takes a URL string or options; received a URL object; pass its href.Before, it took the
URLobject for the options of the this-page form and navigated to the page object's own URL,
running its actions after navigation. TypeScript already rejected the call. -
#60
d4cffbb- ASessionStoragewith an origin (every page object's) now also refuses to touch another origin on a page at
about:blankwhose document inherited that origin, as a popup fromwindow.open()does:
… the page (about:blank) is on https://login.example, not on this page object's origin https://shop.example; ….
Before, the check saw no origin in the URL and let the helper write into the inherited origin's storage. -
#60
9bcf72e- A query kept while an ancestor of its path is registered says that the ancestor was registered after the query was
taken, and how to see it, instead of that it has no locator schema:"shell.list" is not a valid sub-path of "shell.list.item". It is a segment of that path, and it was registered after this query was taken; take a new query with getLocatorSchema("shell.list.item") to use it.The query's behavior is unchanged: it reads its own copy of the chain, taken at
getLocatorSchema. -
#60
4f80b37- Bare@stepcompiles withexperimentalDecorators: true, as@step()already did and as the docs promised. Before, it
failed with TS1241 and TS1270, although it worked at runtime. A method that does not return a Promise still gets the
readable error,@step decorates methods that return a Promise: make the method async, in both decorator modes. -
#60
b28686b- Thelogfixture checks Playwright'slocaleandtimezoneIdwhen a test starts and fails with a message naming the value, such aslog fixture: locale "en_US" is not a BCP 47 language tag; write it with hyphens, such as "en-US", instead of aRangeErrorat teardown once something was logged.attachLogsToTestchecks the same before it attaches anything. A test that requestslog, never logs and runs withlocale: "en_US"now fails too: write the tag with hyphens, which every browser accepts. A POSIX name such asen_US.UTF-8, asLANGholds it, gets the hint"en-US"; one with a modifier, such assr_RS@latin, gets none, since the modifier can change the script. -
#60
2d2c504- A path literal of any length compiles; one of 999 characters or more failed with TS2589. A path that breaks several
rules now names all of them, in the same order at compile time and at run time, and checking path types is faster.
add(path)throws for a path that breaks a rule, where its locator method threw before:LocatorSchemaPath string cannot contain whitespace chars and cannot start with a dot: .main listA path that breaks one rule keeps its message.
-
#60
bfbc00f- An app that declares its own globalnavigation(var navigation = …) no longer makesseedfail with
"seed() needs the Navigation API … and this browser has none". The check now tests theNavigationActivation
interface, which such a declaration does not hide. -
#60
8c8d8fb- A RegExp page object'snavigationis no longer accepted asNavigationFor<string, string>, sogoto()without a target is a compile error there too, as the docs say; before, a function typed for a string page's helper took it, andgoto()threw at run time.NavigationForchecksgotostrictly now. A function that takes any page object's helper types its parameterNavigationFor<RegExp, UrlMatcher>, which every page object's helper fits. -
#60
aa70821-expectThisPage()andexpectAnotherPage()say when they time out on the load state of the right URL:
OrdersPage: reached "https://shop.example/orders", but its "load" state did not come in time (…), and
OrdersPage: left "https://shop.example/orders" for "https://shop.example/login", but its "load" state did not come in time (…).
Before, the message named the URL it found as the one it did not expect:expected URL "…/orders"; found "…/orders". -
#60
c35eae4- When seeds for several origins are never applied, the failure says "were never applied" and lists each seed with its helper and the line that called it, such asPay.SessionStorage.seed at tests/checkout.spec.ts:12:5, for https://pay.example (keys: "orderId"); before, it named and pointed at the first seed only. -
#60
9dc8048- Options, filters andupdate()patches given as a class instance, or as an object with a prototype, keep the values
Playwright would read from them: a getter on the class, or a value the object inherits. Before, the copy POMWright
stores took only the object's own enumerable properties and dropped those values without an error, so the locator could match
more than Playwright's own call with the same object:class SaveButton { get name() { return "Save"; } } page.getByRole("button", new SaveButton()); // the Save button add("save").getByRole("button", new SaveButton()); // was every button; now the Save button
The same holds for an own property that is not enumerable, as
Object.definePropertymakes one: Playwright reads it,
and the copy keeps it.A plain object behaves exactly as before. Methods on a prototype are not copied.
-
#60
0028097- A URL whose scheme has no origin in the URL standard, such aschrome-extension://abcdef/,app://foo/or
file://host/, is rejected as a page object'sbaseUrland asSessionStorage'sorigin, with the origin message
and the reason (…; received "chrome-extension://abcdef/", whose scheme has no URL origin). Before,SessionStorage
accepted it as the origin"null", so its origin check never matched and a seed for it never applied, and a page
object failed with a message about itsurlPath. -
#60
445fc71- A page object's failed locator check points the report at the line that created the page object, also when it extends a base class of your own; before, it pointed at the firstsuper(…)of the class chain, with a shared base class the same line for every page object. -
#60
d710c12- On Chromium, a page object whose stringurlPathcontains|matches its page. Chromium reports a|in the path as
%7C, where Firefox, WebKit andnew URLkeep it, soexpectThisPage()timed out on the page andexpectAnotherPage()
passed while the browser was still on it. A string path now compares the two forms as one; a RegExp path sees the URL
as the browser reports it, as before. -
#60
7131d3d-setandseedstore an entry whose key is__proto__. Before, the entry was dropped without an error:setand
seedresolved, and nothing was stored.await storage.set("__proto__", "x"); // now stored, as page.sessionStorage.setItem stores it await storage.set(JSON.parse(savedSnapshot)); // a snapshot with that key keeps it await storage.seed("__proto__", "x"); // written on arrival
-
#60
8bdcd35- A query'sdescribe()on a path registered asframeLocator()without a selector throws at the call, as its
filter()andnth()do; replace the path first:describe() cannot apply to "anyFrame": frameLocator() without a selector has no element to filter, index or describe; resolve a path inside it.Before,
describe()thenreplace()worked whilefilter()thenreplace()threw, so the query's behavior depended
on the order of its calls. -
#60
e37a039- Session storage messages quote the keys they name, asget's messages always did:(keys: "orderId")instead of
(keys: orderId), so an empty key, or one holding,, reads as itself. Of the released messages, those of a seed whose
write the browser refused and of a seed that was never applied change. -
#60
49454c6-createRegistryWithAccessorsrequires its paths as a type argument. Without one, the first path is a compile error that
says so:Argument of type '"main"' is not assignable to parameter of type '"createRegistryWithAccessors needs its paths as a type argument: createRegistryWithAccessors<Paths>(page)"'.Before, the paths were inferred as
string, so no path was checked and no sub-path compiled. Pass the path union,
createRegistryWithAccessors<Paths>(page), or<string>for paths known only at run time, which gives up completions,
the union check and sub-paths (a literal path is still checked for the rules of a path). -
#60
ff6495e-add(path, { reuse })compiles when the paths are variables: of the path union, of a template union in a loop, or wide
strings. A literal path that reuses itself is still a compile error, and any self-reuse still throws at the call:for (const action of actions) { registry.add(`dialog.button@${action}`, { reuse: `main.toolbar.button@${action}` }); // compiles now }
Before, a reuse was refused as "the same as registration path" whenever the registration path's type covered the reuse
path's, whatever the values, and a union-typedreusematched none of the options. -
#60
17426a5- On a document whose own origin is opaque, such as one served withContent-Security-Policy: sandboxwithout
allow-same-origin, or the error page Firefox shows at the origin's URL after a failed navigation,set,get,
clearand an on-originseedfail with
Shop.SessionStorage.set: the document at … cannot use sessionStorage: its origin is opaque (the browser's error page after a failed navigation, or a sandboxed document: Content-Security-Policy: sandbox without allow-same-origin)
on every browser, also when the document's own script declares a globalorigin. Before, Chromium and WebKit said
"the page has no origin yet … or use seed()", also fromseed, and Firefox gave the browser's error without the
helper's label.seedon a page without an origin no longer suggestsseed(). On anabout:blankpopup whose
document inherited its opener's origin, and once such a popup has closed, a call that fails gets Playwright's error
with the helper's label, where it said "the page has no origin yet", for example
Shop.SessionStorage.set: webStorage.setItem: QuotaExceededError: The quota has been exceeded. -
#60
e05b84d- A page object that passessessionStorage.schemamust declare its type, aSessionStoragegiven an explicit schema type must be given the schema value, and the value must hold a codec for every declared key, optional ones included, as the docs say. Before, each compiled, and the helper's types and codecs disagreed:getcould be typedstring | nulland return an object, or the reverse.Take the type from the value, and pass that value:
PageObject<Paths, { storage: typeof schema }>with{ sessionStorage: { schema } }, ornew SessionStorage(page, { schema }), whose type comes from the value. A subclass of a base class of your own that forwardsPageObjectOptionsand has no options type parameter (ShopPage<Paths> extends PageObject<Paths>) cannot declare the type where the error is reported: make the base class take the options as a type parameter and pass them toPageObject, as Organizing a project shows (https://dyhex.github.io/POMWright/docs/organizing-a-project/#a-base-class-for-your-site), and declare{ storage: typeof schema }in the subclass.Two cases still compile: a page object that declares
storageand passes no schema, and a schema passed through a variable with a codec its type does not declare, since TypeScript checks extra keys on object literals only; that key is then decoded by its codec while its type says a string. -
#60
d12966a- When the page closes whileseedis still registering (an un-awaitedseedat the end of a test, or a page closed
right after it),seedfails with its label, the origin and the keys, and the stack starts at theseedline:
Shop.SessionStorage.seed: the page closed while seed() was registering the seed for https://pay.example (keys: "orderId"); await seed() before the test ends.
Before, it failed with Playwright's rawpage.evaluate: Target page, context or browser has been closedand no frame of
the test. Any other error from the page while a seed registers also gets the label and the call site. -
#60
5ceb13c- With Playwright's step overlay (video: { show: { test } }), aseedraced by a navigation to its origin (not awaited,
or called while agotois under way) fails at the call, as it does without the overlay, instead of resolving while the
app started without the entries.seednow reads the page and watches for a commit from the moment it is called; the
overlay's update ran beforeseed's step and hid such a commit. -
#60
819c477- A seed's failure found in a page listener (a refused write, a seed the arriving document skipped, a seed never applied
when the page closes) no longer stops the page's otherconsoleorcloselisteners: the error is rethrown from a
microtask, which still fails the test at once, with theseedline in its stack. Before, it was thrown inside
POMWright's listener, so a listener the test added after theseeddid not run. -
#60
52f2d4c-seedon a popup atabout:blankthat inherited the seeded origin writes at once, assetdoes there; a latersetis no longer overwritten when the popup navigates to the origin, and Firefox no longer fails the test. When a seed is not applied because the browser counted the arrival as a return, the message now says why:… (navigation.activation.from is set): the document before it was already on the origin, as after a failed navigation to it. -
#60
a23aa0d- A seed that the document arriving at its origin does not write now fails the test at theseedline instead of
passing silently. After a navigation to the origin that failed (a refused connection, offline,route.abort()),
Chromium counts the retry as a return to the origin, so the app started without the entries and the test went on;
it now fails with… was not applied: the browser counted the page's arrival on … as a return there …. Firefox shows
its error page at the origin's URL and failed with a refused-write message although no app had loaded; it now fails
with… was not applied: the document that arrived on … has an opaque origin …. The seed script never writes into a
browser's error page. WebKit applies the seed on the next arrival, as before. A retry is not attempted: a failed
navigation to a seeded origin fails the test. -
#60
53f571f-seedno longer fails when the page replaces its document more than once during its first seed's Navigation API
check, as an app that redirects itself by script on load does (/to/loginto/login/start). Before, such a seed
failed with Playwright'sExecution context was destroyed. The check is now repeated while the page replaces its
document, up to 20 times (the default of Playwright'smaxRedirects), each after the pause Playwright makes before a
retry of its own actions (20 ms, rising to 500 ms); past that, Playwright's error goes through with the helper's
label. -
#60
b4fee4a-step()with a title or options returns a decorator whose type is exported frompomwright,StepDecorator. A module can export a preconfigured decorator, such asexport const boxedStep = step({ box: true }), and still build withdeclaration: true; before, the emit failed with TS4023. -
#60
ea94410-@stepcompiles on genericasyncmethods, with standard decorators and withexperimentalDecorators, and the method keeps its type parameters; before, TypeScript refused them, and underexperimentalDecoratorsasked to make the alreadyasyncmethodasync. A generic method that does not return a Promise is still refused with@step decorates methods that return a Promise: make the method async. -
#60
2e15291-@stepon a method that returns a plain value now throws at run time too (from JavaScript), with the compile error's message,@step decorates methods that return a Promise: make the method async; before, the method silently returned a Promise. -
#60
d807acb- A@stepmethod called without its object, for example passed as a callback (items.map(cart.addItem)), runs as an
undecorated method does: titled with its own title, orAnonymous.<method>without one. Before, it threw
TypeError: Cannot read properties of undefined (reading 'constructor')before the method ran, even with a title of
its own. -
#60
34c2ec0- Session storage calls for one origin act in the order they were made, also when they overlap: on the origin the page is
on as well as before a hop, and forset,getandclearas well asseed.3.0.1 made overlapping
seedcalls for an origin the page is not on merge in call order. On the origin the page is
already on,seedstill wrote key by key, and two overlapping calls interleaved, so an earlier value could win:await page.goto("https://shop.example/account"); await Promise.all([storage.seed({ first: "1", shared: "earlier" }), storage.seed({ shared: "later" })]); // shared was "earlier"; it is now "later"
set,getandclearinterleaved the same way. Every call now takes its turn per page and origin, across every
helper on the page (a page object's and a standalone one), so overlapping calls end exactly as awaited ones do. A call
that waited checks the origin again when its turn comes. A helper with an origin throws the usual origin message if the
page has left it; a helper without one fails, and does nothing, if the page has left the origin the call was made on,
rather than act on an origin it was not called on:
Shop.SessionStorage.set: the page left https://shop.example for https://login.example while set() waited for its turn; the call did nothing.
A call takes its arguments when it is made, as Playwright's calls do: before,setandseedencoded their values in
their step, andgetandclearread their key lists in their turn, so a value or a list changed after the call, while
it waited, changed what it did. Awaited calls behave as before. -
#60
adffd1e- Writing a value that is not a string to a key without a codec now says where codecs are declared:Shop.SessionStorage.set: value for "user" is not a string and no codec is declared for it; declare one in the schema (a page object's sessionStorage.schema option)A page object declares its storage schema twice: the type under
storagein its type options, and the value in the
constructor'ssessionStorage.schemaoption. The compiler now checks that a value comes with its type, but not that a
declared type comes with its value. Without the value, the declared keys are stored and read as raw strings, and this
message is the one place where that fails loudly. The Session storage page now says so. -
#60
64cd0b7- A session storage key whose type is not a literal is now typed by what it can be, as the docs say ("a declared key as its codec's type"): a key typedstringor a branded string (string & { … }) asstringor any declared codec's type, and a pattern such as`user:${string}`asstringor the codecs' types of the declared keys it matches.get(key)andget([key])return that, andsetandseedaccept it; a union is typed member by member. Before, such a key was typed as a plain string, although a declared key returned its decoded value at run time. Literal keys, unions of literals,get()and a schema without codecs keep their types.Code that used such a value as a string, with a schema that has codecs, stops compiling only where the key can match a declared key: pass the literal key, type the variable as the schema's keys (
keyof typeof schema), or narrow the value (typeof value === "string"). -
#60
49454c6- A query's sub-path arguments accept template-literal members of the path union (the query's own path and template
ancestors), compile on a registry typed<string>, where the runtime checks them, and compile again in a generic base
class on the paths it adds: this worked in 1.x and broke in 2.0.0, and is now restored.type Paths = "main" | "main.orders" | `main.orders.row@${string}`; registry.getLocatorSchema("main.orders.row@1042").filter("main.orders.row@1042", { hasText: "Open" }); // compiles now abstract class SitePage<PagePaths extends string> extends PageObject<PagePaths | CommonPaths> { acceptCookiesFor(vendor: string) { // a sub-path on the common paths compiles in the base class again return this.getLocatorSchema("dialog@consent.button@accept").filter("dialog@consent", { hasText: vendor }); } }
A path written out stays a sub-path only where it is a segment of the chain, and a namespace that is not a declared path
is still a compile error. -
#60
3284aa4- Releases are published with npm Trusted Publishing: npm authenticates the GitHub Actions workflow that publishes, so the
workflow uses no npm token, and records the provenance of each version from that workflow.3.0.0 and 3.0.1 were published without a provenance attestation, although the 3.0.0 entry said releases are published
with npm provenance.npm view pomwright@<version> dist --jsonshows whether a version has one. -
#60
db26390-update()and a seeded registration (add(path, { reuse: seed })) acceptundefinedas the first argument in their
types, as they already did at runtime: it keeps the registered value, as an omitted argument does. A value that may be
undefined can now be passed through:declare const role: "button" | "link" | undefined; getLocatorSchema("main.button@save").update().getByRole(role, { name: "Cancel" }); // compiles; undefined keeps the role
A registration and
replace()still require the first argument, as Playwright's methods do, butframeLocator()'s,
whose absence is Playwright's any-frame form. -
#60
c9c8f34- A page object'surlPathmust stay on its base's origin, and abaseUrlmay not end in a bare?or#.The constructor rejected a
urlPaththat starts with//, which names another host, but accepted others that do the
same once the URL standard has read them: a backslash after the first/("/\\other.example/x"), or a tab or line
break followed by/or a backslash. With such a path,fullUrlandgoto()went to the other host, and
expectThisPage()then failed there with a message that named the same URL as expected and found. The constructor now
resolves the path and throws when it leaves the base's origin:LoginPage: urlPath must be a path on the page object's origin; received "/\\login.example/account", which names the host "login.example" instead. A "/" followed by another "/" or a "\", also with a tab or line break between them, starts a host.A
baseUrlsuch as"https://shop.example?"passed the origin check, and everyfullUrlbuilt on it carried the?.
It is now rejected with the existingbaseUrl must be an origin …message. A base with credentials
(https://user:secret@shop.example) is accepted as before. -
#60
1dc488f-verify()reports anadd(path)that never got a locator method, such asadd("main.form@login");written as a
statement:"main.form@login": add("main.form@login") ended without a locator method (at add("main.form@login.button@login")); give it one or remove it.
Before, such anaddregistered nothing, every chain below the path left the segment out, andverify()passed. A
registry with such anaddnow fails its check, in a page object at its first use: give theaddits locator method,
or remove it.