-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
59 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Page, expect, test } from "@playwright/test"; | ||
import { | ||
expectURLContainsQueryParam, | ||
fillSearchInputAndSubmit, | ||
} from "./searchSpecUtil"; | ||
|
||
import { BrowserContextOptions } from "playwright-core"; | ||
|
||
interface PageProps { | ||
page: Page; | ||
browserName?: string; | ||
contextOptions?: BrowserContextOptions; | ||
} | ||
|
||
test.describe("Search page tests", () => { | ||
test.beforeEach(async ({ page }: PageProps) => { | ||
// Navigate to the search page with the feature flag set | ||
await page.goto("/search?_ff=showSearchV0:true"); | ||
}); | ||
|
||
test("should return 0 results when searching for obscure term", async ({ | ||
page, | ||
browserName, | ||
}: PageProps) => { | ||
// TODO (Issue #2005): fix test for webkit | ||
test.skip( | ||
browserName === "webkit", | ||
"Skipping test for WebKit due to a query param issue.", | ||
); | ||
|
||
const searchTerm = "0resultearch"; | ||
|
||
await fillSearchInputAndSubmit(searchTerm, page); | ||
await new Promise((resolve) => setTimeout(resolve, 3250)); | ||
expectURLContainsQueryParam(page, "query", searchTerm); | ||
|
||
// eslint-disable-next-line testing-library/prefer-screen-queries | ||
const resultsHeading = page.getByRole("heading", { | ||
name: /0 Opportunities/i, | ||
}); | ||
await expect(resultsHeading).toBeVisible(); | ||
|
||
await expect(page.locator("div.usa-prose h2")).toHaveText( | ||
"Your search did not return any results.", | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters