0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added test examples to AdminX demo (#19116)

refs https://github.com/TryGhost/Product/issues/4182

Updated framework to include shared test config for easier app setup.
This commit is contained in:
Jono M 2023-11-23 12:59:48 +00:00 committed by GitHub
parent 17ec1e8937
commit a8083960d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 253 additions and 68 deletions

View file

@ -1 +1,3 @@
dist
playwright-report
test-results

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AdminX Standalone</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/standalone.tsx"></script>
</body>
</html>

View file

@ -12,7 +12,6 @@
"README.md",
"dist/"
],
"type": "module",
"main": "./dist/admin-x-demo.umd.cjs",
"module": "./dist/admin-x-demo.js",
"publishConfig": {
@ -23,11 +22,17 @@
"dev": "vite build --watch",
"dev:start": "vite",
"build": "tsc && vite build",
"lint": "yarn run lint:js",
"lint:js": "eslint --ext .js,.ts,.cjs,.tsx --cache src",
"lint": "yarn run lint:code && yarn run lint:test",
"lint:code": "eslint --ext .js,.ts,.cjs,.tsx --cache src",
"lint:test": "eslint -c test/.eslintrc.cjs --ext .js,.ts,.cjs,.tsx --cache test",
"test:unit": "yarn nx build && vitest run",
"test:acceptance": "NODE_OPTIONS='--experimental-specifier-resolution=node --no-warnings' VITE_TEST=true playwright test",
"test:acceptance:slowmo": "TIMEOUT=100000 PLAYWRIGHT_SLOWMO=100 yarn test:acceptance --headed",
"test:acceptance:full": "ALL_BROWSERS=1 yarn test:acceptance",
"preview": "vite preview"
},
"devDependencies": {
"@testing-library/react": "14.1.0",
"@tryghost/admin-x-design-system": "0.0.0",
"@tryghost/admin-x-framework": "0.0.0",
"@types/react": "18.2.38",
@ -40,13 +45,25 @@
"build": {
"dependsOn": [
"build",
{"projects": ["@tryghost/admin-x-design-system", "@tryghost/admin-x-framework"], "target": "build"}
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
]
},
"test:acceptance": {
"dependsOn": [
"test:acceptance",
{"projects": ["@tryghost/admin-x-design-system", "@tryghost/admin-x-framework"], "target": "build"}
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
]
}
}

View file

@ -0,0 +1,3 @@
import adminXPlaywrightConfig from '@tryghost/admin-x-framework/playwright';
export default adminXPlaywrightConfig();

View file

@ -0,0 +1,5 @@
import './styles/index.css';
import App from './App.tsx';
import renderStandaloneApp from '@tryghost/admin-x-framework/test/render';
renderStandaloneApp(App, {});

View file

@ -0,0 +1,6 @@
module.exports = {
plugins: ['ghost'],
extends: [
'plugin:ghost/ts-test'
]
};

View file

@ -0,0 +1,18 @@
import {expect, test} from '@playwright/test';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Demo', async () => {
test('Renders the list page', async ({page}) => {
await mockApi({page, requests: {
browseSettings: {
method: 'GET',
path: /^\/settings\/\?group=/,
response: responseFixtures.settings
}
}});
await page.goto('/');
await expect(page.locator('body')).toContainText('AdminX Demo App');
});
});

View file

@ -0,0 +1,10 @@
import ListPage from '../../src/ListPage';
import {render, screen} from '@testing-library/react';
describe('Demo', function () {
it('renders a component', async function () {
render(<ListPage />);
expect(screen.getAllByRole('heading')[0].textContent).toEqual('AdminX Demo App');
});
});

View file

@ -19,5 +19,5 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src", "test"]
}

View file

@ -35,18 +35,19 @@
"@storybook/react": "7.5.3",
"@storybook/react-vite": "7.5.3",
"@storybook/testing-library": "0.2.2",
"@testing-library/react": "14.1.0",
"@vitejs/plugin-react": "4.2.0",
"c8": "8.0.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"eslint-plugin-tailwindcss": "3.13.0",
"mocha": "10.2.0",
"rollup-plugin-node-builtins": "2.1.2",
"sinon": "17.0.0",
"ts-node": "10.9.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup-plugin-node-builtins": "2.1.2",
"sinon": "17.0.0",
"storybook": "7.5.3",
"ts-node": "10.9.1",
"typescript": "5.3.2",
"vite": "4.5.0",
"vite-plugin-svgr": "3.3.0"

View file

