Skip to content

Commit

Permalink
Add page.close
Browse files Browse the repository at this point in the history
This is to help mimic expected test structure. The page.close should
help determine when the test ends and whether there are any anomalies.
  • Loading branch information
ankur22 committed Sep 12, 2024
1 parent a40af8a commit 6ec9b95
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
},
},
{
Expand All @@ -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",
Expand All @@ -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",
},
},
{
Expand All @@ -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",
Expand All @@ -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",
},
},
{
Expand All @@ -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",
Expand All @@ -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",
},
},
}
Expand Down

0 comments on commit 6ec9b95

Please sign in to comment.