Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b48a74f
🌟 feat(WalletManagment.tsx): add support for displaying gross amount …
marcbon Sep 18, 2023
4dc278f
🔧 fix(BootyDetailsModal.tsx): add support for displaying amount_gross…
marcbon Sep 18, 2023
d244a20
🔧 chore(columns.ts): add sorting option for "Amount gross" column in …
marcbon Sep 18, 2023
6dbcaf1
🐛 fix(reducer.ts): initialize amount_gross property in the booty obje…
marcbon Sep 18, 2023
9b4cddf
🔀 refactor(types.d.ts): add "amount_gross" to orderBy options in Wall…
marcbon Sep 18, 2023
396f823
fixtures generator
iacopolea Sep 18, 2023
b9ce657
chore: install cypress
iacopolea Sep 18, 2023
94299c9
✨ feat(cypress.config.ts): add Cypress configuration file
marcbon Sep 18, 2023
4ff8e59
✨ feat(amount_gross.spec.cy.ts): add test for displaying amount and a…
marcbon Sep 18, 2023
c544757
📝 chore: add fixture files for user payments and booty examples
marcbon Sep 18, 2023
a422a3d
🐛 fix(payments): update payment fixtures to use nested 'amount' object
marcbon Sep 19, 2023
6baafc2
🐛 fix(reducer.ts): update wallet state structure to use separate net …
marcbon Sep 19, 2023
e732b5d
🔨 refactor(WalletTable.tsx): update column names and data index for a…
marcbon Sep 19, 2023
bae9af0
🔥 chore(cypress): remove unused test file amount_gross.spec.cy.ts
marcbon Sep 19, 2023
769f5ec
🐛 fix(usePerformance.tsx): change initial state of allBooty and pendi…
marcbon Sep 19, 2023
5ac36f3
🐛 fix(WalletManagment.tsx): fix references to booty.amount to booty.n…
marcbon Sep 19, 2023
001f199
🐛 fix(BootyDetailsModal.tsx): fix variable names for net and gross am…
marcbon Sep 19, 2023
347f401
🐛 fix(PaymentDetailsModal.tsx): fix property names in amount object
marcbon Sep 19, 2023
87618d3
🔀 refactor(Step2Recap.tsx): rename amount variable to net and add gro…
marcbon Sep 19, 2023
b2a48b9
chore(schema): update schema and api
marcbon Sep 19, 2023
f2ec265
🔥 refactor(e2e tests): remove unnecessary intercepts in wallet tests
marcbon Sep 19, 2023
230c5ee
feat(fixtures): generate-fixtures
marcbon Sep 19, 2023
b08a072
🔧 chore(package.json): add openapi-typescript dependency
marcbon Sep 19, 2023
7942593
chore(schema): update api and schema
marcbon Sep 19, 2023
a5b1a47
🔨 refactor(tryberApi/index.ts): reformat type definitions for consist…
marcbon Sep 19, 2023
6fac3f4
🔧 chore(package.json): update ESLint configuration for import/no-anon…
marcbon Sep 19, 2023
7654750
🐛 fix(usePerformance.tsx): fix type annotations for allBooty and pend…
marcbon Sep 19, 2023
5863aae
🔧 fix(tryberApi/index.ts): fix formatting of type definitions
marcbon Sep 19, 2023
4f93fea
🔧 chore(package.json): remove unnecessary ESLint rule configuration
marcbon Sep 19, 2023
3ee383b
🔀 refactor(schema.ts): update orderBy options in operations interface
marcbon Sep 19, 2023
3914003
🐛 fix(BootyDetailsModal.tsx): fix property access for amount.net and …
marcbon Sep 19, 2023
ea70e54
🔧 fix(table_net_gross.spec.cy.ts): add intercepts for API requests in…
marcbon Sep 20, 2023
46f7bef
🔧 fix(table_net_gross.spec.cy.ts): update fixture path for users/me/_…
marcbon Sep 20, 2023
41b4c6f
🔧 fix(table_net_gross.spec.cy.ts): fix typo in fixture path for singl…
marcbon Sep 20, 2023
1f1bd69
🔧 chore(table_net_gross.spec.cy.ts): refactor test to use separate fi…
marcbon Sep 20, 2023
f52cc70
🔧 chore(table_net_gross.spec.cy.ts): remove unnecessary empty lines
marcbon Sep 20, 2023
36d2166
test(net-gross): setup tests
iacopolea Sep 20, 2023
8d10825
wip(net-gross): net payment management
iacopolea Sep 21, 2023
e7fff1b
wip(net-gross): gross payment management
iacopolea Sep 21, 2023
fab96ae
feat(net-gross): net gross finish translation + ui
iacopolea Sep 21, 2023
361233b
fix(net-gross): wrong fixture
iacopolea Sep 21, 2023
ad8334f
🔧 fix(table_net_gross.spec.cy.ts): fix the number of columns in the w…
marcbon Sep 21, 2023
5c4a2f9
🎨 style(WalletTable.tsx): change action-details div to button element…
marcbon Sep 21, 2023
779710b
🔥 refactor(PaymentDetailsModal.tsx): remove net amount from PaymentDe…
marcbon Sep 21, 2023
71ba630
feature(net-gross): remove net from booty details
iacopolea Sep 22, 2023
0d389e1
feature(net-gross): add activity to booty details
iacopolea Sep 25, 2023
9c083ad
feature(net-gross): add sort by activity to booty details
iacopolea Sep 25, 2023
35c89ec
chore: translations
iacopolea Sep 25, 2023
003baa3
chore: translations
iacopolea Sep 25, 2023
50173f9
chore: translations
iacopolea Sep 26, 2023
7d8b4d0
Merge pull request #238 from AppQuality/fixtures
cannarocks Sep 27, 2023
4e7394b
feat: (performance-dashboard) added net nad gross as per design
iDome89 Oct 4, 2023
907ef03
feat: (performance-dashboard) added net nad gross as per design
iDome89 Oct 4, 2023
a91c304
Merge branch 'performance-dashboard-net-gross' of github.com:AppQuali…
iDome89 Oct 4, 2023
dd8e5ff
test(net-gross): dashboard stats
iacopolea Oct 4, 2023
bacee6e
fix: (performance-dashboard) fixed net-gross display
iDome89 Oct 4, 2023
e9661fb
fix(net-gross): show gross in dashboard 86bw2qmeb
iacopolea Oct 6, 2023
ea1531e
fix(net-gross): cy tests for 86bw2qmeb
iacopolea Oct 6, 2023
39a8c16
Merge pull request #239 from AppQuality/performance-dashboard-net-gross
iacopolea Oct 6, 2023
d181517
fix(net-gross): remove net from initial state
iacopolea Oct 9, 2023
0e3a8a2
Merge pull request #240 from AppQuality/payment-managment-card
iacopolea Oct 9, 2023
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
26 changes: 26 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from "cypress";

