diff options
author | Eric Bailey <git@esb.lol> | 2025-03-05 18:31:55 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-05 16:31:55 -0800 |
commit | 3be87fbf3b9ab354cf8c439c6aeeb28ec2c2d764 (patch) | |
tree | a66e09248e9669b72c2c794ed347acdefbe1ac3c | |
parent | 9fde3957e76050a78c04509c84e5091f20975555 (diff) | |
download | voidsky-3be87fbf3b9ab354cf8c439c6aeeb28ec2c2d764.tar.zst |
Add report dialog e2e tests (#7913)
-rw-r--r-- | __e2e__/config.yml | 2 | ||||
-rw-r--r-- | __e2e__/flows/report-dialog/account.default.yml | 24 | ||||
-rw-r--r-- | __e2e__/flows/report-dialog/post:default.yml | 24 | ||||
-rw-r--r-- | __e2e__/flows/report-dialog/post:edit-reason.yml | 35 | ||||
-rw-r--r-- | __e2e__/flows/report-dialog/post:reason-other.yml | 30 | ||||
-rw-r--r-- | src/components/Dialog/types.ts | 5 | ||||
-rw-r--r-- | src/components/moderation/ReportDialog/index.tsx | 6 |
7 files changed, 124 insertions, 2 deletions
diff --git a/__e2e__/config.yml b/__e2e__/config.yml index b36b0ef60..7bdd8eb23 100644 --- a/__e2e__/config.yml +++ b/__e2e__/config.yml @@ -1,2 +1,2 @@ flows: - - "flows/*" \ No newline at end of file + - "flows/**" diff --git a/__e2e__/flows/report-dialog/account.default.yml b/__e2e__/flows/report-dialog/account.default.yml new file mode 100644 index 000000000..0d4225473 --- /dev/null +++ b/__e2e__/flows/report-dialog/account.default.yml @@ -0,0 +1,24 @@ +appId: xyz.blueskyweb.app +--- +- runScript: + file: ../../setupServer.js + env: + SERVER_PATH: ?users&follows&posts&feeds +- runFlow: + file: ../../setupApp.yml +- tapOn: + id: "e2eSignInAlice" + +- tapOn: "Carla's avatar" +- tapOn: + id: "profileHeaderDropdownBtn" +- tapOn: + id: "profileHeaderDropdownReportBtn" +- tapOn: + id: "report:option:com.atproto.moderation.defs#reasonSpam" +- assertVisible: + id: "report:labeler:mod-authority.test" +- tapOn: + id: "report:submit" +- assertNotVisible: + id: "report:dialog" diff --git a/__e2e__/flows/report-dialog/post:default.yml b/__e2e__/flows/report-dialog/post:default.yml new file mode 100644 index 000000000..955177b59 --- /dev/null +++ b/__e2e__/flows/report-dialog/post:default.yml @@ -0,0 +1,24 @@ +appId: xyz.blueskyweb.app +--- +- runScript: + file: ../../setupServer.js + env: + SERVER_PATH: ?users&follows&posts&feeds +- runFlow: + file: ../../setupApp.yml +- tapOn: + id: "e2eSignInAlice" + +- tapOn: + id: "postDropdownBtn" + index: 0 +- tapOn: + id: "postDropdownReportBtn" +- tapOn: + id: "report:option:com.atproto.moderation.defs#reasonSpam" +- assertVisible: + id: "report:labeler:mod-authority.test" +- tapOn: + id: "report:submit" +- assertNotVisible: + id: "report:dialog" diff --git a/__e2e__/flows/report-dialog/post:edit-reason.yml b/__e2e__/flows/report-dialog/post:edit-reason.yml new file mode 100644 index 000000000..3c612d4ba --- /dev/null +++ b/__e2e__/flows/report-dialog/post:edit-reason.yml @@ -0,0 +1,35 @@ +appId: xyz.blueskyweb.app +--- +- runScript: + file: ../../setupServer.js + env: + SERVER_PATH: ?users&follows&posts&feeds +- runFlow: + file: ../../setupApp.yml +- tapOn: + id: "e2eSignInAlice" + +- tapOn: + id: "postDropdownBtn" + index: 0 +- tapOn: + id: "postDropdownReportBtn" +- tapOn: + id: "report:option:com.atproto.moderation.defs#reasonOther" +- assertVisible: + id: "report:labeler:mod-authority.test" +# reason "other" defaults with details open +- assertVisible: + id: "report:details" +- tapOn: + id: "report:clearOption" +- assertNotVisible: + id: "report:details" +- tapOn: + id: "report:option:com.atproto.moderation.defs#reasonSpam" +- assertVisible: + id: "report:labeler:mod-authority.test" +- tapOn: + id: "report:submit" +- assertNotVisible: + id: "report:dialog" diff --git a/__e2e__/flows/report-dialog/post:reason-other.yml b/__e2e__/flows/report-dialog/post:reason-other.yml new file mode 100644 index 000000000..39c0e7084 --- /dev/null +++ b/__e2e__/flows/report-dialog/post:reason-other.yml @@ -0,0 +1,30 @@ +appId: xyz.blueskyweb.app +--- +- runScript: + file: ../../setupServer.js + env: + SERVER_PATH: ?users&follows&posts&feeds +- runFlow: + file: ../../setupApp.yml +- tapOn: + id: "e2eSignInAlice" + +- tapOn: + id: "postDropdownBtn" + index: 0 +- tapOn: + id: "postDropdownReportBtn" +- tapOn: + id: "report:option:com.atproto.moderation.defs#reasonOther" +- assertVisible: + id: "report:labeler:mod-authority.test" +# reason "other" defaults with details open +- assertVisible: + id: "report:details" +- tapOn: + id: "report:details" +- inputText: "This is a test report" +- tapOn: + id: "report:submit" +- assertNotVisible: + id: "report:dialog" diff --git a/src/components/Dialog/types.ts b/src/components/Dialog/types.ts index 32886f3ce..3ca64a321 100644 --- a/src/components/Dialog/types.ts +++ b/src/components/Dialog/types.ts @@ -68,7 +68,10 @@ export type DialogOuterProps = { testID?: string } -type DialogInnerPropsBase<T> = React.PropsWithChildren<ViewStyleProp> & T +type DialogInnerPropsBase<T> = React.PropsWithChildren<ViewStyleProp> & + T & { + testID?: string + } export type DialogInnerProps = | DialogInnerPropsBase<{ label?: undefined diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx index 291699380..c785e8c5e 100644 --- a/src/components/moderation/ReportDialog/index.tsx +++ b/src/components/moderation/ReportDialog/index.tsx @@ -186,6 +186,7 @@ function Inner(props: ReportDialogProps) { return ( <Dialog.ScrollableInner + testID="report:dialog" label={_(msg`Report dialog`)} ref={ref} style={[a.w_full, {maxWidth: 500}]}> @@ -231,6 +232,7 @@ function Inner(props: ReportDialogProps) { <OptionCard option={state.selectedOption} /> </View> <Button + testID="report:clearOption" label={_(msg`Change report reason`)} size="tiny" variant="solid" @@ -399,6 +401,7 @@ function Inner(props: ReportDialogProps) { {state.detailsOpen && ( <View> <Dialog.Input + testID="report:details" multiline value={state.details} onChangeText={details => { @@ -426,6 +429,7 @@ function Inner(props: ReportDialogProps) { )} </View> <Button + testID="report:submit" label={_(msg`Submit report`)} size="large" variant="solid" @@ -566,6 +570,7 @@ function OptionCard({ }, [onSelect, option]) return ( <Button + testID={`report:option:${option.reason}`} label={_(msg`Create report for ${option.title}`)} onPress={onPress} disabled={!onSelect}> @@ -629,6 +634,7 @@ function LabelerCard({ }) return ( <Button + testID={`report:labeler:${labeler.creator.handle}`} label={_(msg`Send report to ${title}`)} onPress={onPress} disabled={!onSelect}> |