mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
♻️ Fix subscriptions inconsistencies
This commit is contained in:
committed by
Andrey Antukh
parent
2846b80cf7
commit
854f286364
@@ -1,14 +0,0 @@
|
||||
[
|
||||
{
|
||||
"~:id": "~uf88e52d7-2b77-81fd-8006-23413fafe56c",
|
||||
"~:name": "The Alpaca team",
|
||||
"~:total-editors": 3,
|
||||
"~:total-members": 3
|
||||
},
|
||||
{
|
||||
"~:id": "~u81be1d05-a07b-81d5-8006-3e728bea76fb",
|
||||
"~:name": "The Quokka team",
|
||||
"~:total-editors": 1,
|
||||
"~:total-members": 1
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"~:editors": [
|
||||
{
|
||||
"~:id": "~u4f535993-36f9-8135-8006-9b18345c55cd",
|
||||
"~:name": "Luke Skywalker",
|
||||
"~:email": "luke@rebels.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"~:editors": [
|
||||
{
|
||||
"~:id": "~u4f535993-36f9-8135-8006-9b18345c55cd",
|
||||
"~:name": "Luke Skywalker",
|
||||
"~:email": "luke@rebels.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~u70a3b232-3722-8008-8006-86646ed3b6af",
|
||||
"~:name": "Leia Organa",
|
||||
"~:email": "leia@rebels.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~u81be1d05-a07b-81d5-8006-39095ea4121c",
|
||||
"~:name": "Han Solo",
|
||||
"~:email": "han@falcon.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~u96ce2641-e3fd-803a-8006-5e516d034d57",
|
||||
"~:name": "Darth Vader",
|
||||
"~:email": "vader@empire.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~uc9aa6cb0-9fb5-80a2-8006-9c3a0783ddc7",
|
||||
"~:name": "Obi-Wan Kenobi",
|
||||
"~:email": "obiwan@jedi.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~uf88e52d7-2b77-81fd-8006-234039f9e8db",
|
||||
"~:name": "Yoda",
|
||||
"~:email": "yoda@jedi.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~uf88e52d7-2b77-81fd-8006-2341585b061d",
|
||||
"~:name": "Chewbacca",
|
||||
"~:email": "chewie@falcon.com"
|
||||
},
|
||||
{
|
||||
"~:id": "~ufa35a73f-fa4f-81f9-8006-a558c4d406b1",
|
||||
"~:name": "R2-D2",
|
||||
"~:email": "r2d2@astromech.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"~:is-admin": false,
|
||||
"~:email": "foo@example.com",
|
||||
"~:team-id": "~udd33ff88-f4e5-8033-8003-8096cc07bdf3",
|
||||
"~:name": "Princesa Leia",
|
||||
"~:fullname": "Princesa Leia",
|
||||
"~:is-owner": false,
|
||||
"~:modified-at": "~m1713533116365",
|
||||
"~:can-edit": true,
|
||||
"~:is-active": true,
|
||||
"~:id": "~u123456789-0000-0000-0000-abcdefabcdef",
|
||||
"~:profile-id": "~u123456789-0000-0000-0000-abcdefabcdef",
|
||||
"~:created-at": "~m1713533116365"
|
||||
}
|
||||
]
|
||||
@@ -39,10 +39,11 @@
|
||||
"~:is-admin": true,
|
||||
"~:can-edit": true
|
||||
},
|
||||
"~:unique-editors": 1,
|
||||
"~:subscription": {
|
||||
"~:type": "unlimited",
|
||||
"~:status": "trialing",
|
||||
"~:seats": 2
|
||||
"~:seats": 5
|
||||
},
|
||||
"~:name": "Second team",
|
||||
"~:modified-at": "~m1701164272671",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"fdata/shape-data-type"
|
||||
]
|
||||
},
|
||||
"~:unique-editors": 1,
|
||||
"~:permissions": {
|
||||
"~:type": "~:owner",
|
||||
"~:is-owner": true,
|
||||
@@ -42,7 +43,7 @@
|
||||
"~:subscription": {
|
||||
"~:type": "unlimited",
|
||||
"~:status": "trialing",
|
||||
"~:seats": 2
|
||||
"~:seats": 5
|
||||
},
|
||||
"~:name": "Second team",
|
||||
"~:modified-at": "~m1701164272671",
|
||||
|
||||
@@ -7,8 +7,8 @@ export class SubscriptionProfilePage extends DashboardPage {
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-owned-teams",
|
||||
"subscription/get-owned-teams.json",
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ test.describe("Subscriptions: dashboard", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -55,6 +61,12 @@ test.describe("Subscriptions: dashboard", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage-one-editor.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -89,6 +101,12 @@ test.describe("Subscriptions: dashboard", () => {
|
||||
"subscription/get-profile-unlimited-unpaid-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -123,6 +141,12 @@ test.describe("Subscriptions: dashboard", () => {
|
||||
"subscription/get-profile-enterprise-canceled-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -159,6 +183,12 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
"logged-in-user/get-profile-logged-in.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -206,6 +236,12 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -251,7 +287,7 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("Members tab has warning message when team has more members than subscriptions. Subscribe link is shown for owners.", async ({
|
||||
test("Members tab has warning message when user has more seats than editors.", async ({
|
||||
page,
|
||||
}) => {
|
||||
await DashboardPage.mockRPC(
|
||||
@@ -260,6 +296,12 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage-one-editor.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -283,97 +325,7 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-members?team-id=*",
|
||||
"subscription/get-team-members-subscription-owner.json",
|
||||
);
|
||||
|
||||
await dashboardPage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
);
|
||||
|
||||
await dashboardPage.goToSecondTeamMembersSection();
|
||||
await expect(page.getByTestId("cta")).toBeVisible();
|
||||
await expect(page.getByText("Subscribe now.")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Members tab has warning message when team has more members than subscriptions. Contact to owner is shown for members.", async ({
|
||||
page,
|
||||
}) => {
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-profile",
|
||||
"logged-in-user/get-profile-logged-in.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
"subscription/get-team-info-subscriptions.json",
|
||||
);
|
||||
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
await dashboardPage.setupDashboardFull();
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
"subscription/get-teams-unlimited-subscription-member.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-projects?team-id=*",
|
||||
"dashboard/get-projects-second-team.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-members?team-id=*",
|
||||
"subscription/get-team-members-subscription-member.json",
|
||||
);
|
||||
|
||||
await dashboardPage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
);
|
||||
|
||||
await dashboardPage.goToSecondTeamMembersSection();
|
||||
await expect(page.getByTestId("cta")).toBeVisible();
|
||||
await expect(page.getByText("Contact with the team owner")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Members tab has warning message when has professional subscription and more than 8 members.", async ({
|
||||
page,
|
||||
}) => {
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-profile",
|
||||
"logged-in-user/get-profile-logged-in.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
"subscription/get-team-info-subscriptions.json",
|
||||
);
|
||||
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
await dashboardPage.setupDashboardFull();
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
"subscription/get-teams-professional-subscription-owner.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-projects?team-id=*",
|
||||
"dashboard/get-projects-second-team.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-members?team-id=*",
|
||||
"subscription/get-team-members-more-than-8.json",
|
||||
"subscription/get-team-members-subscription-one-member.json",
|
||||
);
|
||||
|
||||
await dashboardPage.mockRPC(
|
||||
@@ -384,13 +336,11 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
await dashboardPage.goToSecondTeamMembersSection();
|
||||
await expect(page.getByTestId("cta")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
"The Professional plan is designed for teams of up to 8 editors (owner, admin, and editor).",
|
||||
),
|
||||
page.getByText("Inviting people while on the unlimited plan"),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("Invitations tab has warning message when team has more members than subscriptions", async ({
|
||||
test("Invitations tab has warning message when user has more seats than editors.", async ({
|
||||
page,
|
||||
}) => {
|
||||
await DashboardPage.mockRPC(
|
||||
@@ -399,6 +349,12 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage-one-editor.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
@@ -422,13 +378,13 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-members?team-id=*",
|
||||
"subscription/get-team-members-subscription-owner.json",
|
||||
"subscription/get-team-members-subscription-one-member.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-invitations?team-id=*",
|
||||
"dashboard/get-team-invitations-empty.json",
|
||||
"subscription/get-team-invitations.json",
|
||||
);
|
||||
|
||||
await dashboardPage.mockRPC(
|
||||
@@ -439,64 +395,7 @@ test.describe("Subscriptions: team members and invitations", () => {
|
||||
await dashboardPage.goToSecondTeamInvitationsSection();
|
||||
await expect(page.getByTestId("cta")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
"Looks like your team has grown! Your plan includes 2 seats, but you're now using 3",
|
||||
),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("Invitations tab has warning message when has professional subscription and more than 8 members.", async ({
|
||||
page,
|
||||
}) => {
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-profile",
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-info",
|
||||
"subscription/get-team-info-subscriptions.json",
|
||||
);
|
||||
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
await dashboardPage.setupDashboardFull();
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
"subscription/get-teams-unlimited-subscription-owner.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-projects?team-id=*",
|
||||
"dashboard/get-projects-second-team.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-members?team-id=*",
|
||||
"subscription/get-team-members-more-than-8.json",
|
||||
);
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-team-invitations?team-id=*",
|
||||
"dashboard/get-team-invitations-empty.json",
|
||||
);
|
||||
|
||||
await dashboardPage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
);
|
||||
|
||||
await dashboardPage.goToSecondTeamInvitationsSection();
|
||||
await expect(page.getByTestId("cta")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
"Looks like your team has grown! Your plan includes 2 seats, but you're now using 9",
|
||||
),
|
||||
page.getByText("Inviting people while on the unlimited plan"),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,6 +22,12 @@ test.describe("Subscriptions: workspace", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await workspacePage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
@@ -44,6 +50,12 @@ test.describe("Subscriptions: workspace", () => {
|
||||
"subscription/get-profile-enterprise-subscription.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await workspacePage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
@@ -60,6 +72,18 @@ test.describe("Subscriptions: workspace", () => {
|
||||
const workspacePage = new WorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-profile",
|
||||
"subscription/get-profile-enterprise-subscription.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await workspacePage.mockRPC(
|
||||
"push-audit-events",
|
||||
"workspace/audit-event-empty.json",
|
||||
@@ -90,6 +114,12 @@ test.describe("Subscriptions: workspace", () => {
|
||||
"subscription/get-profile-unlimited-subscription.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
@@ -126,6 +156,12 @@ test.describe("Subscriptions: workspace", () => {
|
||||
"subscription/get-profile-enterprise-subscription.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-subscription-usage",
|
||||
"subscription/get-subscription-usage.json",
|
||||
);
|
||||
|
||||
await WorkspacePage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
|
||||
Reference in New Issue
Block a user