@@ -138,11 +138,27 @@ describe("cron view", () => {
|
138 | 138 | container, |
139 | 139 | ); |
140 | 140 | |
141 | | -expect(container.textContent).toContain("Latest runs across all jobs."); |
142 | | -expect(container.textContent).toContain("Status"); |
143 | | -expect(container.textContent).toContain("All statuses"); |
144 | | -expect(container.textContent).toContain("Delivery"); |
145 | | -expect(container.textContent).toContain("All delivery"); |
| 141 | +const cards = Array.from(container.querySelectorAll(".card")); |
| 142 | +const runHistoryCard = cards.find( |
| 143 | +(card) => card.querySelector(".card-title")?.textContent?.trim() === "Run history", |
| 144 | +); |
| 145 | +expect(runHistoryCard).toBeInstanceOf(Element); |
| 146 | +if (!(runHistoryCard instanceof Element)) { |
| 147 | +throw new Error("Expected run history card"); |
| 148 | +} |
| 149 | +expect(runHistoryCard.querySelector(".card-sub")?.textContent?.trim()).toBe( |
| 150 | +"Latest runs across all jobs.", |
| 151 | +); |
| 152 | +const runFilterSummaries = Array.from( |
| 153 | +runHistoryCard.querySelectorAll(".cron-filter-dropdown"), |
| 154 | +).map((dropdown) => ({ |
| 155 | +label: dropdown.firstElementChild?.textContent?.trim(), |
| 156 | +summary: dropdown.querySelector(".cron-filter-dropdown__trigger span")?.textContent?.trim(), |
| 157 | +})); |
| 158 | +expect(runFilterSummaries).toEqual([ |
| 159 | +{ label: "Status", summary: "All statuses" }, |
| 160 | +{ label: "Delivery", summary: "All delivery" }, |
| 161 | +]); |
146 | 162 | expect(container.textContent).not.toContain("multi-select"); |
147 | 163 | |
148 | 164 | const statusOk = getElement( |
|