Skip to content

Commit

Permalink
Merge pull request #8026 from coronasafe/develop
Browse files Browse the repository at this point in the history
Staging Release v24.25.0
  • Loading branch information
gigincg authored Jun 14, 2024
2 parents fc32629 + 160eaa7 commit ae027a1
Show file tree
Hide file tree
Showing 35 changed files with 586 additions and 452 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/auto-testing-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,37 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const isDraft = pr.draft;
const isReadyForTestingComment = context.payload.comment?.body.includes('ready for testing');
const isChangesRequired = context.payload.review?.state === 'changes_requested';
const comment = context.payload.comment;
const review = context.payload.review;
if ((isReadyForTestingComment && !isDraft) || (!isDraft && pr.draft_changed)) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['needs testing']
});
}
if (pr) {
const isDraft = pr.draft;
const isReadyForTestingComment = comment && comment.body.includes('ready for testing');
const isChangesRequired = review && review.state === 'changes_requested';
if ((isReadyForTestingComment && !isDraft) || (!isDraft && pr.draft_changed)) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['needs testing']
});
}
if (isChangesRequired) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: 'Reminder: To add the "needs testing" label, comment "ready for testing" on this PR.'
});
if (isChangesRequired) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: 'Reminder: To add the "needs testing" label, comment "ready for testing" on this PR.'
});
if (pr.labels.some(label => label.name === 'needs testing')) {
await github.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: 'needs testing'
});
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches:
- develop
- master
- staging
workflow_dispatch:

jobs:
Expand Down
10 changes: 2 additions & 8 deletions .storybook/vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
import { defineConfig } from "vite";

export default defineConfig({
esbuild: {
loader: "tsx",
include: [/src\/.*\.[tj]sx?$/, /.storybook\/.*\.[tj]sx?$/],
},
});
/** @type {import('vite').UserConfig} */
export default {};
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Authenticate to staging API with any of the following credentials
- Once the code review is done, the PR will be marked with a "Needs Testing" label where it'll be queued for QA testing.
- Once tested, the PR would be marked with a "Tested" label and would be queued for merge.

### Testing

To ensure the quality of our pull requests, we use a variety of tools:

- **Automated E2E Testing:** We use Cypress for end-to-end testing to automatically verify the functionality and performance of our code.
- **Manual Real Device Testing:** We use BrowserStack to manually test our code on real devices, ensuring compatibility and functionality across different platforms and browsers.

#### 🧪 Run cypress tests

