Skip to content

Commit

Permalink
well that actually worked, let's clean it up
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-s-nava committed Oct 21, 2024
1 parent d720e0d commit bddb276
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
24 changes: 7 additions & 17 deletions frontend/tests/e2e/search/search-loading.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,22 @@ import {
} from "tests/e2e/search/searchSpecUtil";

test.describe("Search page tests", () => {
// test.beforeEach(async ({ page }: { page: Page }) => {
// // Navigate to the search page with the feature flag set
// await page.goto("/search?_ff=showSearchV0:true");
// });

test("should show and hide loading state", async () => {
const searchTerm = generateRandomString([4, 5]);
const searchTerm2 = generateRandomString([8]);

const browser = await chromium.launch({ slowMo: 100 });

const page = await browser.newPage();
await page.goto("/search?_ff=showSearchV0:true");
// if this doesn't work we can try https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-slow-mo
const searchTerm = generateRandomString([4, 5]);
const loadingIndicator = page.getByTestId("loading-message");
// await Promise.all([
// fillSearchInputAndSubmit(searchTerm, page),
// expect(loadingIndicator).toBeVisible(),
// ]);

await fillSearchInputAndSubmit(searchTerm, page);
await expect(loadingIndicator).toBeVisible();
await expect(loadingIndicator).toBeHidden();

// const searchTerm2 = generateRandomString([8]);
// await Promise.all([
// fillSearchInputAndSubmit(searchTerm2, page),
// expect(loadingIndicator).toBeVisible(),
// ]);
// await expect(loadingIndicator).toBeHidden();
await fillSearchInputAndSubmit(searchTerm2, page);
await expect(loadingIndicator).toBeVisible();
await expect(loadingIndicator).toBeHidden();
});
});
11 changes: 0 additions & 11 deletions frontend/tests/e2e/search/searchSpecUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ export const generateRandomString = (desiredPattern: number[]) => {
}, "");
};

// let result = "";
// const charactersLength = characters.length;
// let counter = 0;
// while (counter < length) {
// result += characters.charAt(Math.floor(Math.random() * charactersLength));
// counter += 1;
// }
// return result;
// };
// (Math.random() + 1).toString(36).substring(7);

export function expectURLContainsQueryParam(
page: Page,
queryParamName: string,
Expand Down

0 comments on commit bddb276

Please sign in to comment.