This commit is contained in:
biss committed 2025-08-25 20:24:23 +08:00
1 parent 30106e0129
commit 0ae8d7a709
1044 files changed
+321581

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
## Utilities for integration tests
Utils in this dir must be explicitly included in each spec file, e.g.:
```
import '../utils/dismiss-local-backup';
```
For routines to be executed on all tests, please use the `cypress/plugins.index.js` file instead: https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files
+42
View File
@@ -0,0 +1,42 @@
const fs = require('fs-extra');
const path = require('path');
const yaml = require('js-yaml');
const devTestDirectory = path.join(__dirname, '..', '..', 'dev-test');
const backendsDirectory = path.join(devTestDirectory, 'backends');
async function copyBackendFiles(backend) {
await Promise.all(
['config.yml', 'index.html'].map(file => {
return fs.copyFile(
path.join(backendsDirectory, backend, file),
path.join(devTestDirectory, file),
);
}),
);
}
async function updateConfig(configModifier) {
const configFile = path.join(devTestDirectory, 'config.yml');
const configContent = await fs.readFile(configFile);
const config = yaml.load(configContent);
await configModifier(config);
await fs.writeFileSync(configFile, yaml.dump(config));
}
async function switchVersion(version) {
const htmlFile = path.join(devTestDirectory, 'index.html');
const content = await fs.readFile(htmlFile);
const replaceString =
version === 'latest'
? '<script src="dist/decap-cms.js"></script>'
: `<script src="https://unpkg.com/decap-cms@${version}/dist/decap-cms.js"></script>`;
await fs.writeFile(
htmlFile,
content.toString().replace(/<script src=".+?decap-cms.+?"><\/script>/, replaceString),
);
}
module.exports = { copyBackendFiles, updateConfig, switchVersion };
+51
View File
@@ -0,0 +1,51 @@
const workflowStatus = { draft: 'Drafts', review: 'In Review', ready: 'Ready' };
const editorStatus = { draft: 'Draft', review: 'In review', ready: 'Ready' };
const setting1 = { limit: 10, author: 'John Doe' };
const setting2 = { name: 'Jane Doe', description: 'description' };
const publishTypes = { publishNow: 'Publish now', publishAndCreateNew: 'Publish and create new', publishAndDuplicate: 'Publish and duplicate' };
const colorError = 'rgb(255, 0, 59)';
const colorNormal = 'rgb(223, 223, 227)';
const textColorNormal = 'rgb(68, 74, 87)';
const notifications = {
saved: 'Entry saved',
published: 'Entry published',
unpublished: 'Entry unpublished',
updated: 'Entry status updated',
deletedUnpublished: 'Unpublished changes deleted',
error: {
missingField: "Oops, you've missed a required field. Please complete before saving.",
},
validation: {
range: {
fieldLabel: 'Number of posts on frontpage',
message: 'Number of posts on frontpage must be between 1 and 10.',
},
},
};
const HOT_KEY_MAP = {
'bold': 'mod+b',
'code': 'mod+shift+c',
'italic': 'mod+i',
'strikethrough': 'mod+shift+s',
'heading-one': 'mod+1',
'heading-two': 'mod+2',
'heading-three': 'mod+3',
'heading-four': 'mod+4',
'heading-five': 'mod+5',
'heading-six': 'mod+6',
'link': 'mod+k',
};
module.exports = {
workflowStatus,
editorStatus,
setting1,
setting2,
notifications,
publishTypes,
HOT_KEY_MAP,
colorError,
colorNormal,
textColorNormal,
};
Loaded 3 of 1044 files, more files were not shown because too many files have changed in this diff. Show more