@ -130,13 +130,6 @@ export function toggleLabsFlag(flag: string, value: boolean) {
}
}
export const globalDataRequests = {
browseSettings: {method: 'GET', path: /^\/settings\/\?group=/, response: responseFixtures.settings},
browseConfig: {method: 'GET', path: '/config/', response: responseFixtures.config},
browseSite: {method: 'GET', path: '/site/', response: responseFixtures.site},
browseMe: {method: 'GET', path: '/users/me/?include=roles', response: responseFixtures.me}
};
export const settingsWithStripe = updatedSettingsResponse([
{key: 'stripe_connect_publishable_key', value: 'pk_test_123'},
{key: 'stripe_connect_secret_key', value: 'sk_test_123'},

View file

@ -0,0 +1,59 @@
import {DesignSystemAppProps} from '@tryghost/admin-x-design-system';
import React from 'react';
import ReactDOM from 'react-dom/client';
import {TopLevelFrameworkProps} from '../providers/FrameworkProvider';
export default function renderStandaloneApp<Props extends Record<string, never>>(
App: React.ComponentType<Props & {
framework: TopLevelFrameworkProps;
designSystem: DesignSystemAppProps;
}>,
props: Props
) {
const style = document.createElement('style');
style.appendChild(document.createTextNode(`
:root {
font-size: 62.5%;
line-height: 1.5;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
html, body, #root {
width: 100%;
height: 100%;
margin: 0;
letter-spacing: unset;
}
`));
document.head.appendChild(style);
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<App
designSystem={{darkMode: false, fetchKoenigLexical: async () => {}}}
framework={{
externalNavigate: () => {},
ghostVersion: '5.x',
sentryDSN: null,
unsplashConfig: {
Authorization: '',
'Accept-Version': '',
'Content-Type': '',
'App-Pragma': '',
'X-Unsplash-Cache': false
},
onDelete: () => {},
onInvalidate: () => {},
onUpdate: () => {}
}}
{...props}
/>
</React.StrictMode>
);
}

View file

@ -15,7 +15,6 @@ const queryClient = new QueryClient({
const wrapper: React.FC<{ children: ReactNode }> = ({children}) => (
<FrameworkProvider
basePath=''
externalNavigate={() => {}}
ghostVersion='5.x'
sentryDSN=''

View file

@ -48,6 +48,7 @@
},
"devDependencies": {
"@playwright/test": "1.38.1",
"@testing-library/react": "14.1.0",
"@tryghost/admin-x-design-system": "0.0.0",
"@tryghost/admin-x-framework": "0.0.0",
"@types/react": "18.2.38",
@ -68,13 +69,25 @@
"build": {
"dependsOn": [
"build",
{"projects": ["@tryghost/admin-x-design-system", "@tryghost/admin-x-framework"], "target": "build"}
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
]
},
"test:acceptance": {
"dependsOn": [
"test:acceptance",
{"projects": ["@tryghost/admin-x-design-system", "@tryghost/admin-x-framework"], "target": "build"}
{
"projects": [
"@tryghost/admin-x-design-system",
"@tryghost/admin-x-framework"
],
"target": "build"
}
]
}
}

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
// CodeMirror takes some time to load in Playwright meaning the first few characters typed don't always
// show up in the input. Since that lag is not consistent, this workaround ensures we type enough

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('History', async () => {
test('Browsing history', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('AMP integration', async () => {
test('Supports toggling and filling in AMP integration', async ({page}) => {

View file

@ -1,7 +1,8 @@
import {Integration, IntegrationsResponseType} from '@tryghost/admin-x-framework/api/integrations';
import {Webhook, WebhooksResponseType} from '@tryghost/admin-x-framework/api/webhooks';
import {chooseOptionInSelect, globalDataRequests, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../../utils/acceptance';
test.describe('Custom integrations', async () => {
test('Supports creating an integration and adding webhooks', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('First Promoter integration', async () => {
test('Supports toggling and filling in First Promoter integration', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Pintura integration', async () => {
test('Can toggle Pintura', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Slack integration', async () => {
test('Supports updating Slack settings', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Unsplash integration', async () => {
test('Supports toggling unsplash integration', async ({page}) => {

View file

@ -1,6 +1,7 @@
import {Integration, IntegrationsResponseType} from '@tryghost/admin-x-framework/api/integrations';
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Zapier integration settings', async () => {
test('Showing and regenerating API keys', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Labs', async () => {
test('Delete all content', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {chooseOptionInSelect, globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
test.describe('Default recipient settings', async () => {
test('Supports editing default recipients', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Mailgun settings', async () => {
test('Supports setting up mailgun', async ({page}) => {

View file

@ -1,6 +1,7 @@
import {NewslettersResponseType} from '@tryghost/admin-x-framework/api/newsletters';
import {chooseOptionInSelect, globalDataRequests, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
test.describe('Newsletter settings', async () => {
test('Supports creating a new newsletter', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Facebook settings', async () => {
test('Supports editing the facebook card', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Site password settings', async () => {
test('Supports locking and unlocking the site', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Metadata settings', async () => {
test('Supports editing metadata', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Publication language settings', async () => {
test('Supports editing the locale', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, testUrlValidation, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, testUrlValidation, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Social account settings', async () => {
test('Supports editing social URLs', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {chooseOptionInSelect, globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
test.describe('Time zone settings', async () => {
test('Supports editing the time zone', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Title and description settings', async () => {
test('Supports editing the title and description', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Twitter settings', async () => {
test('Supports editing the twitter card', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User actions', async () => {
test('Supports suspending a user', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User invitations', async () => {
test('Supports inviting a user', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User passwords', async () => {
test('Supports changing password', async ({page}) => {

View file

@ -1,6 +1,7 @@
import {StaffTokenResponseType} from '@tryghost/admin-x-framework/api/staffToken';
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, testUrlValidation} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures, testUrlValidation} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User profile', async () => {
test('Supports editing user profiles', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, meWithRole, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../../utils/acceptance';
import {meWithRole, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User roles', async () => {
test('Shows users under their role', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../utils/acceptance';
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Layout', async () => {
test('Confirms when leaving if a section is dirty', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {chooseOptionInSelect, globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
test.describe('Access settings', async () => {
test('Supports editing access', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Analytics settings', async () => {
test('Supports toggling analytics settings', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, settingsWithStripe, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures, settingsWithStripe, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Offers Modal', () => {
test.beforeEach(async () => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Portal Settings', async () => {
test('Loads Portal Preview Modal', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Recommendations', async () => {
test.beforeEach(async () => {

View file

@ -1,5 +1,5 @@
import {test} from '@playwright/test';
// import {globalDataRequests, mockApi, responseFixtures} from '../../utils/e2e';
// import {globalDataRequests} from '../../utils/acceptance';
test.describe('Signup Embed', async () => {
// TODO - currently having difficulty rendering the iframe in the test

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Stripe settings', async () => {
test('Supports the Stripe Connect flow', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures, settingsWithStripe} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures, settingsWithStripe} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Tier settings', async () => {
test('Supports creating a new tier', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, meWithRole, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../utils/acceptance';
import {meWithRole, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('User permissions', async () => {
test('Editors can only see users', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../utils/acceptance';
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Routing', async () => {
test('Reopens the opened modal when refreshing the page', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../utils/acceptance';
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Search', async () => {
test('Hiding and showing groups based on the search term', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {ElementHandle, expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Announcement Bar', async () => {
test('Working with the announcement bar preview', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {chooseOptionInSelect, globalDataRequests, mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {chooseOptionInSelect, mockApi, mockSitePreview, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
test.describe('Design settings', async () => {
test('Working with the preview', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Navigation settings', async () => {
test('Editing primary and secondary navigation', async ({page}) => {

View file

@ -1,5 +1,6 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests, limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
import {globalDataRequests} from '../../utils/acceptance';
import {limitRequests, mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Theme settings', async () => {
test('Browsing and installing default themes', async ({page}) => {

View file

@ -0,0 +1,8 @@
import {responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
export const globalDataRequests = {
browseSettings: {method: 'GET', path: /^\/settings\/\?group=/, response: responseFixtures.settings},
browseConfig: {method: 'GET', path: '/config/', response: responseFixtures.config},
browseSite: {method: 'GET', path: '/site/', response: responseFixtures.site},
browseMe: {method: 'GET', path: '/users/me/?include=roles', response: responseFixtures.me}
};

View file

@ -6,13 +6,10 @@
"repository": "https://github.com/TryGhost/Ghost",
"author": "Ghost Foundation",
"license": "MIT",
"workspaces": {
"packages": [
"ghost/*",
"apps/*"
],
"nohoist": ["**/@testing-library/react"]
},
"workspaces": [
"ghost/*",
"apps/*"
],
"monorepo": {
"public": false,
"internalPackages": true,