Issue 1:
Context:

Playwright Version: 1.16.0

Operating System: Windows

Node.js version: 14.6.1

Browser: Chrome

Extra: WebStorm IDE

Code Snippet

-----Used Method-----

await expect(waitingMask).toHaveCount(0, {timeout: 40000});

-----Test file-----

import {expect, test} from "@playwright/test";
import BasePage from "../../../../Common/BasePage";
import UnifyLoginPage from "../../../../Unify/Pages/UnifyLoginPage";
import UnifyBasePage from "../../../../Unify/Pages/UnifyBasePage";
import ApplicationUrl from "../../../../Helpers/ApplicationUrl";
import SalesPage from "../../../../Unify/Pages/Sales/SalesPage";
import SalesSidePanel from "../../../../Unify/Pages/Sales/SalesSidePanel";
import {ModulesEnum} from "../../../../Unify/NavigationEnums/ModulesEnum";
import { SalesLeftSideMenuEnum } from "../../../../Unify/NavigationEnums/SalesLeftSideMenuEnum";
import SeatListPage from "../../../../Unify/Pages/Sales/SeatListPage";

test.describe.only("Seat List Tests @run", async () => {

let basePage: BasePage;
let unifyBasePage: UnifyBasePage;
let unifyLoginPage: UnifyLoginPage;
let salesPage: SalesPage;
let salesSidePanel: SalesSidePanel;
let seatListPage: SeatListPage;

test.beforeEach(async ({page}) => {
basePage = new BasePage(page);
unifyBasePage = new UnifyBasePage(page);
unifyLoginPage = new UnifyLoginPage(page);
salesPage = new SalesPage(page);
salesSidePanel = new SalesSidePanel(page);
seatListPage = new SeatListPage(page);

//Login and navigate to seat list
await basePage.loadApplication(ApplicationUrl.UNIFY);
await page.setViewportSize({width: 1400, height: 900});
await unifyLoginPage.loginToUnify("sro", "1");
await unifyBasePage.validateLogin();
await unifyBasePage.navigateToModule(ModulesEnum.SALES);
await salesPage.selectCategory(SalesLeftSideMenuEnum.SEAT_LIST);

});

test.afterEach(async ({context}) => {
await context.clearCookies();
});

test("Validate apply button is disabled when 'change' and 'to' are empty", async ({page}) => {
await test.step("Select Filter and Search", async () => {
await seatListPage.selectShowTypeByIndex(0);
await seatListPage.search();
});

await test.step("Switch to Manage Mode", async () => {
await seatListPage.selectManageMode();
});

await test.step("Select First Search Result", async () => {
await seatListPage.selectSearchResultByIndex(0);
});

//Validate apply button is disabled when 'change' and 'to' are empty
await seatListPage.validateApplyButtonDisabled();

})
})

-----Output-----

Starting test Validate apply button is disabled when 'change' and 'to' are empty
Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts:44:5 › Seat List Tests @run › Validate apply button is disabled when 'change' and 'to' are empty
2021-10-22 07:05:47.343 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:06:27.409 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:07:07.527 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:07:07.530 INFO [myLogger Common\BasePage.ts:62 UnifyLoginPage.clickElement] Clicked Locator@[name="__RIA_userName"] successfully
2021-10-22 07:07:47.607 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:08:27.677 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:09:07.761 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

x Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts:44:5 › Seat List Tests @run › Validate apply button is disabled when 'change' and 'to' are empty (4m)
2021-10-22 07:09:09.554 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:09:09.572 ERROR [myLogger Common\BasePage.ts:65 UnifyLoginPage.clickElement] Click on .screenLogin.loginBtn failed
2021-10-22 07:09:09.583 ERROR [myLogger Common\BasePage.ts:65 UnifyLoginPage.clickElement] Click on .screenLogin.loginBtn failed
Finished the test Validate apply button is disabled when 'change' and 'to' are empty: failed
Finished the run: failed

1) Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts:44:5 › Seat List Tests @run › Validate apply button is disabled when 'change' and 'to' are empty

Pending operations:
- expect.toHaveCount at Common\BasePage.ts:76:39

page.waitForSelector: Target closed
=========================== logs ===========================
waiting for selector "[data-uitestingname="Home"]" to be visible
============================================================

32 | await page.setViewportSize({width: 1400, height: 900});
33 | await unifyLoginPage.loginToUnify("sro", "1");
> 34 | await unifyBasePage.validateLogin();
| ^
35 | await unifyBasePage.navigateToModule(ModulesEnum.SALES);
36 | await salesPage.selectCategory(SalesLeftSideMenuEnum.SEAT_LIST);
37 |

