test: fix recorder downloads test (#5454)

This commit is contained in:
Pavel Feldman 2021-02-12 20:26:22 -08:00 committed by GitHub
parent 3c877374c7
commit 0782b25272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -135,6 +135,11 @@ export class CodeGenerator {
return;
}
if (this._lastAction && !this._lastAction.committed) {
const signals = this._lastAction.action.signals;
if (signal.name === 'navigation' && signals.length && signals[signals.length - 1].name === 'download')
return;
if (signal.name === 'download' && signals.length && signals[signals.length - 1].name === 'navigation')
signals.length = signals.length - 1;
this._lastAction.action.signals.push(signal);
this._printAction(this._lastAction, true);
return;

View File

@ -110,9 +110,7 @@ describe('cli codegen', (suite, { mode, browserName, headful }) => {
await page.setInputFiles('input[type="file"]', []);`);
});
it('should download files', (test, {browserName, headful}) => {
test.fixme(browserName === 'webkit' || browserName === 'firefox', 'Generated page.waitForNavigation next to page.waitForEvent(download)');
}, async ({ page, recorder, httpServer }) => {
it('should download files', async ({ page, recorder, httpServer }) => {
httpServer.setHandler((req: http.IncomingMessage, res: http.ServerResponse) => {
const pathName = url.parse(req.url!).path;
if (pathName === '/download') {