Documentation
Tell us what plugin you are looking for and we'll let our community plugin developers know in case they are in search for inspiration!
diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/index.test.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/index.test.js
index 83c20eeeb9..9fdc37287a 100644
--- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/index.test.js
+++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/index.test.js
@@ -1,5 +1,13 @@
import React from 'react';
-import { render, waitFor, screen, getByRole, fireEvent } from '@testing-library/react';
+import {
+ render,
+ waitFor,
+ screen,
+ getByRole,
+ fireEvent,
+ queryByLabelText,
+ getByLabelText,
+} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from 'react-intl';
import { QueryClient, QueryClientProvider } from 'react-query';
@@ -173,4 +181,31 @@ describe('Marketplace page - layout', () => {
// Should not show install buttons
expect(screen.queryByText(/copy install command/i)).toEqual(null);
});
+
+ it('shows only downloads count and not github stars if there are no or 0 stars and no downloads available for any package', async () => {
+ client.clear();
+ render(App);
+
+ await waitForReload();
+
+ const providersTab = screen.getByRole('tab', { name: /providers/i });
+ userEvent.click(providersTab);
+
+ const nodeMailerCard = screen
+ .getAllByTestId('npm-package-card')
+ .find((div) => div.innerHTML.includes('Nodemailer'));
+
+ const githubStarsLabel = queryByLabelText(
+ nodeMailerCard,
+ /this provider was starred \d+ on GitHub/i
+ );
+
+ expect(githubStarsLabel).toBe(null);
+
+ const downloadsLabel = getByLabelText(
+ nodeMailerCard,
+ /this provider has \d+ weekly downloads/i
+ );
+ expect(downloadsLabel).toBeVisible();
+ });
});
diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/plugins.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/plugins.js
index 30b93fa76a..c7df37ee21 100644
--- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/plugins.js
+++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/plugins.js
@@ -39,6 +39,9 @@ const plugins = {
validated: false,
madeByStrapi: false,
strapiCompatibility: 'v3',
+ strapiVersion: '^4.0.0',
+ githubStars: 23,
+ npmDownloads: 5623,
},
},
{
@@ -212,6 +215,9 @@ const plugins = {
validated: false,
madeByStrapi: false,
strapiCompatibility: 'v4',
+ strapiVersion: '4.x.x',
+ githubStars: 323,
+ npmDownloads: 1123,
},
},
{
@@ -282,6 +288,7 @@ const plugins = {
validated: true,
madeByStrapi: false,
strapiCompatibility: 'v4',
+ strapiVersion: 'Contact developer',
},
},
{
@@ -352,6 +359,7 @@ const plugins = {
validated: false,
madeByStrapi: false,
strapiCompatibility: 'v4',
+ strapiVersion: '^3.4.2',
},
},
{
@@ -394,6 +402,9 @@ const plugins = {
validated: true,
madeByStrapi: true,
strapiCompatibility: 'v4',
+ strapiVersion: '^4.0.7',
+ githubStars: 49130,
+ npmDownloads: 7492,
},
},
{
@@ -436,6 +447,7 @@ const plugins = {
validated: true,
madeByStrapi: false,
strapiCompatibility: 'v3',
+ strapiVersion: '^4.3.0',
},
},
{
diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/providers.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/providers.js
index b2bea8b973..5f3de7ef4f 100644
--- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/providers.js
+++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/mocks/providers.js
@@ -126,6 +126,8 @@ const providers = {
validated: true,
madeByStrapi: true,
strapiCompatibility: 'v4',
+ githubStars: 49130,
+ npmDownloads: 7492,
},
},
{
@@ -168,6 +170,8 @@ const providers = {
developerName: 'Strapi team',
validated: true,
madeByStrapi: true,
+ githubStars: 30,
+ npmDownloads: 2492,
},
},
{
diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js
index 548ffa05d4..1940ec3b9d 100644
--- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js
+++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js
@@ -6,6 +6,7 @@ import {
screen,
getByText,
queryByText,
+ getByLabelText,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from 'react-intl';
@@ -403,4 +404,23 @@ describe('Marketplace page - plugins tab', () => {
userEvent.click(newestOption);
expect(history.location.search).toEqual('?sort=submissionDate:desc');
});
+
+ it('shows github stars and weekly downloads count for each plugin', () => {
+ const documentationCard = screen
+ .getAllByTestId('npm-package-card')
+ .find((div) => div.innerHTML.includes('Documentation'));
+
+ const githubStarsLabel = getByLabelText(
+ documentationCard,
+ /this plugin was starred \d+ on GitHub/i
+ );
+
+ expect(githubStarsLabel).toBeVisible();
+
+ const downloadsLabel = getByLabelText(
+ documentationCard,
+ /this plugin has \d+ weekly downloads/i
+ );
+ expect(downloadsLabel).toBeVisible();
+ });
});
diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/providers.test.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/providers.test.js
index 2e20f7af0a..9f893e6f82 100644
--- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/providers.test.js
+++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/providers.test.js
@@ -6,6 +6,7 @@ import {
screen,
getByText,
queryByText,
+ getByLabelText,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from 'react-intl';
@@ -298,4 +299,25 @@ describe('Marketplace page - providers tab', () => {
userEvent.click(newestOption);
expect(history.location.search).toEqual('?npmPackageType=provider&sort=submissionDate:desc');
});
+
+ it('shows github stars and weekly downloads count for each provider', () => {
+ const providersTab = screen.getByRole('tab', { name: /providers/i });
+ userEvent.click(providersTab);
+
+ const cloudinaryCard = screen
+ .getAllByTestId('npm-package-card')
+ .find((div) => div.innerHTML.includes('Cloudinary'));
+
+ const githubStarsLabel = getByLabelText(
+ cloudinaryCard,
+ /this provider was starred \d+ on GitHub/i
+ );
+ expect(githubStarsLabel).toBeVisible();
+
+ const downloadsLabel = getByLabelText(
+ cloudinaryCard,
+ /this provider has \d+ weekly downloads/i
+ );
+ expect(downloadsLabel).toBeVisible();
+ });
});
diff --git a/packages/core/admin/admin/src/translations/en.json b/packages/core/admin/admin/src/translations/en.json
index 4f9cdefa0d..49af4e18d8 100644
--- a/packages/core/admin/admin/src/translations/en.json
+++ b/packages/core/admin/admin/src/translations/en.json
@@ -272,7 +272,11 @@
"admin.pages.MarketPlacePage.plugin.tooltip.verified": "Plugin verified by Strapi",
"admin.pages.MarketPlacePage.plugin.version": "Update your Strapi version: \"{strapiAppVersion}\" to: \"{versionRange}\"",
"admin.pages.MarketPlacePage.plugin.version.null": "Unable to verify compatibility with your Strapi version: \"{strapiAppVersion}\"",
+ "admin.pages.MarketPlacePage.plugin.githubStars": "This plugin was starred {starsCount} on GitHub",
+ "admin.pages.MarketPlacePage.plugin.downloads": "This plugin has {downloadsCount} weekly downloads",
"admin.pages.MarketPlacePage.providers": "Providers",
+ "admin.pages.MarketPlacePage.provider.githubStars": "This provider was starred {starsCount} on GitHub",
+ "admin.pages.MarketPlacePage.provider.downloads": "This provider has {downloadsCount} weekly downloads",
"admin.pages.MarketPlacePage.search.clear": "Clear the search",
"admin.pages.MarketPlacePage.search.empty": "No result for \"{target}\"",
"admin.pages.MarketPlacePage.search.placeholder": "Search",