fix: relative ordering of events and command responses should be ensured (#10725)
This commit is contained in:
parent
3dfff5af6b
commit
81ecb60190
@ -299,8 +299,8 @@ export class Connection extends EventEmitter {
|
||||
*/
|
||||
protected async onMessage(message: string): Promise<void> {
|
||||
if (this.#delay) {
|
||||
await new Promise(f => {
|
||||
return setTimeout(f, this.#delay);
|
||||
await new Promise(r => {
|
||||
return setTimeout(r, this.#delay);
|
||||
});
|
||||
}
|
||||
debugProtocolReceive(message);
|
||||
|
@ -51,9 +51,11 @@ export class NodeWebSocketTransport implements ConnectionTransport {
|
||||
constructor(ws: NodeWebSocket) {
|
||||
this.#ws = ws;
|
||||
this.#ws.addEventListener('message', event => {
|
||||
if (this.onmessage) {
|
||||
this.onmessage.call(null, event.data);
|
||||
}
|
||||
setImmediate(() => {
|
||||
if (this.onmessage) {
|
||||
this.onmessage.call(null, event.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.#ws.addEventListener('close', () => {
|
||||
if (this.onclose) {
|
||||
|
@ -2651,6 +2651,12 @@
|
||||
"parameters": ["firefox", "webDriverBiDi"],
|
||||
"expectations": ["SKIP"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[locator.spec] Locator Locator.race races multiple locators",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["cdp", "firefox"],
|
||||
"expectations": ["SKIP"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[mouse.spec] Mouse should reset properly",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
@ -224,6 +224,7 @@ describe('Locator', function () {
|
||||
it('should time out', async () => {
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
const {page} = await getTestState();
|
||||
@ -247,6 +248,7 @@ describe('Locator', function () {
|
||||
const {page} = await getTestState();
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
page.setDefaultTimeout(5000);
|
||||
@ -268,6 +270,7 @@ describe('Locator', function () {
|
||||
const {page} = await getTestState();
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
page.setDefaultTimeout(5000);
|
||||
@ -509,6 +512,7 @@ describe('Locator', function () {
|
||||
const {page} = await getTestState();
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
await page.setViewport({width: 500, height: 500});
|
||||
@ -535,6 +539,7 @@ describe('Locator', function () {
|
||||
it('should time out when all locators do not match', async () => {
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
const {page} = await getTestState();
|
||||
@ -630,6 +635,7 @@ describe('Locator', function () {
|
||||
it('should resolve as soon as the predicate matches', async () => {
|
||||
const clock = sinon.useFakeTimers({
|
||||
shouldClearNativeTimers: true,
|
||||
shouldAdvanceTime: true,
|
||||
});
|
||||
try {
|
||||
const {page} = await getTestState();
|
||||
|
Loading…
Reference in New Issue
Block a user