require("dotenv").config();

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
config.env = {
...process.env,
...config.env,
};
return config;
},
env: {
...process.env,
REACT_APP_API_URL: "https://dev.tryber.me/api",
},
baseUrl: "http://localhost:3000",
experimentalStudio: true,
video: false,
screenshotOnRunFailure: false,
testIsolation: true,
viewportHeight: 768,
viewportWidth: 1366,
},
});
118 changes: 118 additions & 0 deletions cypress/e2e/dashboard/booty_stats.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import getCurrencySymbol from "../../../src/utils/getCurrencySymbol";

describe("The dahsboard statistics card", () => {
beforeEach(() => {
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=name%2Csurname%2Cimage%2Conboarding_completed%2Cemail%2Cwp_user_id`,
{
statusCode: 200,
fixture: "users/me/_get/200_Example_1",
}
).as("userMeFields");
cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/rank`, {
statusCode: 200,
fixture: "users/me/rank/_get/200_stay-gold",
}).as("userMeRank");
cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/popups`, {
statusCode: 200,
fixture: "popups/_get/404_no_popups_found.json",
}).as("popups");
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=total_exp_pts%2Cbooty%2Cpending_booty%2Crank%2Cattended_cp%2Capproved_bugs`,
{
statusCode: 200,
fixture: "users/me/_get/200_dashboard_fields_net.json",
}
).as("popups");
cy.visit("/my-dashboard");
});
it("should display both net and gross values if API response has net value", () => {
cy.fixture("users/me/_get/200_dashboard_fields_net").then((response) => {
cy.dataQa("received-booty").within(() => {
cy.dataQa("net-booty").contains(
`${getCurrencySymbol(response.booty.net.currency)}${
response.booty.net.value
}`
);
cy.dataQa("gross-booty").contains(
`Gross ${getCurrencySymbol(response.booty.gross.currency)}${
response.booty.gross.value
}`
);
});
cy.dataQa("pending-booty").within(() => {
cy.dataQa("net-booty").contains(
`${getCurrencySymbol(response.pending_booty.net.currency)}${
response.pending_booty.net.value
}`
);
cy.dataQa("gross-booty").contains(
`Gross ${getCurrencySymbol(response.pending_booty.gross.currency)}${
response.pending_booty.gross.value
}`
);
});
});
});
});
describe("The dahsboard statistics card", () => {
beforeEach(() => {
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=name%2Csurname%2Cimage%2Conboarding_completed%2Cemail%2Cwp_user_id`,
{
statusCode: 200,
fixture: "users/me/_get/200_Example_1",
}
).as("userMeFields");
cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/rank`, {
statusCode: 200,
fixture: "users/me/rank/_get/200_stay-gold",
}).as("userMeRank");
cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/popups`, {
statusCode: 200,
fixture: "popups/_get/404_no_popups_found.json",
}).as("popups");
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=total_exp_pts%2Cbooty%2Cpending_booty%2Crank%2Cattended_cp%2Capproved_bugs`,
{
statusCode: 200,
fixture: "users/me/_get/200_dashboard_fields_gross_only.json",
}
).as("popups");
cy.visit("/my-dashboard");
});
it("should display only gross value if API response does not have net value", () => {
cy.fixture("users/me/_get/200_dashboard_fields_gross_only").then(
(response) => {
cy.dataQa("received-booty").within(() => {
cy.dataQa("gross-booty").contains(
`${getCurrencySymbol(response.booty.gross.currency)}${
response.booty.gross.value
}`
);
cy.dataQa("net-booty").should("not.exist");
});
cy.dataQa("pending-booty").within(() => {
cy.dataQa("gross-booty").contains(
`${getCurrencySymbol(response.pending_booty.gross.currency)}${
response.pending_booty.gross.value
}`
);
cy.dataQa("net-booty").should("not.exist");
});
}
);
});
});
230 changes: 230 additions & 0 deletions cypress/e2e/wallet/manage_payment_net_gross.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
import getCurrencySymbol from "../../../src/utils/getCurrencySymbol";

