Skip to content

Commit 728db03

Browse files
authored
fix: selector will be register multiple times (#251)
1 parent b4ba188 commit 728db03

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/PlaywrightEnvironment.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ export const getPlaywrightEnv = (basicEnv = 'node'): unknown => {
126126
if (selectors) {
127127
await Promise.all(
128128
selectors.map(({ name, script }) => {
129-
return playwright.selectors.register(name, script)
129+
return playwright.selectors
130+
.register(name, script)
131+
.catch((e: Error): void => {
132+
if (!e.toString().includes('has been already')) {
133+
throw e
134+
}
135+
})
130136
}),
131137
)
132138
}

0 commit comments

Comments
 (0)