Skip to content

Commit c8b1c59

Browse files
committed
Merge branch 'main' into widget-richtext
2 parents 86fcc39 + ed7e993 commit c8b1c59

File tree

239 files changed

+18156
-15669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+18156
-15669
lines changed

.github/workflows/nodejs.yml

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Node CI
22

33
on:
44
push:
5-
branches:
6-
- main
75
pull_request:
86
types: [opened, synchronize, reopened]
97

@@ -27,74 +25,38 @@ jobs:
2725
strategy:
2826
matrix:
2927
os: [macos-latest, windows-latest, ubuntu-latest]
30-
node-version: [18.x, 20.x]
28+
node-version: [20.x, 22.x]
29+
fail-fast: true
3130
if: ${{ needs.changes.outputs.cms == 'true' }}
3231
steps:
3332
- uses: actions/checkout@v3
34-
- name: Use Node.js {{ matrix.node-version }}
33+
- name: Use Node.js ${{ matrix.node-version }}
3534
uses: actions/setup-node@v3
3635
with:
3736
node-version: ${{ matrix.node-version }}
3837
check-latest: true
38+
cache: 'npm'
3939
- name: log versions
4040
run: node --version && npm --version && yarn --version
41-
- name: install dependecies
42-
run: npm install
41+
- name: install dependencies
42+
run: npm ci
4343
- name: run unit tests
4444
run: npm run test:ci
45-
env:
46-
CI: true
47-
NODE_OPTIONS: --max-old-space-size=4096
4845
- name: build demo site
4946
run: npm run build:demo
47+
- name: run e2e tests
48+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'
49+
run: npm run test:e2e:run-ci
5050
env:
51-
NODE_OPTIONS: --max-old-space-size=4096
52-
- uses: actions/upload-artifact@master
53-
with:
54-
name: dev-test-website-${{ runner.os }}-${{ matrix.node-version }}
55-
path: dev-test
56-
57-
e2e-with-cypress:
58-
needs: [changes, build]
59-
runs-on: ubuntu-latest
60-
61-
strategy:
62-
matrix:
63-
node-version: [18.x, 20.x]
64-
fail-fast: false
65-
66-
if: ${{ needs.changes.outputs.cms == 'true' }}
67-
steps:
68-
- uses: actions/checkout@v3
69-
- name: Use Node.js
70-
uses: actions/setup-node@v3
71-
with:
72-
node-version: ${{ matrix.node-version }}
73-
check-latest: true
74-
- uses: actions/download-artifact@master
75-
with:
76-
name: dev-test-website-${{ runner.os }}-18.x
77-
path: dev-test
78-
- name: npm install
79-
run: |
80-
node --version
81-
npm --version
82-
yarn --version
83-
npm install
84-
- name: e2e test
85-
run: |
86-
npm run test:e2e:run-ci
87-
env:
88-
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
51+
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true || github.repository_owner != 'decaporg' }}
8952
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
9053
NODE_OPTIONS: --max-old-space-size=4096
91-
MACHINE_COUNT: 2
92-
MACHINE_INDEX: ${{ matrix.node-version }}
9354
TZ: Europe/Amsterdam
94-
- uses: actions/upload-artifact@v3
95-
if: ${{ always() }}
55+
- uses: actions/upload-artifact@v4
56+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' && failure()
9657
with:
97-
name: cypress-results-${{ matrix.node-version }}
58+
name: cypress-results
9859
path: |
9960
cypress/screenshots
10061
cypress/videos
62+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ coverage/
1919
.env
2020
.temp/
2121
storybook-static/
22-
.nx/cache
22+
.nx

babel.config.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,31 @@ const isESM = process.env.NODE_ENV === 'esm';
88

99
console.log('Build Package:', path.basename(process.cwd()));
1010