at Validator.validateElementVisible (D:\projects\sro4\uiAutomation\PlaywrightTest\Common\Validator.ts:17:25)
at UnifyBasePage.validateLogin (D:\projects\sro4\uiAutomation\PlaywrightTest\Unify\Pages\UnifyBasePage.ts:35:30)
at D:\projects\sro4\uiAutomation\PlaywrightTest\Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts:34:29
at WorkerRunner._runHooks (D:\projects\sro4\uiAutomation\PlaywrightTest\node_modules\@playwright\test\lib\workerRunner.js:544:9)
at WorkerRunner._runBeforeHooks (D:\projects\sro4\uiAutomation\PlaywrightTest\node_modules\@playwright\test\lib\workerRunner.js:450:7)
at WorkerRunner._runTestWithBeforeHooks (D:\projects\sro4\uiAutomation\PlaywrightTest\node_modules\@playwright\test\lib\workerRunner.js:470:32)

attachment #1: video (video/webm) --------------------------------------------------------------
test-results\Tests-Unify-Sales-SeatList-VerifyApplyButtonDisablement-Seat-List-Tests-run-Validate-apply-button-is-disabled-when-change-and-to-are-empty\8106389fe1d8c874687d13264038
2d50.webm
------------------------------------------------------------------------------------------------

attachment #2: trace (application/zip) ---------------------------------------------------------
test-results\Tests-Unify-Sales-SeatList-VerifyApplyButtonDisablement-Seat-List-Tests-run-Validate-apply-button-is-disabled-when-change-and-to-are-empty\trace.zip
Usage:

npx playwright show-trace test-results\Tests-Unify-Sales-SeatList-VerifyApplyButtonDisablement-Seat-List-Tests-run-Validate-apply-button-is-disabled-when-change-and-to-are-empt
y\trace.zip

------------------------------------------------------------------------------------------------

attachment #3: screenshot (image/png) ----------------------------------------------------------
test-results\Tests-Unify-Sales-SeatList-VerifyApplyButtonDisablement-Seat-List-Tests-run-Validate-apply-button-is-disabled-when-change-and-to-are-empty\test-failed-1.png
------------------------------------------------------------------------------------------------

--- Test output ------------------------------------------------------------------------------------

2021-10-22 07:05:47.343 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:06:27.409 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:07:07.527 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:07:07.530 INFO [myLogger Common\BasePage.ts:62 UnifyLoginPage.clickElement] Clicked Locator@[name="__RIA_userName"] successfully
2021-10-22 07:07:47.607 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:08:27.677 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:09:07.761 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:09:07.764 INFO [myLogger Common\BasePage.ts:62 UnifyLoginPage.clickElement] Clicked Locator@[name="__RIA_password"] successfully
2021-10-22 07:09:09.554 ERROR [myLogger Common\BasePage.ts:99 UnifyLoginPage.waitUntilWaitingMaskInvisible] Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector "[class="waitingMask"]"
- selector resolved to 0 elements

2021-10-22 07:09:09.572 ERROR [myLogger Common\BasePage.ts:65 UnifyLoginPage.clickElement] Click on .screenLogin.loginBtn failed
2021-10-22 07:09:09.583 ERROR [myLogger Common\BasePage.ts:65 UnifyLoginPage.clickElement] Click on .screenLogin.loginBtn failed

----------------------------------------------------------------------------------------------------

Slow test: Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts (4m)

1 failed
Tests\Unify\Sales\SeatList\VerifyApplyButtonDisablement.spec.ts:44:5 › Seat List Tests @run › Validate apply button is disabled when 'change' and 'to' are empty

Describe the bug

As can be seen from the output of the IDE - even though the assertion of the toHaveCount(0) failed - the test continued and failed after several assertions because the element of the next step was not found. The expected behavior of the assertion is to stop the test in case the assertion was not resolved successfully, isn't it?

Issue 2:
Context:

GOOD Playwright Version: 1.15

BAD Playwright Version: 1.16

Code Snippet

import { test, expect } from '@playwright/test';

test('should display zero initial items', async ({ page }) => {
await page.goto('https://todomvc.com/examples/vanilla-es6/');
await expect(page.locator('.todo-list li')).toHaveCount(0);
});

Describe the bug

Expected: Was passing

Actual: Not passing anymore

Getting:

Error: expect(received).toHaveCount(expected) // deep equality

Expected: 0
Received: undefined

Call log:
- waiting for selector ".todo-list li"
- selector resolved to 0 elements

3 | test('should display zero initial items', async ({ page }) => {
4 | await page.goto('https://todomvc.com/examples/vanilla-es6/');
> 5 | await expect(page.locator('.todo-list li')).toHaveCount(0);
| ^
6 | });