fix(codegen): do not forget to reset currentAction in didPerformAction (#5194)
This commit is contained in:
parent
e50f11c5b1
commit
2793d14409
|
|
@ -93,8 +93,10 @@ export class CodeGenerator {
|
||||||
eraseLastAction = true;
|
eraseLastAction = true;
|
||||||
}
|
}
|
||||||
if (lastAction && action.name === 'navigate' && lastAction.name === 'navigate') {
|
if (lastAction && action.name === 'navigate' && lastAction.name === 'navigate') {
|
||||||
if (action.url === lastAction.url)
|
if (action.url === lastAction.url) {
|
||||||
|
this._currentAction = undefined;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (const name of ['check', 'uncheck']) {
|
for (const name of ['check', 'uncheck']) {
|
||||||
if (lastAction && action.name === name && lastAction.name === 'click') {
|
if (lastAction && action.name === name && lastAction.name === 'click') {
|
||||||
|
|
|
||||||
|
|
@ -638,4 +638,22 @@ describe('cli codegen', (test, { browserName, headful }) => {
|
||||||
url: '${otherFrame.url()}'
|
url: '${otherFrame.url()}'
|
||||||
}).click('text="Hi, I\\'m frame"');`);
|
}).click('text="Hi, I\\'m frame"');`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should record navigations after identical pushState', async ({ page, recorder, httpServer }) => {
|
||||||
|
httpServer.setHandler((req: http.IncomingMessage, res: http.ServerResponse) => {
|
||||||
|
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
||||||
|
res.end('Hello world');
|
||||||
|
});
|
||||||
|
await recorder.setContentAndWait(`
|
||||||
|
<script>
|
||||||
|
function pushState() {
|
||||||
|
history.pushState({}, 'title', '${httpServer.PREFIX}');
|
||||||
|
}
|
||||||
|
</script>`, httpServer.PREFIX);
|
||||||
|
for (let i = 1; i < 3; ++i)
|
||||||
|
await page.evaluate('pushState()');
|
||||||
|
|
||||||
|
await page.goto(httpServer.PREFIX + '/page2.html');
|
||||||
|
await recorder.waitForOutput(`await page.goto('${httpServer.PREFIX}/page2.html');`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue