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> {
|
protected async onMessage(message: string): Promise<void> {
|
||||||
if (this.#delay) {
|
if (this.#delay) {
|
||||||
await new Promise(f => {
|
await new Promise(r => {
|
||||||
return setTimeout(f, this.#delay);
|
return setTimeout(r, this.#delay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
debugProtocolReceive(message);
|
debugProtocolReceive(message);
|
||||||
|
@ -51,9 +51,11 @@ export class NodeWebSocketTransport implements ConnectionTransport {
|
|||||||
constructor(ws: NodeWebSocket) {
|
constructor(ws: NodeWebSocket) {
|
||||||
this.#ws = ws;
|
this.#ws = ws;
|
||||||
this.#ws.addEventListener('message', event => {
|
this.#ws.addEventListener('message', event => {
|
||||||
if (this.onmessage) {
|
setImmediate(() => {
|
||||||
this.onmessage.call(null, event.data);
|
if (this.onmessage) {
|
||||||
}
|
this.onmessage.call(null, event.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.#ws.addEventListener('close', () => {
|
this.#ws.addEventListener('close', () => {
|
||||||
if (this.onclose) {
|
if (this.onclose) {
|
||||||
|
@ -2651,6 +2651,12 @@
|
|||||||
"parameters": ["firefox", "webDriverBiDi"],
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
"expectations": ["SKIP"]
|
"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",
|
"testIdPattern": "[mouse.spec] Mouse should reset properly",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -224,6 +224,7 @@ describe('Locator', function () {
|
|||||||
it('should time out', async () => {
|
it('should time out', async () => {
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
@ -247,6 +248,7 @@ describe('Locator', function () {
|
|||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
page.setDefaultTimeout(5000);
|
page.setDefaultTimeout(5000);
|
||||||
@ -268,6 +270,7 @@ describe('Locator', function () {
|
|||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
page.setDefaultTimeout(5000);
|
page.setDefaultTimeout(5000);
|
||||||
@ -509,6 +512,7 @@ describe('Locator', function () {
|
|||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await page.setViewport({width: 500, height: 500});
|
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 () => {
|
it('should time out when all locators do not match', async () => {
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
@ -630,6 +635,7 @@ describe('Locator', function () {
|
|||||||
it('should resolve as soon as the predicate matches', async () => {
|
it('should resolve as soon as the predicate matches', async () => {
|
||||||
const clock = sinon.useFakeTimers({
|
const clock = sinon.useFakeTimers({
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
|
shouldAdvanceTime: true,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
|
Loading…
Reference in New Issue
Block a user