Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to MUI v5 for React 18 / 19 compat #113

Merged
merged 51 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cbfcc75
build: yarn add @mui/material @mui/styles ; yarn add @mui/lab ; yarn …
timheilman Mar 5, 2024
a9b0741
build: yarn add @emotion/react @emotion/styled
timheilman Mar 5, 2024
f3b5ead
build: npx @mui/codemod@latest v5.0.0/preset-safe src
timheilman Mar 5, 2024
cf6a8de
build: npx @mui/codemod@latest v5.0.0/link-underline-hover src
timheilman Mar 5, 2024
e1a5ae6
build: npx prettier --write src backend cypress scripts
timheilman Mar 5, 2024
f4854d4
build: yarn add @mui/material @mui/styles ; yarn add @mui/lab ; yarn …
timheilman Mar 5, 2024
20518ff
build: rm patches/@material-ui+core+4.12.4.patch
timheilman Mar 5, 2024
99379c1
build: update renovate.json to use @mui not @material-ui
timheilman Mar 5, 2024
fb556b8
build: update ThemeProvider import, per
timheilman Mar 5, 2024
619d199
build: update EventType for Tabs onChange event, per
timheilman Mar 5, 2024
a4972bb
fix: Two tabs problems:
timheilman Mar 5, 2024
51f4092
fix: transaction amount was falling off right edge
timheilman Mar 6, 2024
975c6d0
fix: indirection of onChange prop of Slider via ownerState
timheilman Mar 6, 2024
ce9ec97
fix: remove zIndex from AppBar to fix drawer issue
timheilman Mar 6, 2024
300930f
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/containers
timheilman Mar 6, 2024
d922bfe
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Ba…
timheilman Mar 6, 2024
85f0481
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Co…
timheilman Mar 6, 2024
4137f68
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Ma…
timheilman Mar 6, 2024
91d7793
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Na…
timheilman Mar 7, 2024
d9262eb
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Na…
timheilman Mar 7, 2024
ca957ff
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/No…
timheilman Mar 7, 2024
c2c051b
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/S…
timheilman Mar 7, 2024
7c43217
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/S…
timheilman Mar 7, 2024
b5ca05f
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Sk…
timheilman Mar 7, 2024
fef8773
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
08cf585
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
97009e2
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
6f0441a
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
c325b24
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
004ba3e
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
81981f6
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
eea3cb9
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
8f9d8b3
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
da55283
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
66f6009
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Tr…
timheilman Mar 7, 2024
b74d32c
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components/Us…
timheilman Mar 7, 2024
0121063
build: npx @mui/codemod@latest v5.0.0/jss-to-styled src/components
timheilman Mar 7, 2024
aacb126
build: yarn remove @mui/styles and some
timheilman Mar 7, 2024
82af097
chore: update RWA to make running locally easier (#1524)
AtofStryker Mar 11, 2024
8138617
fix: windows start:api:* scripts (#1530)
MikeMcC399 Mar 21, 2024
dc5dae5
bump cypress to 13.7.1 (#1532)
AtofStryker Mar 22, 2024
cf49cad
chore(deps): update dependency express to version 4.19.2 🌟 (#1535)
renovate[bot] Apr 1, 2024
9b2d572
chore(deps): update dependency cypress to version 13.7.2 🌟 (#1538)
renovate[bot] Apr 2, 2024
c24b856
chore(deps): update cypress to 13.7.3 🌟 (#1543)
renovate[bot] Apr 11, 2024
e059d98
build: remove @ts-expect-error annotations no longer used after yarn.…
timheilman May 16, 2024
d4bd582
test: issue 1278 re-enabling test that had failed on firefox,
timheilman May 16, 2024
a2b7f05
build: replace express-graphql with graphql-http and graphql-playgrou…
timheilman May 20, 2024
efc8876
fix: unset flex-direction which is newly set to row-reverse for
timheilman Jun 9, 2024
f2f03dc
fix: undo parent commit fix because avatars were backward and
timheilman Jun 10, 2024
72061cf
fix: get body font size back down to 14, establish knobs for
timheilman Jun 10, 2024
3bdceb9
Re-enable all tests to check results
markerikson Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions backend/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ type Query {
}

type Mutation {
createBankAccount(
bankName: String!,
accountNumber: String!,
routingNumber: String!
): BankAccount
deleteBankAccount(
id: ID!
): Boolean
createBankAccount(bankName: String!, accountNumber: String!, routingNumber: String!): BankAccount
deleteBankAccount(id: ID!): Boolean
}

type BankAccount {
Expand All @@ -23,4 +17,4 @@ type BankAccount {
isDeleted: Boolean
createdAt: String
modifiedAt: String
}
}
1 change: 1 addition & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Cypress.Commands.add("setTransactionAmountRange", (min, max) => {
.getBySelLike("filter-amount-range-slider")
.reactComponent()
.its("memoizedProps")
.its("ownerState")
.invoke("onChange", null, [min / 10, max / 10]);
});

Expand Down
10 changes: 4 additions & 6 deletions cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Components App</title>

</head>
<body>

<div data-cy-root></div>
</body>
</html>
110 changes: 52 additions & 58 deletions cypress/tests/ui/notifications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,65 +26,59 @@ describe("Notifications", function () {
});

describe("notifications from user interactions", function () {
it(
"User A likes a transaction of User B; User B gets notification that User A liked transaction ",
// NOTE: this test seems to have issues in Firefox UI/Mobile tests due to an issue with the Base Button component in MUI v4
// we should try unskipping this test in Firefox once we upgrade MUI to v5+. @see https://github.com/cypress-io/cypress-realworld-app/issues/1278
{ browser: { name: "!firefox" } },
function () {
cy.loginByXstate(ctx.userA.username);
cy.wait("@getNotifications");

cy.database("find", "transactions", { senderId: ctx.userB.id }).then(
(transaction: Transaction) => {
cy.visit(`/transaction/${transaction.id}`);
}
);

cy.log("🚩 Renders the notifications badge with count");
cy.wait("@getNotifications")
.its("response.body.results.length")
.then((notificationCount) => {
cy.getBySel("nav-top-notifications-count").should("have.text", `${notificationCount}`);
});
cy.visualSnapshot("Renders the notifications badge with count");

const likesCountSelector = "[data-test*=transaction-like-count]";
cy.contains(likesCountSelector, 0);
cy.getBySelLike("like-button").click();
// a successful "like" should disable the button and increment
// the number of likes
cy.getBySelLike("like-button").should("be.disabled");
cy.contains(likesCountSelector, 1);
cy.visualSnapshot("Like Count Incremented");

cy.switchUserByXstate(ctx.userB.username);
cy.visualSnapshot(`Switch to User ${ctx.userB.username}`);

cy.wait("@getNotifications")
.its("response.body.results.length")
.as("preDismissedNotificationCount");

cy.visit("/notifications");

cy.wait("@getNotifications");

cy.getBySelLike("notification-list-item")
.should("have.length", 9)
.first()
.should("contain", ctx.userA?.firstName)
.and("contain", "liked");

cy.log("🚩 Marks notification as read");
cy.getBySelLike("notification-mark-read").first().click({ force: true });
cy.wait("@updateNotification");

cy.get("@preDismissedNotificationCount").then((count) => {
cy.getBySelLike("notification-list-item").should("have.length.lessThan", Number(count));
it("User A likes a transaction of User B; User B gets notification that User A liked transaction ", function () {
cy.loginByXstate(ctx.userA.username);
cy.wait("@getNotifications");

cy.database("find", "transactions", { senderId: ctx.userB.id }).then(
(transaction: Transaction) => {
cy.visit(`/transaction/${transaction.id}`);
}
);

cy.log("🚩 Renders the notifications badge with count");
cy.wait("@getNotifications")
.its("response.body.results.length")
.then((notificationCount) => {
cy.getBySel("nav-top-notifications-count").should("have.text", `${notificationCount}`);
});
cy.visualSnapshot("Notification count after notification dismissed");
}
);
cy.visualSnapshot("Renders the notifications badge with count");

const likesCountSelector = "[data-test*=transaction-like-count]";
cy.contains(likesCountSelector, 0);
cy.getBySelLike("like-button").click();
// a successful "like" should disable the button and increment
// the number of likes
cy.getBySelLike("like-button").should("be.disabled");
cy.contains(likesCountSelector, 1);
cy.visualSnapshot("Like Count Incremented");

cy.switchUserByXstate(ctx.userB.username);
cy.visualSnapshot(`Switch to User ${ctx.userB.username}`);

cy.wait("@getNotifications")
.its("response.body.results.length")
.as("preDismissedNotificationCount");

cy.visit("/notifications");

cy.wait("@getNotifications");

cy.getBySelLike("notification-list-item")
.should("have.length", 9)
.first()
.should("contain", ctx.userA?.firstName)
.and("contain", "liked");

cy.log("🚩 Marks notification as read");
cy.getBySelLike("notification-mark-read").first().click({ force: true });
cy.wait("@updateNotification");

cy.get("@preDismissedNotificationCount").then((count) => {
cy.getBySelLike("notification-list-item").should("have.length.lessThan", Number(count));
});
cy.visualSnapshot("Notification count after notification dismissed");
});

it("User C likes a transaction between User A and User B; User A and User B get notifications that User C liked transaction", function () {
cy.loginByXstate(ctx.userC.username);
Expand Down
4 changes: 2 additions & 2 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"lib": ["es2015", "dom"],
"isolatedModules": false,
"allowJs": true,
"noEmit": true
}
"noEmit": true,
},
}
2 changes: 1 addition & 1 deletion data/database.json
Original file line number Diff line number Diff line change
Expand Up @@ -10985,4 +10985,4 @@
"modifiedAt": "2024-03-07T13:32:42.472Z"
}
]
}
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
"@babel/core": "7.23.9",
"@babel/plugin-syntax-flow": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.9",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@graphql-tools/graphql-file-loader": "7.5.17",
"@graphql-tools/load": "7.8.14",
"@material-ui/core": "4.12.4",
"@material-ui/icons": "4.11.3",
"@material-ui/lab": "4.0.0-alpha.61",
"@matheusluizn/react-google-login": "^5.1.6",
"@mui/icons-material": "^5.15.12",
"@mui/lab": "^5.0.0-alpha.167",
"@mui/material": "^5.15.12",
"@okta/jwt-verifier": "^3.0.1",
"@okta/okta-auth-js": "^7.3.0",
"@okta/okta-react": "^6.7.0",
Expand Down
103 changes: 0 additions & 103 deletions patches/@material-ui+core+4.12.4.patch

This file was deleted.

2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
{
"groupName": "Material UI",
"matchPackagePatterns": ["^@material-ui/"]
"matchPackagePatterns": ["^@mui/"]
},
{
"groupName": "Graphql",
Expand Down
4 changes: 2 additions & 2 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"exclude": [],
"compilerOptions": {
"types": ["node"],
"isolatedModules": false
}
"isolatedModules": false,
},
}
38 changes: 19 additions & 19 deletions src/__tests__/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ import {
import { User, Transaction } from "../../src/models";

describe("Comments", () => {
// beforeEach(() => {
// seedDatabase();
// });
// it("should comment a transaction for a contact", () => {
// const user: User = getAllUsers()[0];
// const transactions: Transaction[] = getTransactionsForUserContacts(user.id);
// const content = "This is my comment content";
// const comment = createComment(user.id, transactions[0].id, content);
// expect(comment.transactionId).toBe(transactions[0].id);
// expect(comment.content).toBe(content);
// });
// it("should get a list of comments for a transaction", () => {
// const user: User = getAllUsers()[0];
// const transactions: Transaction[] = getTransactionsByUserId(user.id);
// const transaction = transactions[0];
// createComment(user.id, transaction.id, "This is my comment");
// const comments = getCommentsByTransactionId(transaction.id);
// expect(comments[0].transactionId).toBe(transaction.id);
// });
beforeEach(() => {
seedDatabase();
});
it("should comment a transaction for a contact", () => {
const user: User = getAllUsers()[0];
const transactions: Transaction[] = getTransactionsForUserContacts(user.id);
const content = "This is my comment content";
const comment = createComment(user.id, transactions[0].id, content);
expect(comment.transactionId).toBe(transactions[0].id);
expect(comment.content).toBe(content);
});
it("should get a list of comments for a transaction", () => {
const user: User = getAllUsers()[0];
const transactions: Transaction[] = getTransactionsByUserId(user.id);
const transaction = transactions[0];
createComment(user.id, transaction.id, "This is my comment");
const comments = getCommentsByTransactionId(transaction.id);
expect(comments[0].transactionId).toBe(transaction.id);
});
});
Loading