Skip to content

Commit

Permalink
Merge branch 'main' into google-docs-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
demshy authored Jan 17, 2025
2 parents c7cebde + 47a2f70 commit ffe13fe
Show file tree
Hide file tree
Showing 27 changed files with 578 additions and 179 deletions.
62 changes: 12 additions & 50 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Node CI

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

Expand All @@ -28,73 +26,37 @@ jobs:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [18.x, 20.x]
fail-fast: true
if: ${{ needs.changes.outputs.cms == 'true' }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js {{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: 'npm'
- name: log versions
run: node --version && npm --version && yarn --version
- name: install dependecies
run: npm install
- name: install dependencies
run: npm ci
- name: run unit tests
run: npm run test:ci
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
- name: build demo site
run: npm run build:demo
- name: run e2e tests
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
run: npm run test:e2e:run-ci
env:
NODE_OPTIONS: --max-old-space-size=4096
- uses: actions/upload-artifact@master
with:
name: dev-test-website-${{ runner.os }}-${{ matrix.node-version }}
path: dev-test

e2e-with-cypress:
needs: [changes, build]
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]
fail-fast: false

if: ${{ needs.changes.outputs.cms == 'true' }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- uses: actions/download-artifact@master
with:
name: dev-test-website-${{ runner.os }}-18.x
path: dev-test
- name: npm install
run: |
node --version
npm --version
yarn --version
npm install
- name: e2e test
run: |
npm run test:e2e:run-ci
env:
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true || github.repository_owner != 'decaporg' }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
NODE_OPTIONS: --max-old-space-size=4096
MACHINE_COUNT: 2
MACHINE_INDEX: ${{ matrix.node-version }}
TZ: Europe/Amsterdam
- uses: actions/upload-artifact@v3
if: ${{ always() }}
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x' && failure()
with:
name: cypress-results-${{ matrix.node-version }}
name: cypress-results
path: |
cypress/screenshots
cypress/videos
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const svgo = {
function presets() {
return [
'@babel/preset-react',
'@babel/preset-env',
['@babel/preset-env', isESM ? { modules: false } : {}],
[
'@emotion/babel-preset-css-prop',
{
Expand Down
44 changes: 20 additions & 24 deletions cypress/e2e/editorial_workflow_spec_test_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,16 @@ describe('Test Backend Editorial Workflow', () => {
login();

inSidebar(() => cy.contains('a', 'Pages').click());
inSidebar(() => cy.contains('a', 'Directory'));
inSidebar(() => cy.contains('a', /^Directory$/));
inGrid(() => cy.contains('a', 'Root Page'));
inGrid(() => cy.contains('a', 'Directory'));

inSidebar(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', /^Directory$/).click());

inGrid(() => cy.contains('a', 'Sub Directory'));
inGrid(() => cy.contains('a', 'Another Sub Directory'));
inSidebar(() => cy.contains('a', /^Sub Directory$/));
inSidebar(() => cy.contains('a', 'Another Sub Directory'));

inSidebar(() => cy.contains('a', 'Sub Directory').click());
inGrid(() => cy.contains('a', 'Nested Directory'));
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
inSidebar(() => cy.contains('a', 'Nested Directory'));
cy.url().should(
'eq',
'http://localhost:8080/#/collections/pages/filter/directory/sub-directory',
Expand All @@ -233,21 +232,17 @@ describe('Test Backend Editorial Workflow', () => {
login();

inSidebar(() => cy.contains('a', 'Pages').click());
inSidebar(() => cy.contains('a', 'Directory').click());
inGrid(() => cy.contains('a', 'Another Sub Directory').click());

cy.url().should(
'eq',
'http://localhost:8080/#/collections/pages/entries/directory/another-sub-directory/index',
);
inSidebar(() => cy.contains('a', /^Directory$/).click());
inSidebar(() => cy.contains('a', 'Another Sub Directory').click());
inGrid(() => cy.contains('a', 'Another Sub Directory'));
});

it(`can create a new entry with custom path`, () => {
login();

inSidebar(() => cy.contains('a', 'Pages').click());
inSidebar(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', 'Sub Directory').click());
inSidebar(() => cy.contains('a', /^Directory$/).click());
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
cy.contains('a', 'New Page').click();

cy.get('[id^="path-field"]').should('have.value', 'directory/sub-directory');
Expand All @@ -262,18 +257,18 @@ describe('Test Backend Editorial Workflow', () => {
publishEntryInEditor(publishTypes.publishNow);
exitEditor();

inGrid(() => cy.contains('a', 'New Path Title'));
inSidebar(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', 'New Path Title'));
inSidebar(() => cy.contains('a', /^Directory$/).click());
inSidebar(() => cy.contains('a', /^Directory$/).click());
inGrid(() => cy.contains('a', 'New Path Title').should('not.exist'));
});

it(`can't create an entry with an existing path`, () => {
login();

inSidebar(() => cy.contains('a', 'Pages').click());
inSidebar(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', 'Sub Directory').click());
inSidebar(() => cy.contains('a', /^Directory$/).click());
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());

cy.contains('a', 'New Page').click();
cy.get('[id^="title-field"]').type('New Path Title');
Expand All @@ -292,7 +287,8 @@ describe('Test Backend Editorial Workflow', () => {
login();

inSidebar(() => cy.contains('a', 'Pages').click());
inGrid(() => cy.contains('a', 'Directory').click());
inSidebar(() => cy.contains('a', /^Directory$/).click());
inGrid(() => cy.contains('a', /^Directory$/).click());

cy.get('[id^="path-field"]').should('have.value', 'directory');
cy.get('[id^="path-field"]').clear();
Expand All @@ -310,7 +306,7 @@ describe('Test Backend Editorial Workflow', () => {

inSidebar(() => cy.contains('a', 'New Directory').click());

inGrid(() => cy.contains('a', 'Sub Directory'));
inGrid(() => cy.contains('a', 'Another Sub Directory'));
inSidebar(() => cy.contains('a', /^Sub Directory$/));
inSidebar(() => cy.contains('a', 'Another Sub Directory'));
});
});
42 changes: 21 additions & 21 deletions cypress/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@ import execa from 'execa';
import { globby } from 'globby';

async function runCypress() {
const args = ['run', '--browser', 'chrome', '--headless'];

const specs = await globby(['cypress/e2e/*spec*.js']);
if (specs.length === 0) {
console.log('No test files found in cypress/e2e/*spec*.js');
process.exit(1);
}

if (process.env.IS_FORK === 'true') {
const machineIndex = parseInt(process.env.MACHINE_INDEX);
const machineCount = parseInt(process.env.MACHINE_COUNT);
const specs = await globby(['cypress/integration/*spec*.js']);
const specsPerMachine = Math.floor(specs.length / machineCount);
const start = (machineIndex - 1) * specsPerMachine;
const machineSpecs =
machineIndex === machineCount
? specs.slice(start)
: specs.slice(start, start + specsPerMachine);

await execa(
'cypress',
['run', '--browser', 'chrome', '--headless', '--spec', machineSpecs.join(',')],
{ stdio: 'inherit', preferLocal: true },
);
args.push('--spec', machineSpecs.join(','));
} else {
await execa(
'cypress',
[
'run',
'--browser',
'chrome',
'--headless',
'--record',
'--parallel',
'--ci-build-id',
process.env.GITHUB_SHA,
'--group',
'GitHub CI',
],
{ stdio: 'inherit', preferLocal: true },
args.push(
'--record',
'--parallel',
'--ci-build-id',
process.env.GITHUB_SHA,
'--group',
'GitHub CI',
'--spec',
specs.join(','),
);
}

console.log('Running Cypress with args:', args.join(' '));
await execa('cypress', args, { stdio: 'inherit', preferLocal: true });
}

runCypress();
6 changes: 6 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ addMatchImageSnapshotCommand({
Cypress.on('uncaught:exception', () => false);

import './commands';

afterEach(function () {
if (this.currentTest.state === 'failed') {
Cypress.runner.stop();
}
});
6 changes: 4 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"targetDefaults": {
"build:esm": {
"cache": true
"cache": true,
"dependsOn": ["^build:esm"]
},
"build": {
"cache": true
"cache": true,
"dependsOn": ["^build"]
}
},
"namedInputs": {
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build-preview": "npm run build && nx run decap-cms:build-preview --output-style=stream",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"clean": "rimraf \"packages/*/dist\" dev-test/dist \"packages/*/node_modules\"",
"clean": "rimraf \"packages/*/dist\" dev-test/dist \"packages/*/node_modules\" \".nx/cache\"",
"reset": "npm run clean",
"test": "npm run lint && npm run type-check && npm run test:unit",
"test:all": "npm run test && npm run test:e2e",
Expand Down
6 changes: 6 additions & 0 deletions packages/decap-cms-app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.5.0](https://github.com/decaporg/decap-cms/compare/decap-cms-app@3.4.0...decap-cms-app@3.5.0) (2025-01-15)

### Bug Fixes

- **build:** Fix ESM output ([#7357](https://github.com/decaporg/decap-cms/issues/7357)) ([#7358](https://github.com/decaporg/decap-cms/issues/7358)) ([6cd7cb3](https://github.com/decaporg/decap-cms/commit/6cd7cb3b41718e20b44acaae1e2ffd73129520c2))

# [3.4.0](https://github.com/decaporg/decap-cms/compare/decap-cms-app@3.3.3...decap-cms-app@3.4.0) (2024-11-12)

**Note:** Version bump only for package decap-cms-app
Expand Down
Loading

0 comments on commit ffe13fe

Please sign in to comment.