@@ -641,6 +641,12 @@ runRuleTester('prefer-web-first-assertions', rule, {
641641 code : javascript ( 'expect(await foo.allTextContents()).toBe("bar")' ) ,
642642 errors : [ { messageId : 'useWebFirstAssertion' } ] ,
643643 } ,
644+ {
645+ code : javascript ( `
646+ const myText = page.locator('foo li').allTextContents();
647+ expect(myText).toEqual(['Alpha', 'Beta', 'Gamma'])` ) ,
648+ errors : [ { messageId : 'useWebFirstAssertion' } ] ,
649+ } ,
644650 {
645651 code : javascript ( 'expect(await foo.allTextContents()).not.toBe("bar")' ) ,
646652 errors : [ { messageId : 'useWebFirstAssertion' } ] ,
@@ -1266,6 +1272,7 @@ runRuleTester('prefer-web-first-assertions', rule, {
12661272 { code : test ( 'let visible = await foo.isVisible()' ) } ,
12671273 { code : test ( 'const value = await bar["inputValue"]()' ) } ,
12681274 { code : test ( 'const isEditable = await baz[`isEditable`]()' ) } ,
1275+ { code : test ( 'const myText = page.locator("foo li").allTextContents()' ) } ,
12691276 {
12701277 code : javascript `
12711278 import { expect } from '@playwright/test' ;
@@ -1332,10 +1339,5 @@ runRuleTester('prefer-web-first-assertions', rule, {
13321339 expect(fooLocatorText).toEqual('foo')
13331340 ` ) ,
13341341 } ,
1335- {
1336- code : test ( `
1337- const myText = page.locator('foo li').allTextContents();
1338- expect(myText).toEqual(['Alpha', 'Beta', 'Gamma'])` ) ,
1339- } ,
13401342 ] ,
13411343} )
0 commit comments