describe("If api response have net value", () => {
beforeEach(() => {
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=name%2Csurname%2Cimage%2Conboarding_completed%2Cemail%2Cwp_user_id`,
{
statusCode: 200,
fixture: "users/me/_get/200_Example_1",
}
).as("userMeFields");

cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/fiscal`, {
statusCode: 200,
fixture: "users/me/fiscal/_get/200_non_italian",
}).as("userMeFiscal");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=pending_booty%2Cbooty_threshold`,
{
statusCode: 200,
fixture: "/users/me/_get/200_booty_net",
}
).as("pendingBooty");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me/payments?order=DESC&orderBy=paidDate&limit=10&start=0`,
{
statusCode: 200,
fixture: "users/me/payments/_get/200_multiple-pages-all-paid.json",
}
).as("tablePayments");
cy.visit("/payments");
cy.wait("@pendingBooty");
});
it("payment request card should display both net and gross values", () => {
return cy.fixture("/users/me/_get/200_booty_net").then((user) => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("net-booty").should(
"contain",
`${user.pending_booty.net.value.toFixed(2)}${getCurrencySymbol(
user.pending_booty.net.currency
)}`
);
cy.dataQa("gross-booty").should(
"contain",
`${user.pending_booty.gross.value.toFixed(2)}${getCurrencySymbol(
user.pending_booty.gross.currency
)}`
);
});
});
});
it("payment request button should open a modal with both net and gross values", () => {
return cy.fixture("/users/me/_get/200_booty_net").then((user) => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("request-payment-cta").click();
});
cy.get(".modal").within(() => {
cy.get("#paymentMethod-pp").click();
cy.get("#termsAcceptance").click();
cy.dataQa("payment-modal-next").click();
cy.get("#ppAccountOwner").type("e@mail.com");
cy.get("#confirmEmail").type("e@mail.com");
cy.dataQa("payment-modal-next").click();
cy.dataQa("payment-modal-net-booty").should(
"have.text",
`${getCurrencySymbol(
user.pending_booty.net.currency
)}${user.pending_booty.net.value.toFixed(2)}`
);
cy.dataQa("payment-modal-gross-booty").should(
"contain",
`${getCurrencySymbol(
user.pending_booty.gross.currency
)}${user.pending_booty.gross.value.toFixed(2)}`
);
});
});
});
});

