From af38da912156709c3dc8d5b32ecdfb69dcfe32ab Mon Sep 17 00:00:00 2001 From: ankur22 Date: Wed, 11 Sep 2024 11:31:49 +0100 Subject: [PATCH] Add page.close This is to help mimic expected test structure. The page.close should help determine when the test ends and whether there are any anomalies. --- tests/tracing_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/tracing_test.go b/tests/tracing_test.go index 1dadd9bb8..ffde8b1f2 100644 --- a/tests/tracing_test.go +++ b/tests/tracing_test.go @@ -202,7 +202,7 @@ func TestNavigationSpanCreation(t *testing.T) { js: fmt.Sprintf(` page = await browser.newPage(); await page.goto('%s'); - browser.closeContext(); + page.close(); `, ts.URL), expected: []string{ "iteration", @@ -212,6 +212,7 @@ func TestNavigationSpanCreation(t *testing.T) { "navigation", // created when a new page is created "page.goto", "navigation", // created when a navigation occurs after goto + "page.close", }, }, { @@ -220,7 +221,7 @@ func TestNavigationSpanCreation(t *testing.T) { page = await browser.newPage(); await page.goto('%s'); await page.reload(); - browser.closeContext(); + page.close(); `, ts.URL), expected: []string{ "iteration", @@ -232,6 +233,7 @@ func TestNavigationSpanCreation(t *testing.T) { "navigation", // created when a navigation occurs after goto "page.reload", "navigation", // created when a navigation occurs after reload + "page.close", }, }, { @@ -240,7 +242,7 @@ func TestNavigationSpanCreation(t *testing.T) { page = await browser.newPage(); await page.goto('%s'); await page.evaluate(() => window.history.back()); - browser.closeContext(); + page.close(); `, ts.URL), expected: []string{ "iteration", @@ -251,6 +253,7 @@ func TestNavigationSpanCreation(t *testing.T) { "page.goto", "navigation", // created when a navigation occurs after goto "navigation", // created when going back to the previous page + "page.close", }, }, { @@ -259,7 +262,7 @@ func TestNavigationSpanCreation(t *testing.T) { page = await browser.newPage(); await page.goto('%s'); await page.locator('a[id=\"top\"]').click(); - browser.closeContext(); + page.close(); `, ts.URL), expected: []string{ "iteration", @@ -271,6 +274,7 @@ func TestNavigationSpanCreation(t *testing.T) { "navigation", // created when a navigation occurs after goto "locator.click", "navigation", // created when navigating within the same page + "page.close", }, }, }