11-
const defaultPlugins = [
12-
'lodash',
11+
// Always enabled plugins
12+
const basePlugins = [
1313
[
1414
'babel-plugin-transform-builtin-extend',
1515
{
1616
globals: ['Error'],
1717
},
1818
],
19+
'babel-plugin-inline-json-import',
20+
];
21+
22+
// Legacy transforms for non-ESM builds
23+
// REVISIT: We probably don't need any of these since we use preset-env
24+
const legacyPlugins = [
1925
'transform-export-extensions',
2026
'@babel/plugin-proposal-class-properties',
2127
'@babel/plugin-proposal-object-rest-spread',
2228
'@babel/plugin-proposal-export-default-from',
2329
'@babel/plugin-proposal-nullish-coalescing-operator',
2430
'@babel/plugin-proposal-optional-chaining',
2531
'@babel/plugin-syntax-dynamic-import',
26-
'babel-plugin-inline-json-import',
2732
];
2833

34+
const defaultPlugins = [...basePlugins, ...(isESM ? [] : legacyPlugins)];
35+
2936
const svgo = {
3037
plugins: [
3138
{
@@ -42,14 +49,14 @@ const svgo = {
4249
function presets() {
4350
return [
4451
'@babel/preset-react',
45-
'@babel/preset-env',
52+
...(!isESM ? [['@babel/preset-env', {}]] : []),
4653
[
4754
'@emotion/babel-preset-css-prop',
4855
{
4956
autoLabel: 'always',
5057
},
5158
],
52-
'@babel/typescript',
59+
'@babel/preset-typescript',
5360
];
5461
}
5562

@@ -70,6 +77,12 @@ function plugins() {
7077
svgo,
7178
},
7279
],
80+
[
81+
'inline-import',
82+
{
83+
extensions: ['.css'],
84+
},
85+
],
7386
];
7487
}
7588

cypress/e2e/editorial_workflow_spec_test_backend.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,16 @@ describe('Test Backend Editorial Workflow', () => {
207207
login();
208208

209209
inSidebar(() => cy.contains('a', 'Pages').click());
210-
inSidebar(() => cy.contains('a', 'Directory'));
210+
inSidebar(() => cy.contains('a', /^Directory$/));
211211
inGrid(() => cy.contains('a', 'Root Page'));
212-
inGrid(() => cy.contains('a', 'Directory'));
213212

214-
inSidebar(() => cy.contains('a', 'Directory').click());
213+
inSidebar(() => cy.contains('a', /^Directory$/).click());
215214

216-
inGrid(() => cy.contains('a', 'Sub Directory'));
217-
inGrid(() => cy.contains('a', 'Another Sub Directory'));
215+
inSidebar(() => cy.contains('a', /^Sub Directory$/));
216+
inSidebar(() => cy.contains('a', 'Another Sub Directory'));
218217

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

235234
inSidebar(() => cy.contains('a', 'Pages').click());
236-
inSidebar(() => cy.contains('a', 'Directory').click());
237-
inGrid(() => cy.contains('a', 'Another Sub Directory').click());
238-
239-
cy.url().should(
240-
'eq',
241-
'http://localhost:8080/#/collections/pages/entries/directory/another-sub-directory/index',
242-
);
235+
inSidebar(() => cy.contains('a', /^Directory$/).click());
236+
inSidebar(() => cy.contains('a', 'Another Sub Directory').click());
237+
inGrid(() => cy.contains('a', 'Another Sub Directory'));
243238
});
244239

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

248243
inSidebar(() => cy.contains('a', 'Pages').click());
249-
inSidebar(() => cy.contains('a', 'Directory').click());
250-
inSidebar(() => cy.contains('a', 'Sub Directory').click());
244+
inSidebar(() => cy.contains('a', /^Directory$/).click());
245+
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
251246
cy.contains('a', 'New Page').click();
252247

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

265-
inGrid(() => cy.contains('a', 'New Path Title'));
266-
inSidebar(() => cy.contains('a', 'Directory').click());
267-
inSidebar(() => cy.contains('a', 'Directory').click());
260+
inSidebar(() => cy.contains('a', 'New Path Title'));
261+
inSidebar(() => cy.contains('a', /^Directory$/).click());
262+
inSidebar(() => cy.contains('a', /^Directory$/).click());
268263
inGrid(() => cy.contains('a', 'New Path Title').should('not.exist'));
269264
});
270265

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

