playwright-java icon indicating copy to clipboard operation
playwright-java copied to clipboard

[BUG] Trace viewer and logs do not show which waitForResponse url is failing

Open chaganiu opened this issue 3 years ago • 3 comments

Context:

  • Playwright Version: [what Playwright version do you use?] 1.18
  • Operating System: [e.g. Windows, Linux or Mac] Mac
  • Browser: [e.g. All, Chromium, Firefox, WebKit] Chromium
  • Extra: [any specific details about your environment]

Describe the bug

According to @mxschmitt the trace viewer should show which waitForResponse URL is failing. I originally filed the bug under the main playwright repo (https://github.com/microsoft/playwright/issues/12260) but this may be a java-specific bug. I am waiting on multiple api responses as described here: https://github.com/microsoft/playwright-java/issues/413#issuecomment-1046116101

chaganiu avatar Feb 22 '22 19:02 chaganiu

I was still able to repro it.

This is Node.js:

image

repro:

const { chromium } = require('playwright');

(async () => {
    const browser = await chromium.launch();
    // Create pages, interact with UI elements, assert values
    const page = await browser.newPage();
    await page.context().tracing.start({
        screenshots: true, snapshots: true, title: 'nodejs'
    })
    await page.goto("https://example.com");
    await Promise.all([
        page.waitForResponse("https://www.iana.org/domains/example"),
        page.click("text=More information")
    ]);
    await page.context().tracing.stop({ path: "trace2.zip" })
    await browser.close();
})();

And this is Java:

image

Repro for Java:

package org.example;

import com.microsoft.playwright.*;
import java.nio.file.Path;
import java.nio.file.Paths;

public class PrintTitle {
  public static void main(String[] args) {
    try (Playwright playwright = Playwright.create()) {
      Browser browser = playwright.chromium().launch();
      Page page = browser.newPage();
      page.context().tracing().start(new Tracing.StartOptions().setName("java")
      .setScreenshots(true).setSnapshots(true));
      page.navigate("https://example.com");
      Response response = page.waitForResponse("https://www.iana.org/domains/example", () -> {
        // Triggers the response
        page.click("text=More information");
      });
    Path traceFile = Paths.get("trace.zip");
    page.context().tracing().stop(new Tracing.StopOptions().setPath(traceFile));
    }
  }
}


mxschmitt avatar May 30 '22 16:05 mxschmitt

Hi @mxschmitt just wondering if this is is still slated for 1.23

chaganiu avatar Jun 25 '22 02:06 chaganiu

Still reproducible on 1.24 with Java

If step fail on waitForNavigation, no traces are created for this step.

@mxschmitt, @aslushnikov Guys you are doing a great job, but this one should be with priority. Issue is opened on 22th of February and still reproducible.

Last playwright releases have been very much for the JavaScript framework, hope you can add some new features and bug fixes also for the other language frameworks.

NikkTod avatar Jul 26 '22 17:07 NikkTod