To run cypress tests locally, you'll need to setup the backend to run locally and load dummy data required for cypress to the database. See [docs](https://github.com/coronasafe/care#self-hosting).
Expand Down Expand Up @@ -110,6 +117,7 @@ npm run cypress:open # To debug and run tests individually.
- [CARE Documentation](https://docs.coronasafe.network/coronasafe-care-documentation/)
- [Swagger API Documentation](https://careapi.ohc.network/swagger/)
- [Storybook component library](https://careui.coronasafe.in/)
- [Testing Documentation](https://docs.coronasafe.network/care-testing-documentation/)

## 🚀 Production

Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Facility Manage Functions", () => {
const loginPage = new LoginPage();
const facilityManage = new FacilityManage();
const facilityPage = new FacilityPage();
const facilityName = "Dummy Facility 40";
const facilityMiddlewareUpdateButton = "Update";
const facilityMiddleware = "dev-middleware.coronasafe.live";
const facilityUpdatedMiddleware = "updated.coronasafe.live";
Expand Down Expand Up @@ -35,6 +36,8 @@ describe("Facility Manage Functions", () => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
facilityPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
facilityPage.visitAlreadyCreatedFacility();
});

Expand Down
7 changes: 6 additions & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class FacilityPage {
.should("eq", 200);
}

typeFacilitySearch(facilityName) {
cy.get("#search").click().clear();
cy.get("#search").click().type(facilityName);
}

visitUpdateFacilityPage(url: string) {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.visit(url);
Expand Down Expand Up @@ -292,8 +297,8 @@ class FacilityPage {
}

selectLocation(location: string) {
cy.intercept("https://maps.googleapis.com/**").as("mapApi");
cy.get("span > svg.care-svg-icon__baseline.care-l-map-marker").click();
cy.intercept("https://maps.googleapis.com/maps/api/mapsjs/*").as("mapApi");
cy.wait("@mapApi").its("response.statusCode").should("eq", 200);
cy.get("input#pac-input").type(location).type("{enter}");
cy.wait(2000);
Expand Down
10 changes: 10 additions & 0 deletions src/Common/hooks/useMSEplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export const useMSEMediaPlayer = ({
if (!mseSourceBuffer.updating) {
if (mseQueue.length > 0) {
const packet = mseQueue.shift();
// Check if SourceBuffer has been removed before appending buffer
if (mseSourceBuffer.removed) {
console.error("Attempted to append to a removed SourceBuffer.");
return;
}
mseSourceBuffer.appendBuffer(packet);
} else {
mseStreamingStarted = false;
Expand All @@ -122,6 +127,11 @@ export const useMSEMediaPlayer = ({

const readPacket = (packet: any) => {
if (!mseStreamingStarted) {
// Check if SourceBuffer has been removed before appending buffer
if (mseSourceBuffer.removed) {
console.error("Attempted to append to a removed SourceBuffer.");
return;
}
mseSourceBuffer.appendBuffer(packet);
mseStreamingStarted = true;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/BloodPressureFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BloodPressure } from "../Patient/models";
type Props = FormFieldBaseProps<BloodPressure>;

export default function BloodPressureFormField(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

const handleChange = (event: FieldChangeEvent<number>) => {
const value: BloodPressure = {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/FilePreviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const FilePreviewDialog = (props: FilePreviewProps) => {
<img
src={fileUrl}
alt="file"
className={`${
className={`h-full w-full object-contain ${
zoom_values[file_state.zoom - 1]
} ${getRotationClass(file_state.rotation)}`}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type PMJAYPackageItem = {
type Props = FormFieldBaseProps<PMJAYPackageItem>;

export default function PMJAYProcedurePackageAutocomplete(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

const { fetchOptions, isLoading, options } =
useAsyncOptions<PMJAYPackageItem>("code");
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/RouteToFacilitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const keys = Object.keys(ROUTE_TO_FACILITY_OPTIONS).map((key) =>
type Props = FormFieldBaseProps<keyof typeof ROUTE_TO_FACILITY_OPTIONS>;

export default function RouteToFacilitySelect(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);

return (
<SelectFormField
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Common/UserAutocompleteFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = FormFieldBaseProps<UserModel> & {
};

export default function UserAutocompleteFormField(props: Props) {
const field = useFormFieldPropsResolver(props as any);
const field = useFormFieldPropsResolver(props);
const { fetchOptions, isLoading, options } = useAsyncOptions<UserModel>(
"id",
{ queryResponseExtractor: (data) => data.results },
Expand Down Expand Up @@ -65,6 +65,8 @@ export default function UserAutocompleteFormField(props: Props) {
<Autocomplete
id={field.id}
disabled={field.disabled}
// Voluntarily casting type as true to ignore type errors.
required={field.required as true}
placeholder={props.placeholder}
value={field.value}
onChange={field.handleChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,24 @@ let make = (
: <div>
<div className="grid grid-cols-1 items-center gap-4 justify-around mt-4">
<div className="flex flex-col items-center text-center">
<div className="text-black font-bold text-xl">
<div className="text-black font-bold text-xl flex items-center gap-2">
{str(Belt.Float.toString(painScale))}
<div
className={"text-sm font-bold text-white px-2 py-1 rounded-lg"}
style={ReactDOMStyle.make(
~backgroundColor=Js.String2.make(
switch getLabels(Belt.Float.toInt(painScale)) {
| (_, color) => color
},
),
(),
)}>
{str(
switch getLabels(Belt.Float.toInt(painScale)) {
| (label, _) => label
},
)}
</div>
</div>
<div className="text-sm text-gray-700"> {str("Pain Scale")} </div>
</div>
Expand All @@ -159,7 +175,7 @@ let make = (
? <button
type_="button"
onClick={e => {
if (painScale == 0.0) {
if painScale == 0.0 {
hideModal(e)
} else {
updatePart(state)
Expand Down
Loading

0 comments on commit ae027a1

Please sign in to comment.