describe("If api response does not have net value", () => {
beforeEach(() => {
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=name%2Csurname%2Cimage%2Conboarding_completed%2Cemail%2Cwp_user_id`,
{
statusCode: 200,
fixture: "users/me/_get/200_Example_1",
}
).as("userMeFields");

cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/fiscal`, {
statusCode: 200,
fixture: "users/me/fiscal/_get/200_non_italian",
}).as("userMeFiscal");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=pending_booty%2Cbooty_threshold`,
{
statusCode: 200,
fixture: "/users/me/_get/200_booty_gross",
}
).as("pendingBooty");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me/payments?order=DESC&orderBy=paidDate&limit=10&start=0`,
{
statusCode: 200,
fixture: "users/me/payments/_get/200_multiple-pages-all-paid.json",
}
).as("tablePayments");
cy.visit("/payments");
cy.wait("@pendingBooty");
});
it("payment request card should display only gross values", () => {
return cy.fixture("/users/me/_get/200_booty_gross").then((user) => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("net-booty").should("not.exist");
cy.dataQa("gross-booty").should(
"contain",
`${user.pending_booty.gross.value.toFixed(2)}${getCurrencySymbol(
user.pending_booty.gross.currency
)}`
);
});
});
});
it("payment request button should open a modal showing only gross value", () => {
return cy.fixture("/users/me/_get/200_booty_gross").then((user) => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("request-payment-cta").click();
});
cy.get(".modal").within(() => {
cy.get("#paymentMethod-pp").click();
cy.get("#termsAcceptance").click();
cy.dataQa("payment-modal-next").click();
cy.get("#ppAccountOwner").type("e@mail.com");
cy.get("#confirmEmail").type("e@mail.com");
cy.dataQa("payment-modal-next").click();
cy.dataQa("payment-modal-net-booty").should("not.exist");
cy.dataQa("payment-modal-gross-booty").should(
"contain",
`${getCurrencySymbol(
user.pending_booty.gross.currency
)}${user.pending_booty.gross.value.toFixed(2)}`
);
});
});
});
});
describe("Booty details table", () => {
beforeEach(() => {
cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=name%2Csurname%2Cimage%2Conboarding_completed%2Cemail%2Cwp_user_id`,
{
statusCode: 200,
fixture: "users/me/_get/200_Example_1",
}
).as("userMeFields");

cy.intercept("GET", `${Cypress.env("REACT_APP_API_URL")}/users/me/fiscal`, {
statusCode: 200,
fixture: "users/me/fiscal/_get/200_non_italian",
}).as("userMeFiscal");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me?fields=pending_booty%2Cbooty_threshold`,
{
statusCode: 200,
fixture: "/users/me/_get/200_booty_net",
}
).as("pendingBooty");

cy.intercept(
"GET",
`${Cypress.env(
"REACT_APP_API_URL"
)}/users/me/pending_booty?order=DESC&orderBy=attributionDate&limit=10&start=0`,
{
statusCode: 200,
fixture: "users/me/pending_booty/_get/200_multiple-attributions",
}
).as("bootyDetails");
cy.visit("/payments");
cy.wait("@pendingBooty");
});
it("should only show tot gross and not net amount", () => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("booty-details-cta").click();
});
cy.get(".modal").within(() => {
cy.get(".thead").should("contain", "Tot. gross");
cy.get(".thead").should("not.contain", "Net");
});
});
it("should show activity name and type", () => {
cy.dataQa("wallet-management").within(() => {
cy.dataQa("booty-details-cta").click();
});
cy.get(".modal").within(() => {
cy.get(".thead").contains(/^Activity$/);
cy.get(".thead").contains(/^Activity name$/);
});
});
});
Loading