Skip to content

Commit b0a2dc3

Browse files
authored
Merge pull request #17298 from CDCgov/deployment/2025-02-06
Deployment of 2025-02-06
2 parents f42c280 + c00ff52 commit b0a2dc3

File tree

20 files changed

+937
-163
lines changed

20 files changed

+937
-163
lines changed

frontend-react/.storybook/main.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import type { StorybookConfig } from "@storybook/react-vite";
22
import remarkToc from "remark-mdx-toc";
33

44
const config: StorybookConfig = {
5-
stories: [
6-
"../src/**/*.stories.mdx",
7-
"../src/**/*.stories.@(js|jsx|ts|tsx)",
8-
],
5+
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
96
addons: [
10-
"storybook-addon-remix-react-router",
117
"@storybook/addon-links",
128
"@storybook/addon-essentials",
139
"@storybook/addon-interactions",
@@ -30,9 +26,7 @@ const config: StorybookConfig = {
3026
core: {},
3127
async viteFinal(config, { configType }) {
3228
// Exclude our mdx plugin from vite config in favor of storybook's
33-
config.plugins = config.plugins?.filter(
34-
(x: any, i) => x.name !== "@mdx-js/rollup",
35-
);
29+
config.plugins = config.plugins?.filter((x: any, i) => x.name !== "@mdx-js/rollup");
3630

3731
return {
3832
...config,

frontend-react/e2e/mocks/message-test.ts

Lines changed: 116 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import type { Locator } from "@playwright/test";
2+
import language from "../../../../src/components/Admin/MessageTesting/language.json" assert { type: "json" };
3+
import {
4+
errorMessageResult,
5+
passMessageResult,
6+
} from "../../../../src/components/Admin/MessageTesting/MessageTestingResult.fixtures";
7+
import { RSMessage } from "../../../../src/config/endpoints/reports";
8+
import { MOCK_GET_TEST_MESSAGES } from "../../../mocks/message-test";
9+
import { BasePage, BasePageTestArgs, type RouteHandlerFulfillEntry } from "../../BasePage";
10+
11+
/**
12+
* Uses org ignore's FULL_ELR receiver
13+
*/
14+
export class OrganizationReceiverMessageTestPage extends BasePage {
15+
static readonly API_REPORTS_TESTING = "/api/reports/testing";
16+
static readonly API_REPORTS_TEST = "/api/reports/testing/test?*";
17+
protected customI: number;
18+
testMessages: RSMessage[];
19+
20+
readonly expectedStatusSuccess = new RegExp(`^${language.successAlertHeading}`);
21+
readonly expectedStatusFailure = new RegExp(`^${language.errorAlertHeading}`);
22+
23+
readonly form: Locator;
24+
readonly addCustomMessageButton: Locator;
25+
readonly submitCustomMessageButton: Locator;
26+
readonly cancelCustomMessageButton: Locator;
27+
readonly customMessageTextArea: Locator;
28+
readonly submitButton: Locator;
29+
readonly submitStatus: Locator;
30+
readonly submitAlert: Locator;
31+
readonly submissionOutputMessageButton: Locator;
32+
readonly submissionOutputMessage: Locator;
33+
readonly submissionTestMessageButton: Locator;
34+
readonly submissionTestMessage: Locator;
35+
readonly submissionTransformErrorsButton: Locator;
36+
readonly submissionTransformErrors: Locator;
37+
38+
constructor(testArgs: BasePageTestArgs) {
39+
super(
40+
{
41+
url: "/admin/orgreceiversettings/org/ignore/receiver/FULL_ELR/action/edit/message-testing",
42+
title: "Message testing - ReportStream",
43+
heading: testArgs.page.getByRole("heading", {
44+
name: "Message testing",
45+
}),
46+
},
47+
testArgs,
48+
);
49+
50+
this.testMessages = [];
51+
this.customI = 0;
52+
this.form = this.page.getByRole("form");
53+
this.addCustomMessageButton = this.form.getByRole("button", { name: "Test custom message" });
54+
this.submitCustomMessageButton = this.form.getByRole("button", { name: "Add" });
55+
this.cancelCustomMessageButton = this.form.getByRole("button", { name: "Cancel" });
56+
this.customMessageTextArea = this.form.getByRole("textbox", { name: "Custom message text" });
57+
this.submitButton = this.form.getByRole("button", { name: "Run test" });
58+
this.submitStatus = this.page.getByRole("status");
59+
this.submitAlert = this.page.getByRole("alert");
60+
this.submissionOutputMessageButton = this.page.getByRole("button", { name: "Output message" });
61+
this.submissionOutputMessage = this.page.getByLabel("Output message");
62+
this.submissionTestMessageButton = this.page.getByRole("button", { name: "Test message" });
63+
this.submissionTestMessage = this.page.getByLabel("Test message");
64+
this.submissionTransformErrorsButton = this.page.getByRole("button", { name: "Transform errors" });
65+
this.submissionTransformErrors = this.page.getByLabel("Transform errors");
66+
this.addMockRouteHandlers([this.createMockTestMessagesHandler()]);
67+
this.addResponseHandlers([
68+
[
69+
OrganizationReceiverMessageTestPage.API_REPORTS_TESTING,
70+
async (res) => (this.testMessages = await res.json()),
71+
],
72+
]);
73+
}
74+
75+
get isPageLoadExpected() {
76+
return super.isPageLoadExpected && this.isAdminSession;
77+
}
78+
79+
createMockTestMessagesHandler(): RouteHandlerFulfillEntry {
80+
return [
81+
OrganizationReceiverMessageTestPage.API_REPORTS_TESTING,
82+
() => {
83+
return {
84+
json: MOCK_GET_TEST_MESSAGES,
85+
};
86+
},
87+
];
88+
}
89+
90+
createMockTestSubmissionHandler(isFailed = false): RouteHandlerFulfillEntry {
91+
const result = isFailed ? errorMessageResult : passMessageResult;
92+
return [
93+
OrganizationReceiverMessageTestPage.API_REPORTS_TEST,
94+
() => {
95+
return {
96+
json: result,
97+
};
98+
},
99+
];
100+
}
101+
102+
addMockTestSubmissionHandler(isFailed = false) {
103+
return this.addMockRouteHandlers([this.createMockTestSubmissionHandler(isFailed)]);
104+
}
105+
106+
async submit() {
107+
const p = this.route();
108+
const reqP = this.page.waitForRequest(OrganizationReceiverMessageTestPage.API_REPORTS_TEST);
109+
await this.submitButton.click();
110+
await p;
111+
return reqP;
112+
}
113+
114+
async addCustomMessage(message: string) {
115+
await this.addCustomMessageButton.click();
116+
await this.customMessageTextArea.fill(message);
117+
await this.submitCustomMessageButton.click();
118+
this.customI++;
119+
const fileName = `Custom message ${this.customI}`;
120+
return [this.form.getByLabel(fileName), this.form.getByText(fileName)];
121+
}
122+
}

frontend-react/e2e/pages/authenticated/admin/organization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class OrganizationPage extends BasePage {
2727
}
2828

2929
get isPageLoadExpected() {
30-
return super.isPageLoadExpected && this.testArgs.storageState === this.testArgs.adminLogin.path;
30+
return super.isPageLoadExpected && this.isAdminSession;
3131
}
3232

3333
createMockOrganizationHandler(): RouteHandlerFulfillEntry {

0 commit comments

Comments
 (0)