@@ -641,6 +641,12 @@ runRuleTester('prefer-web-first-assertions', rule, {
641
641
code : javascript ( 'expect(await foo.allTextContents()).toBe("bar")' ) ,
642
642
errors : [ { messageId : 'useWebFirstAssertion' } ] ,
643
643
} ,
644
+ {
645
+ code : javascript ( `
646
+ const myText = page.locator('foo li').allTextContents();
647
+ expect(myText).toEqual(['Alpha', 'Beta', 'Gamma'])` ) ,
648
+ errors : [ { messageId : 'useWebFirstAssertion' } ] ,
649
+ } ,
644
650
{
645
651
code : javascript ( 'expect(await foo.allTextContents()).not.toBe("bar")' ) ,
646
652
errors : [ { messageId : 'useWebFirstAssertion' } ] ,
@@ -1266,6 +1272,7 @@ runRuleTester('prefer-web-first-assertions', rule, {
1266
1272
{ code : test ( 'let visible = await foo.isVisible()' ) } ,
1267
1273
{ code : test ( 'const value = await bar["inputValue"]()' ) } ,
1268
1274
{ code : test ( 'const isEditable = await baz[`isEditable`]()' ) } ,
1275
+ { code : test ( 'const myText = page.locator("foo li").allTextContents()' ) } ,
1269
1276
{
1270
1277
code : javascript `
1271
1278
import { expect } from '@playwright/test' ;
@@ -1332,10 +1339,5 @@ runRuleTester('prefer-web-first-assertions', rule, {
1332
1339
expect(fooLocatorText).toEqual('foo')
1333
1340
` ) ,
1334
1341
} ,
1335
- {
1336
- code : test ( `
1337
- const myText = page.locator('foo li').allTextContents();
1338
- expect(myText).toEqual(['Alpha', 'Beta', 'Gamma'])` ) ,
1339
- } ,
1340
1342
] ,
1341
1343
} )
0 commit comments