274269
inSidebar(() => cy.contains('a', 'Pages').click());
275-
inSidebar(() => cy.contains('a', 'Directory').click());
276-
inSidebar(() => cy.contains('a', 'Sub Directory').click());
270+
inSidebar(() => cy.contains('a', /^Directory$/).click());
271+
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
277272

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

294289
inSidebar(() => cy.contains('a', 'Pages').click());
295-
inGrid(() => cy.contains('a', 'Directory').click());
290+
inSidebar(() => cy.contains('a', /^Directory$/).click());
291+
inGrid(() => cy.contains('a', /^Directory$/).click());
296292

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

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

313-
inGrid(() => cy.contains('a', 'Sub Directory'));
314-
inGrid(() => cy.contains('a', 'Another Sub Directory'));
309+
inSidebar(() => cy.contains('a', /^Sub Directory$/));
310+
inSidebar(() => cy.contains('a', 'Another Sub Directory'));
315311
});
316312
});

cypress/e2e/markdown_widget_code_block_spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ function codeBlock(content) {
7777
<div>
7878
<div></div>
7979
<div>
80-
<div><label>Code Block</label>
80+
<div>
81+
<div><label>Code Block</label></div>
8182
<div><button><span><svg>
8283
<path></path>
8384
</svg></span></button>

cypress/run.mjs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@ import execa from 'execa';
22
import { globby } from 'globby';
33

44
async function runCypress() {
5+
const args = ['run', '--browser', 'chrome', '--headless'];
6+
7+
const specs = await globby(['cypress/e2e/*spec*.js']);
8+
if (specs.length === 0) {
9+
console.log('No test files found in cypress/e2e/*spec*.js');
10+
process.exit(1);
11+
}
12+
513
if (process.env.IS_FORK === 'true') {
614
const machineIndex = parseInt(process.env.MACHINE_INDEX);
715
const machineCount = parseInt(process.env.MACHINE_COUNT);
8-
const specs = await globby(['cypress/integration/*spec*.js']);
916
const specsPerMachine = Math.floor(specs.length / machineCount);
1017
const start = (machineIndex - 1) * specsPerMachine;
1118
const machineSpecs =
1219
machineIndex === machineCount
1320
? specs.slice(start)
1421
: specs.slice(start, start + specsPerMachine);
1522

16-
await execa(
17-
'cypress',
18-
['run', '--browser', 'chrome', '--headless', '--spec', machineSpecs.join(',')],
19-
{ stdio: 'inherit', preferLocal: true },
20-
);
23+
args.push('--spec', machineSpecs.join(','));
2124
} else {
22-
await execa(
23-
'cypress',
24-
[
25-
'run',
26-
'--browser',
27-
'chrome',
28-
'--headless',
29-
'--record',
30-
'--parallel',
31-
'--ci-build-id',
32-
process.env.GITHUB_SHA,
33-
'--group',
34-
'GitHub CI',
35-
],
36-
{ stdio: 'inherit', preferLocal: true },
25+
args.push(
26+
'--record',
27+
'--parallel',
28+
'--ci-build-id',
29+
process.env.GITHUB_SHA,
30+
'--group',
31+
'GitHub CI',
32+
'--spec',
33+
specs.join(','),
3734
);
3835
}
36+
37+
console.log('Running Cypress with args:', args.join(' '));
38+
await execa('cypress', args, { stdio: 'inherit', preferLocal: true });
3939
}
4040

4141
runCypress();

cypress/support/e2e.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ addMatchImageSnapshotCommand({
2626
Cypress.on('uncaught:exception', () => false);
2727

2828
import './commands';
29+
30+
afterEach(function () {
31+
if (this.currentTest.state === 'failed') {
32+
Cypress.runner.stop();
33+
}
34+
});

0 commit comments

Comments
 (0)