Skip to content

Commit

Permalink
Add results test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdaley committed Mar 25, 2024
1 parent b5c6b25 commit acf69ee
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions web/tests/acceptance/authenticated/results-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ProjectStatus,
projectStatusObjects,
} from "hermes/types/project-status";
import { TEST_USER_2_EMAIL, TEST_USER_EMAIL } from "hermes/mirage/utils";

// Global
const GLOBAL_SEARCH_INPUT = "[data-test-global-search-input]";
Expand Down Expand Up @@ -63,6 +64,10 @@ const PRODUCT_FACET_DROPDOWN_TOGGLE = `[${FACET_TOGGLE_DATA_NAME}="${FacetLabel.
// Filter dropdowns
const FACET_DROPDOWN_LINK = "[data-test-facet-dropdown-link]";

// Owner filter
const OWNERS_INPUT = `[data-test-search-owners-input]`;
const OWNER_MATCH = "[data-test-x-dropdown-list-item-link-to]";

// Pagination
const PAGINATION = "[data-test-pagination]";

Expand Down Expand Up @@ -374,6 +379,13 @@ module("Acceptance | authenticated/results", function (hooks) {
product: "Terraform",
});

// Create an RFC with another owner
this.server.create("document", {
docType: "RFC",
product: "Vault",
owners: [TEST_USER_2_EMAIL],
});

// Capture the docCounts we intend to test

const rfcCount = this.server.schema.document.where({
Expand Down Expand Up @@ -411,6 +423,21 @@ module("Acceptance | authenticated/results", function (hooks) {
.dom(ACTIVE_FILTER_LIST)
.doesNotExist("the active filters section is hidden");

// Filter by owner

await fillIn(OWNERS_INPUT, TEST_USER_EMAIL);
await click(OWNER_MATCH);

captureFacetElements();

assert.dom(RESULTS_MATCH_COUNT).containsText(`${totalDocCount - 1}`);

// Turn off owner filter

await click(ACTIVE_FILTER_LINK);

// Begin to filter by docType

await click(DOC_TYPE_FACET_DROPDOWN_TOGGLE);

captureFacetElements();
Expand Down

0 comments on commit acf69ee

Please sign in to comment.