Skip to content

Commit

Permalink
test: fix recorder downloads test (#5454)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Feb 13, 2021
1 parent 3c87737 commit 0782b25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/server/supplements/recorder/codeGenerator.ts
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions test/cli/cli-codegen-2.spec.ts
Expand Up @@ -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') {
Expand Down

0 comments on commit 0782b25

Please sign in to comment.