diff --git a/.github/workflows/visual-tests-demos.yml b/.github/workflows/visual-tests-demos.yml
index ae92f60e3d60..4f4012f5eb34 100644
--- a/.github/workflows/visual-tests-demos.yml
+++ b/.github/workflows/visual-tests-demos.yml
@@ -773,6 +773,66 @@ jobs:
CI_ENV: true # The `ignore` field in the visualtestrc.json should be disabled when running test locally
run: pnpm exec nx test-testcafe
+ - name: Set Playwright artifact name
+ if: ${{ !cancelled() }}
+ run: echo "PLAYWRIGHT_JOB_NAME=$(echo "${{ matrix.CONSTEL }}-${{ matrix.THEME }}" | tr '/' '-')" >> $GITHUB_ENV
+
+ - name: Run Playwright tests
+ if: ${{ !cancelled() }}
+ timeout-minutes: 10
+ working-directory: apps/demos
+ env:
+ NODE_OPTIONS: --max-old-space-size=8192
+ CONCURRENCY: ${{ steps.set-concurrency.outputs.concurrency }}
+ CONSTEL: ${{ matrix.CONSTEL }}
+ THEME: ${{ matrix.THEME }}
+ # The default blob name is built from the test paths only, so jobs that differ by theme or
+ # shard alone would write the same zip and overwrite each other once merged.
+ PLAYWRIGHT_BLOB_OUTPUT_NAME: report-${{ env.PLAYWRIGHT_JOB_NAME }}.zip
+ run: pnpm run test-playwright
+
+ - name: Upload Playwright blob report
+ if: failure()
+ uses: actions/upload-artifact@v7
+ with:
+ name: playwright-blob-${{ env.PLAYWRIGHT_JOB_NAME }}
+ path: ${{ github.workspace }}/apps/demos/testing/artifacts/playwright/blob-report
+ if-no-files-found: ignore
+
+ - name: Upload Playwright traces and screenshot diffs
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: playwright-traces-${{ env.PLAYWRIGHT_JOB_NAME }}
+ path: ${{ github.workspace }}/apps/demos/testing/artifacts/playwright/test-results
+ if-no-files-found: ignore
+
+ - name: Collect new etalons
+ if: always()
+ run: |
+ mkdir -p "$RUNNER_TEMP/new-etalons"
+ git ls-files --others --exclude-standard -z -- 'apps/demos/testing/etalons/*.png' \
+ | xargs -0 -r cp --parents -t "$RUNNER_TEMP/new-etalons"
+
+ - name: Upload new etalons
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: playwright-etalons-${{ env.PLAYWRIGHT_JOB_NAME }}
+ path: ${{ runner.temp }}/new-etalons
+ if-no-files-found: ignore
+
+ # A retry passes against the etalon its first attempt wrote, so new etalons fail the job here.
+ - name: Fail on new etalons
+ if: always()
+ run: |
+ new_etalons=$(git ls-files --others --exclude-standard -- 'apps/demos/testing/etalons/*.png')
+ if [ -n "$new_etalons" ]; then
+ echo "::error::The tests wrote etalons that are not in the repository. They are in the playwright-etalons artifact:"
+ echo "$new_etalons"
+ exit 1
+ fi
+
- name: Sanitize job name
if: ${{ failure() }}
run: echo "JOB_NAME=$(echo "${{ matrix.CONSTEL }}-${{ matrix.THEME }}" | tr '/' '-')" >> $GITHUB_ENV
diff --git a/apps/demos/Demos/Autocomplete/Overview/Angular/app/app.component.ts b/apps/demos/Demos/Autocomplete/Overview/Angular/app/app.component.ts
index 2f8044c628e1..8155b4739ba0 100644
--- a/apps/demos/Demos/Autocomplete/Overview/Angular/app/app.component.ts
+++ b/apps/demos/Demos/Autocomplete/Overview/Angular/app/app.component.ts
@@ -79,6 +79,10 @@ export class AppComponent {
readonly fullInfo = signal('');
+ constructor() {
+ this.updateEmployeeInfo();
+ }
+
updateEmployeeInfo() {
let result = '';
result += (`${this.firstName || ''} ${this.lastName || ''}`).trim();
diff --git a/apps/demos/Demos/Autocomplete/Overview/Vue/App.vue b/apps/demos/Demos/Autocomplete/Overview/Vue/App.vue
index 266449c8d690..7fc95f11c8fe 100644
--- a/apps/demos/Demos/Autocomplete/Overview/Vue/App.vue
+++ b/apps/demos/Demos/Autocomplete/Overview/Vue/App.vue
@@ -151,6 +151,7 @@ function updateEmployeeInfo() {
employeeInfo += (employeeInfo && currentClient.value) ? `, ${currentClient.value}` : currentClient.value || '';
fullInfo.value = employeeInfo;
}
+updateEmployeeInfo();
function isNotEmpty(value: unknown) {
return value !== undefined && value !== null && value !== '';
}
diff --git a/apps/demos/Demos/Autocomplete/Overview/jQuery/index.js b/apps/demos/Demos/Autocomplete/Overview/jQuery/index.js
index 3621f906fb90..e70367864ff0 100644
--- a/apps/demos/Demos/Autocomplete/Overview/jQuery/index.js
+++ b/apps/demos/Demos/Autocomplete/Overview/jQuery/index.js
@@ -91,6 +91,8 @@ $(() => {
},
});
+ updateEmployeeInfo();
+
function updateEmployeeInfo() {
let result = `${firstName || ''} ${lastName || ''}`.trim();
diff --git a/apps/demos/Demos/Charts/Annotation/Angular/app/app.component.html b/apps/demos/Demos/Charts/Annotation/Angular/app/app.component.html
index 5e603d27886a..e8353c951797 100644
--- a/apps/demos/Demos/Charts/Annotation/Angular/app/app.component.html
+++ b/apps/demos/Demos/Charts/Annotation/Angular/app/app.component.html
@@ -14,27 +14,6 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/apps/demos/Demos/Charts/Colorization/Vue/App.vue b/apps/demos/Demos/Charts/Colorization/Vue/App.vue
index 6b34c773f07a..fce16f75d311 100644
--- a/apps/demos/Demos/Charts/Colorization/Vue/App.vue
+++ b/apps/demos/Demos/Charts/Colorization/Vue/App.vue
@@ -16,7 +16,7 @@
Options
-
Colorization Type
+
Colorization Type
span {
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-widget {
diff --git a/apps/demos/Demos/Charts/ExportAndPrintingAPI/Vue/App.vue b/apps/demos/Demos/Charts/ExportAndPrintingAPI/Vue/App.vue
index dc22af878960..ff8228b66ac8 100644
--- a/apps/demos/Demos/Charts/ExportAndPrintingAPI/Vue/App.vue
+++ b/apps/demos/Demos/Charts/ExportAndPrintingAPI/Vue/App.vue
@@ -28,7 +28,7 @@
icon="print"
text="Print"
@click="printChart"
- />
+ />{{ ' ' }}
.dx-button {
- margin: 0 22px;
+ margin: 0 20px;
}
.title {
diff --git a/apps/demos/Demos/Charts/ExportCustomMarkup/jQuery/index.html b/apps/demos/Demos/Charts/ExportCustomMarkup/jQuery/index.html
index 830ec01f00b7..1d4eca11ae0a 100644
--- a/apps/demos/Demos/Charts/ExportCustomMarkup/jQuery/index.html
+++ b/apps/demos/Demos/Charts/ExportCustomMarkup/jQuery/index.html
@@ -19,6 +19,7 @@
diff --git a/apps/demos/Demos/Charts/LegendMarkersCustomization/jQuery/index.js b/apps/demos/Demos/Charts/LegendMarkersCustomization/jQuery/index.js
index 9e70a6f66904..a4abcb218fe5 100644
--- a/apps/demos/Demos/Charts/LegendMarkersCustomization/jQuery/index.js
+++ b/apps/demos/Demos/Charts/LegendMarkersCustomization/jQuery/index.js
@@ -36,8 +36,8 @@ $(() => {
marker.setAttribute('fill', color);
marker.setAttribute('d', markerPath[item.series.name]);
- group.appendChild(marker);
group.appendChild(background);
+ group.appendChild(marker);
},
},
onLegendClick(e) {
diff --git a/apps/demos/Demos/Charts/Line/Vue/App.vue b/apps/demos/Demos/Charts/Line/Vue/App.vue
index 8b5b405bcf26..407ea88106cf 100644
--- a/apps/demos/Demos/Charts/Line/Vue/App.vue
+++ b/apps/demos/Demos/Charts/Line/Vue/App.vue
@@ -36,7 +36,7 @@
Options
- Series Type
+ Series Type
('line');
}
.option > span {
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-widget {
diff --git a/apps/demos/Demos/Charts/LoadDataOnDemand/test-code.js b/apps/demos/Demos/Charts/LoadDataOnDemand/test-code.js
index 2c7fd2121c1f..ac31d282052a 100644
--- a/apps/demos/Demos/Charts/LoadDataOnDemand/test-code.js
+++ b/apps/demos/Demos/Charts/LoadDataOnDemand/test-code.js
@@ -10,6 +10,8 @@ testUtils.importAnd(() => ['devextreme/viz/chart', 'devextreme/data/data_source'
.postponeUntilFound('#chart', 100, 5000)
.then(() => {
const instance = dxChart.getInstance(document.querySelector('#chart'));
+ instance.skipOptionsRollBack = true;
instance.option('dataSource', dataSource);
+ instance.skipOptionsRollBack = false;
});
});
diff --git a/apps/demos/Demos/Charts/PointsAggregation/Vue/App.vue b/apps/demos/Demos/Charts/PointsAggregation/Vue/App.vue
index c831833d7e41..d2001bbee059 100644
--- a/apps/demos/Demos/Charts/PointsAggregation/Vue/App.vue
+++ b/apps/demos/Demos/Charts/PointsAggregation/Vue/App.vue
@@ -80,7 +80,7 @@
/>
- Interval:
+ Interval:{{ ' ' }}
-
Method:
+
Method:{{ ' ' }}
span {
width: 50px;
display: inline-block;
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-selectbox {
diff --git a/apps/demos/Demos/Charts/ResolveLabelOverlap/Vue/App.vue b/apps/demos/Demos/Charts/ResolveLabelOverlap/Vue/App.vue
index b7a6c913b34c..15d523e667f7 100644
--- a/apps/demos/Demos/Charts/ResolveLabelOverlap/Vue/App.vue
+++ b/apps/demos/Demos/Charts/ResolveLabelOverlap/Vue/App.vue
@@ -17,7 +17,7 @@
Options
-
Overlapping Modes:
+
Overlapping Modes:
(overlappingModes[0]
.option > span {
position: relative;
top: 2px;
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-widget {
diff --git a/apps/demos/Demos/Charts/Spline/Vue/App.vue b/apps/demos/Demos/Charts/Spline/Vue/App.vue
index 7a004d857081..a676d73f25ea 100644
--- a/apps/demos/Demos/Charts/Spline/Vue/App.vue
+++ b/apps/demos/Demos/Charts/Spline/Vue/App.vue
@@ -38,7 +38,7 @@
Options
-
Series Type
+
Series Type
span {
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-widget {
diff --git a/apps/demos/Demos/Charts/TilingAlgorithms/Vue/App.vue b/apps/demos/Demos/Charts/TilingAlgorithms/Vue/App.vue
index b93ed787ef1d..9c245ba3a25b 100644
--- a/apps/demos/Demos/Charts/TilingAlgorithms/Vue/App.vue
+++ b/apps/demos/Demos/Charts/TilingAlgorithms/Vue/App.vue
@@ -19,7 +19,7 @@
Options
-
Tiling Algorithm
+
Tiling Algorithm
span {
- margin-right: 14px;
+ margin-right: 10px;
}
.option > .dx-widget {
diff --git a/apps/demos/Demos/Chat/MessageStreaming/Angular/app/app.component.css b/apps/demos/Demos/Chat/MessageStreaming/Angular/app/app.component.css
index 483774a91c5e..6d4ad6b1c894 100644
--- a/apps/demos/Demos/Chat/MessageStreaming/Angular/app/app.component.css
+++ b/apps/demos/Demos/Chat/MessageStreaming/Angular/app/app.component.css
@@ -44,6 +44,11 @@
flex-direction: column;
}
+::ng-deep .dx-button {
+ display: inline-block;
+ color: var(--dx-color-icon);
+}
+
::ng-deep .dx-template-wrapper > div > p:first-child {
margin-top: 0;
}
diff --git a/apps/demos/Demos/Chat/MessageStreaming/Vue/App.vue b/apps/demos/Demos/Chat/MessageStreaming/Vue/App.vue
index f90474c104a7..a2d55fb8bb6a 100644
--- a/apps/demos/Demos/Chat/MessageStreaming/Vue/App.vue
+++ b/apps/demos/Demos/Chat/MessageStreaming/Vue/App.vue
@@ -295,6 +295,11 @@ function sendSuggestion(prompt: string): void {
flex-direction: column;
}
+.dx-button {
+ display: inline-block;
+ color: var(--dx-color-icon);
+}
+
.dx-chat-messagebubble-content > div > p:first-child {
margin-top: 0;
}
diff --git a/apps/demos/Demos/Common/ListsOverview/React/App.tsx b/apps/demos/Demos/Common/ListsOverview/React/App.tsx
index 1103f4e2ff1e..9164053da12d 100644
--- a/apps/demos/Demos/Common/ListsOverview/React/App.tsx
+++ b/apps/demos/Demos/Common/ListsOverview/React/App.tsx
@@ -117,7 +117,7 @@ const App = () => {
elementAttr={tileViewAttrs}
/>
- {currentHotel.Postal_Code}, {currentHotel.Address}
+ {`${currentHotel.Postal_Code}, ${currentHotel.Address}`}
{currentHotel.Description}
>
diff --git a/apps/demos/Demos/Common/ListsOverview/ReactJs/App.js b/apps/demos/Demos/Common/ListsOverview/ReactJs/App.js
index f00d0e1afef1..1cc0c889cf0f 100644
--- a/apps/demos/Demos/Common/ListsOverview/ReactJs/App.js
+++ b/apps/demos/Demos/Common/ListsOverview/ReactJs/App.js
@@ -98,9 +98,7 @@ const App = () => {
elementAttr={tileViewAttrs}
/>
-
- {currentHotel.Postal_Code}, {currentHotel.Address}
-
+
{`${currentHotel.Postal_Code}, ${currentHotel.Address}`}
{currentHotel.Description}
>
diff --git a/apps/demos/Demos/Common/ListsOverview/Vue/App.vue b/apps/demos/Demos/Common/ListsOverview/Vue/App.vue
index e5034b037ca5..bae008d72f6c 100644
--- a/apps/demos/Demos/Common/ListsOverview/Vue/App.vue
+++ b/apps/demos/Demos/Common/ListsOverview/Vue/App.vue
@@ -21,7 +21,7 @@
/>
-
{{ currency(item.Price) }}
+
{{ currency(item.Price) }}
{{ ' ' }}
per
night
@@ -41,7 +41,7 @@
/>
-
{{ currency(currentHotel.Price) }}
+
{{ currency(currentHotel.Price) }}
{{ ' ' }}
per
night
@@ -200,6 +200,6 @@ function listSelectionChanged(e: DxListTypes.SelectionChangedEvent) {
.price-container .caption {
font-size: 11px;
line-height: 12px;
- padding-left: 6px;
+ padding-left: 2px;
}
diff --git a/apps/demos/Demos/Common/NavigationOverview/React/App.tsx b/apps/demos/Demos/Common/NavigationOverview/React/App.tsx
index 1d59f2645976..93da284183fa 100644
--- a/apps/demos/Demos/Common/NavigationOverview/React/App.tsx
+++ b/apps/demos/Demos/Common/NavigationOverview/React/App.tsx
@@ -35,14 +35,14 @@ const renderPanelItem = (city: City) => (
Population
- {city.population} people
+ {`${city.population} people`}
Area
- {city.area} km2
+ {`${city.area} km`}2
@@ -50,7 +50,7 @@ const renderPanelItem = (city: City) => (
Density
- {city.density}/km2
+ {`${city.density}/km`}2
diff --git a/apps/demos/Demos/Common/NavigationOverview/ReactJs/App.js b/apps/demos/Demos/Common/NavigationOverview/ReactJs/App.js
index b8e1db6104b3..6f293c7780ae 100644
--- a/apps/demos/Demos/Common/NavigationOverview/ReactJs/App.js
+++ b/apps/demos/Demos/Common/NavigationOverview/ReactJs/App.js
@@ -20,14 +20,15 @@ const renderPanelItem = (city) => (
Population
- {city.population} people
+ {`${city.population} people`}
Area
- {city.area} km2
+ {`${city.area} km`}
+ 2
@@ -35,7 +36,8 @@ const renderPanelItem = (city) => (
Density
- {city.density}/km2
+ {`${city.density}/km`}
+ 2
diff --git a/apps/demos/Demos/DataGrid/DeferredSelection/Vue/App.vue b/apps/demos/Demos/DataGrid/DeferredSelection/Vue/App.vue
index a04d06b1bd32..b0118c7b3c3e 100644
--- a/apps/demos/Demos/DataGrid/DeferredSelection/Vue/App.vue
+++ b/apps/demos/Demos/DataGrid/DeferredSelection/Vue/App.vue
@@ -57,15 +57,15 @@
/>
- Task count:
+ Task count:{{ ' ' }}
{{ taskCount }}
-
+
{{ ' ' }}
- People assigned:
+ People assigned:{{ ' ' }}
{{ peopleCount }}
-
+
{{ ' ' }}
- Average task duration (days):
+ Average task duration (days):{{ ' ' }}
{{ avgDuration }}
@@ -155,10 +155,6 @@ const onInitialized = (e: DxDataGridTypes.InitializedEvent) => {
text-align: right;
}
-.column:nth-child(2) {
- padding: 0 4px;
-}
-
.value {
font-size: 40px;
display: inline-block;
@@ -170,7 +166,6 @@ const onInitialized = (e: DxDataGridTypes.InitializedEvent) => {
white-space: normal;
display: inline-block;
vertical-align: middle;
- margin-right: 4px;
}
.avg-duration {
diff --git a/apps/demos/Demos/DataGrid/EditStateManagement/React/App.tsx b/apps/demos/Demos/DataGrid/EditStateManagement/React/App.tsx
index 4d53969c1d2a..2db74bbb8a49 100644
--- a/apps/demos/Demos/DataGrid/EditStateManagement/React/App.tsx
+++ b/apps/demos/Demos/DataGrid/EditStateManagement/React/App.tsx
@@ -83,11 +83,11 @@ const App = () => {
Options
-
Edit Row Key:
+
Edit Row Key:
{state.editRowKey == null ? 'null' : state.editRowKey.toString()}
-
Changes:
+
Changes:
{changesText}
diff --git a/apps/demos/Demos/DataGrid/EditStateManagement/React/styles.css b/apps/demos/Demos/DataGrid/EditStateManagement/React/styles.css
index 9147ca8f4415..0957a3d3144f 100644
--- a/apps/demos/Demos/DataGrid/EditStateManagement/React/styles.css
+++ b/apps/demos/Demos/DataGrid/EditStateManagement/React/styles.css
@@ -20,7 +20,7 @@
.option > span {
position: relative;
- margin-right: 14px;
+ margin-right: 10px;
}
.option > div {
diff --git a/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/App.js b/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/App.js
index a255fa4595f0..cc3549f31731 100644
--- a/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/App.js
+++ b/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/App.js
@@ -86,13 +86,13 @@ const App = () => {
Options
-
Edit Row Key:
+
Edit Row Key:
{state.editRowKey == null ? 'null' : state.editRowKey.toString()}
-
Changes:
+
Changes:
{changesText}
diff --git a/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/styles.css b/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/styles.css
index 9147ca8f4415..0957a3d3144f 100644
--- a/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/styles.css
+++ b/apps/demos/Demos/DataGrid/EditStateManagement/ReactJs/styles.css
@@ -20,7 +20,7 @@
.option > span {
position: relative;
- margin-right: 14px;
+ margin-right: 10px;
}
.option > div {
diff --git a/apps/demos/Demos/DataGrid/EditStateManagement/Vue/App.vue b/apps/demos/Demos/DataGrid/EditStateManagement/Vue/App.vue
index dc9a41fcf995..e6345c6e4b9a 100644
--- a/apps/demos/Demos/DataGrid/EditStateManagement/Vue/App.vue
+++ b/apps/demos/Demos/DataGrid/EditStateManagement/Vue/App.vue
@@ -38,11 +38,11 @@
Options
-
Edit Row Key:
+
Edit Row Key:
{{ editRowKey == null ? "null" : editRowKey.toString() }}
-
Changes:
+
Changes:
{{ changesText }}
@@ -114,7 +114,7 @@ loadOrders();
.option > span {
position: relative;
- margin-right: 14px;
+ margin-right: 10px;
}
.option > div {
diff --git a/apps/demos/Demos/Gantt/ContextMenu/Vue/App.vue b/apps/demos/Demos/Gantt/ContextMenu/Vue/App.vue
index b34ed6482d1c..643a6c784558 100644
--- a/apps/demos/Demos/Gantt/ContextMenu/Vue/App.vue
+++ b/apps/demos/Demos/Gantt/ContextMenu/Vue/App.vue
@@ -8,7 +8,7 @@
text="Prevent Context Menu Showing"
@value-changed="onPreventContextMenuShowing"
/>
-
+ {{ ' ' }}
-
+ {{ ' ' }}
-
+ {{ ' ' }}
Assigned: {item.key}
;
+const GroupTemplate = (item: Employee) => {`Assigned: ${item.key}`}
;
const App = () => (
diff --git a/apps/demos/Demos/List/Grouping/ReactJs/App.js b/apps/demos/Demos/List/Grouping/ReactJs/App.js
index 7027cf70a8c0..d17337ad1494 100644
--- a/apps/demos/Demos/List/Grouping/ReactJs/App.js
+++ b/apps/demos/Demos/List/Grouping/ReactJs/App.js
@@ -2,7 +2,7 @@ import React from 'react';
import List from 'devextreme-react/list';
import { employees } from './data.js';
-const GroupTemplate = (item) =>
Assigned: {item.key}
;
+const GroupTemplate = (item) =>
{`Assigned: ${item.key}`}
;
const App = () => (
{{ ' ' }}
diff --git a/apps/demos/Demos/PivotGrid/RemoteVirtualScrolling/test-code.js b/apps/demos/Demos/PivotGrid/RemoteVirtualScrolling/test-code.js
index ad543cda5950..701f0d57a62a 100644
--- a/apps/demos/Demos/PivotGrid/RemoteVirtualScrolling/test-code.js
+++ b/apps/demos/Demos/PivotGrid/RemoteVirtualScrolling/test-code.js
@@ -1,6 +1,9 @@
testUtils.postponeUntil(() => testUtils.findElements('td, span').some((x) => (x.innerHTML || '').indexOf('Aaron') !== -1), 200, 20000).then(() => testUtils
.postponeUntilFound('.dx-pivotgrid').then(() => testUtils.importAnd(() => 'devextreme/ui/pivot_grid', () => DevExpress.ui.dxPivotGrid, (dxPivotGrid) => {
- testUtils.findElements('.dx-pivotgrid:first-of-type').forEach((x) => {
- dxPivotGrid.getInstance(x).resetOption('height');
+ testUtils.findElements('.dx-pivotgrid').forEach((x) => {
+ const instance = dxPivotGrid.getInstance(x);
+ instance.skipOptionsRollBack = true;
+ instance.resetOption('height');
+ instance.skipOptionsRollBack = false;
});
})));
diff --git a/apps/demos/Demos/PivotGrid/StandaloneFieldChooser/jQuery/styles.css b/apps/demos/Demos/PivotGrid/StandaloneFieldChooser/jQuery/styles.css
index 0cdbb1b739e8..f24e894c3b60 100644
--- a/apps/demos/Demos/PivotGrid/StandaloneFieldChooser/jQuery/styles.css
+++ b/apps/demos/Demos/PivotGrid/StandaloneFieldChooser/jQuery/styles.css
@@ -1,7 +1,6 @@
.container {
position: relative;
margin-top: 20px;
- margin-bottom: 20px;
}
.bottom-bar {
@@ -19,7 +18,7 @@
background-color: var(--dx-color-options-panel-bg);
position: absolute;
top: 29px;
- bottom: 3px;
+ bottom: 5px;
left: 420px;
width: 180px;
}
diff --git a/apps/demos/Demos/PivotGrid/VirtualScrolling/test-code.js b/apps/demos/Demos/PivotGrid/VirtualScrolling/test-code.js
index 5149a1e512cb..0762c286b92d 100644
--- a/apps/demos/Demos/PivotGrid/VirtualScrolling/test-code.js
+++ b/apps/demos/Demos/PivotGrid/VirtualScrolling/test-code.js
@@ -1,7 +1,10 @@
testUtils
.postponeUntilFound('.dx-pivotgrid')
.then(() => testUtils.importAnd(() => 'devextreme/ui/pivot_grid', () => DevExpress.ui.dxPivotGrid, (dxPivotGrid) => {
- testUtils.findElements('.dx-pivotgrid:first-of-type').forEach((x) => {
- dxPivotGrid.getInstance(x).resetOption('height');
+ testUtils.findElements('.dx-pivotgrid').forEach((x) => {
+ const instance = dxPivotGrid.getInstance(x);
+ instance.skipOptionsRollBack = true;
+ instance.resetOption('height');
+ instance.skipOptionsRollBack = false;
});
}));
diff --git a/apps/demos/Demos/PivotGrid/WebAPIService/test-code.js b/apps/demos/Demos/PivotGrid/WebAPIService/test-code.js
index 9e512765ac92..d1d5afccb41b 100644
--- a/apps/demos/Demos/PivotGrid/WebAPIService/test-code.js
+++ b/apps/demos/Demos/PivotGrid/WebAPIService/test-code.js
@@ -1,6 +1,9 @@
testUtils.postponeUntil(() => testUtils.findElements('span').some((x) => (x.innerHTML || '').indexOf('Home Appliances Total') !== -1), 200, 20000).then(() => testUtils
.postponeUntilFound('.dx-pivotgrid').then(() => testUtils.importAnd(() => 'devextreme/ui/pivot_grid', () => DevExpress.ui.dxPivotGrid, (dxPivotGrid) => {
- testUtils.findElements('.dx-pivotgrid:first-of-type').forEach((x) => {
- dxPivotGrid.getInstance(x).resetOption('height');
+ testUtils.findElements('.dx-pivotgrid').forEach((x) => {
+ const instance = dxPivotGrid.getInstance(x);
+ instance.skipOptionsRollBack = true;
+ instance.resetOption('height');
+ instance.skipOptionsRollBack = false;
});
})));
diff --git a/apps/demos/Demos/Popup/Overview/Angular/app/app.component.html b/apps/demos/Demos/Popup/Overview/Angular/app/app.component.html
index 9751d1d9e3b9..33972c873014 100644
--- a/apps/demos/Demos/Popup/Overview/Angular/app/app.component.html
+++ b/apps/demos/Demos/Popup/Overview/Angular/app/app.component.html
@@ -9,7 +9,10 @@
[src]="employee.Picture"
/>
-
{{ employee.FirstName }} {{ employee.LastName }}{{ employee.FirstName }}{{ " " }}{{ employee.LastName }}
- {{ employee.FirstName }} {{ employee.LastName }}
+ {{ employee.FirstName }}{{ ' ' }}{{ employee.LastName }}
- Working days count: {{ workingDaysCount().toFixed() }}
+ Working days count: {{ workingDaysCount().toFixed() }}
Options
diff --git a/apps/demos/Demos/RangeSelector/Calculation/Vue/App.vue b/apps/demos/Demos/RangeSelector/Calculation/Vue/App.vue
index 1922c14eba14..2b94c7eb2e18 100644
--- a/apps/demos/Demos/RangeSelector/Calculation/Vue/App.vue
+++ b/apps/demos/Demos/RangeSelector/Calculation/Vue/App.vue
@@ -20,7 +20,7 @@
-
Working days count: {{ workingDaysCount }}
+
Working days count: {{ workingDaysCount }}
Options
diff --git a/apps/demos/Demos/RangeSelector/LogarithmicScale/Angular/app/app.component.ts b/apps/demos/Demos/RangeSelector/LogarithmicScale/Angular/app/app.component.ts
index 83b68aab52ff..a2b5f2683a41 100644
--- a/apps/demos/Demos/RangeSelector/LogarithmicScale/Angular/app/app.component.ts
+++ b/apps/demos/Demos/RangeSelector/LogarithmicScale/Angular/app/app.component.ts
@@ -18,7 +18,7 @@ if (!/localhost/.test(document.location.host)) {
})
export class AppComponent {
readonly dataSource: Record
[] = Array.from({ length: 100 }, (_, i) => ({
- arg: Math.pow(10, i * 0.1),
+ arg: 10 ** i * 0.1,
val: Math.log(i + 1) / Math.log(0.5) + (Math.random() - 0.5) * (100 / (i + 1)) + 10,
}));
diff --git a/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Vue/AppointmentTemplate.vue b/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Vue/AppointmentTemplate.vue
index b2939d9766f1..9df7d26dd0b3 100644
--- a/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Vue/AppointmentTemplate.vue
+++ b/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Vue/AppointmentTemplate.vue
@@ -1,10 +1,12 @@
-
-
![]()
-
{{ movieInfo.text }}
+
+
+
![]()
+
{{ movieInfo.text }}
+
diff --git a/apps/demos/Demos/Scheduler/Templates/Vue/AppointmentTemplate.vue b/apps/demos/Demos/Scheduler/Templates/Vue/AppointmentTemplate.vue
index aa21bd18b88b..a93dbb5d508c 100644
--- a/apps/demos/Demos/Scheduler/Templates/Vue/AppointmentTemplate.vue
+++ b/apps/demos/Demos/Scheduler/Templates/Vue/AppointmentTemplate.vue
@@ -1,19 +1,21 @@
-
-
-
![]()
-
-
-
{{ movieData.text }}
-
- Ticket Price:
${{ templateModel.targetedAppointmentData?.price }}
+
+
+
+
-
- {{ getFormatDate(templateModel.targetedAppointmentData?.displayStartDate) }} -
- {{ getFormatDate(templateModel.targetedAppointmentData?.displayEndDate) }}
+
+
{{ movieData.text }}
+
+ Ticket Price: ${{ templateModel.targetedAppointmentData?.price }}
+
+
+ {{ getFormatDate(templateModel.targetedAppointmentData?.displayStartDate) }} -
+ {{ getFormatDate(templateModel.targetedAppointmentData?.displayEndDate) }}
+
diff --git a/apps/demos/Demos/SelectBox/CustomizeDropDownButton/Angular/app/app.component.html b/apps/demos/Demos/SelectBox/CustomizeDropDownButton/Angular/app/app.component.html
index 226a1dbfe0c5..a46c2ad41668 100644
--- a/apps/demos/Demos/SelectBox/CustomizeDropDownButton/Angular/app/app.component.html
+++ b/apps/demos/Demos/SelectBox/CustomizeDropDownButton/Angular/app/app.component.html
@@ -57,6 +57,7 @@
src="../../../../images/icons/{{ selectedItem.IconSrc }}"
class="custom-icon"
/>
+ } @else {
}
diff --git a/apps/demos/Demos/Sortable/Customization/Angular/app/app.component.css b/apps/demos/Demos/Sortable/Customization/Angular/app/app.component.css
index baa250b33f01..32f8ed0c7791 100644
--- a/apps/demos/Demos/Sortable/Customization/Angular/app/app.component.css
+++ b/apps/demos/Demos/Sortable/Customization/Angular/app/app.component.css
@@ -6,6 +6,10 @@
height: 500px;
}
+#list {
+ display: block;
+}
+
#scroll.horizontal {
margin-top: 170px;
display: block;
diff --git a/apps/demos/Demos/Splitter/Overview/React/PaneContent.tsx b/apps/demos/Demos/Splitter/Overview/React/PaneContent.tsx
index e37f57e9b0af..20508bde019f 100644
--- a/apps/demos/Demos/Splitter/Overview/React/PaneContent.tsx
+++ b/apps/demos/Demos/Splitter/Overview/React/PaneContent.tsx
@@ -42,7 +42,7 @@ const PaneContent = (data: PaneContentProps) => {
{getPaneState(data)}
{getFilteredDimensionOptions(data).map((item, index) => (
- {item.key}: {item.value}
+ {`${item.key}: ${item.value}`}
))}
diff --git a/apps/demos/Demos/Splitter/Overview/ReactJs/PaneContent.js b/apps/demos/Demos/Splitter/Overview/ReactJs/PaneContent.js
index 909659a2f0c6..db52ad6cdd1e 100644
--- a/apps/demos/Demos/Splitter/Overview/ReactJs/PaneContent.js
+++ b/apps/demos/Demos/Splitter/Overview/ReactJs/PaneContent.js
@@ -33,7 +33,7 @@ const PaneContent = (data) => {
className="pane-option"
key={index}
>
- {item.key}: {item.value}
+ {`${item.key}: ${item.value}`}
))}
diff --git a/apps/demos/Demos/TabPanel/DragAndDrop/React/App.tsx b/apps/demos/Demos/TabPanel/DragAndDrop/React/App.tsx
index 82f96c8c02e9..a4bce5e3ab60 100644
--- a/apps/demos/Demos/TabPanel/DragAndDrop/React/App.tsx
+++ b/apps/demos/Demos/TabPanel/DragAndDrop/React/App.tsx
@@ -12,7 +12,7 @@ function TabTitle({ data, onClose }: { data: Employee; onClose: (item: Employee)
return (
<>
- {data.FirstName} {data.LastName}
+ {`${data.FirstName} ${data.LastName}`}
>
);
@@ -48,7 +48,7 @@ function App() {
const renderTitle = useCallback((data: Employee) => employees.length >= 2
?
- : <>{data.FirstName} {data.LastName}>, [employees.length, closeButtonHandler]);
+ : <>{`${data.FirstName} ${data.LastName}`}>, [employees.length, closeButtonHandler]);
const onSelectionChanged = useCallback((args: TabPanelTypes.SelectionChangedEvent): void => {
setSelectedItem(args.addedItems[0]);
diff --git a/apps/demos/Demos/TabPanel/DragAndDrop/ReactJs/App.js b/apps/demos/Demos/TabPanel/DragAndDrop/ReactJs/App.js
index 00f5157d81cc..fed5dbda10c0 100644
--- a/apps/demos/Demos/TabPanel/DragAndDrop/ReactJs/App.js
+++ b/apps/demos/Demos/TabPanel/DragAndDrop/ReactJs/App.js
@@ -9,9 +9,7 @@ function TabTitle({ data, onClose }) {
const handleClose = useCallback(() => onClose(data), [onClose, data]);
return (
<>
-
- {data.FirstName} {data.LastName}
-
+ {`${data.FirstName} ${data.LastName}`}
) : (
<>
-
- {data.FirstName} {data.LastName}
-
+ {`${data.FirstName} ${data.LastName}`}
>
),
[employees.length, closeButtonHandler],
diff --git a/apps/demos/Demos/TabPanel/Templates/React/CompanyItem.tsx b/apps/demos/Demos/TabPanel/Templates/React/CompanyItem.tsx
index 1ed2532c9154..eaf03f545af6 100644
--- a/apps/demos/Demos/TabPanel/Templates/React/CompanyItem.tsx
+++ b/apps/demos/Demos/TabPanel/Templates/React/CompanyItem.tsx
@@ -24,8 +24,8 @@ function CompanyItem({ data }: CompanyItemProps) {
{ Address }
- { City },
- { State }
+ { City },{' '}
+ { State }{' '}
{ Zipcode }
diff --git a/apps/demos/Demos/TabPanel/Templates/ReactJs/CompanyItem.js b/apps/demos/Demos/TabPanel/Templates/ReactJs/CompanyItem.js
index 8ddb5366ce96..69ab878949b9 100644
--- a/apps/demos/Demos/TabPanel/Templates/ReactJs/CompanyItem.js
+++ b/apps/demos/Demos/TabPanel/Templates/ReactJs/CompanyItem.js
@@ -13,10 +13,9 @@ function CompanyItem({ data }) {
- {City},
-
- {State}
- {Zipcode}
+ {City},
+ {' '}
+ {State} {Zipcode}
diff --git a/apps/demos/Demos/TabPanel/Templates/Vue/App.vue b/apps/demos/Demos/TabPanel/Templates/Vue/App.vue
index 2e9d45e10c76..9b048e3fa25a 100644
--- a/apps/demos/Demos/TabPanel/Templates/Vue/App.vue
+++ b/apps/demos/Demos/TabPanel/Templates/Vue/App.vue
@@ -19,8 +19,8 @@
{{ company.Address }}
- {{ company.City }},
- {{ company.State }}
+ {{ company.City }},{{ ' ' }}
+ {{ company.State }}{{ ' ' }}
{{ company.Zipcode }}
diff --git a/apps/demos/Demos/TagBox/Grouping/Angular/app/app.component.html b/apps/demos/Demos/TagBox/Grouping/Angular/app/app.component.html
index 8bdd17d159b1..89750db522c9 100644
--- a/apps/demos/Demos/TagBox/Grouping/Angular/app/app.component.html
+++ b/apps/demos/Demos/TagBox/Grouping/Angular/app/app.component.html
@@ -40,7 +40,6 @@
[grouped]="true"
displayExpr="Name"
[inputAttr]="{ 'aria-label': 'Product' }"
- searchEnabled="true"
groupTemplate="group"
>
diff --git a/apps/demos/Demos/TreeList/MultipleRowSelection/Vue/App.vue b/apps/demos/Demos/TreeList/MultipleRowSelection/Vue/App.vue
index 6dd1bf2417f0..1b299d27ce59 100644
--- a/apps/demos/Demos/TreeList/MultipleRowSelection/Vue/App.vue
+++ b/apps/demos/Demos/TreeList/MultipleRowSelection/Vue/App.vue
@@ -55,7 +55,7 @@
/>
- Selected Records:
+ Selected Records:{{ ' ' }}
{{ selectedEmployeeNames }}
@@ -114,10 +114,6 @@ function getEmployeeNames(employeeList: Employee[]) {
margin-top: 20px;
}
-.selected-data .caption {
- margin-right: 4px;
-}
-
.option > span {
width: 120px;
display: inline-block;
diff --git a/apps/demos/Demos/TreeList/Overview/Vue/EmployeeCell.vue b/apps/demos/Demos/TreeList/Overview/Vue/EmployeeCell.vue
index bf39c3190480..67a98d6639d1 100644
--- a/apps/demos/Demos/TreeList/Overview/Vue/EmployeeCell.vue
+++ b/apps/demos/Demos/TreeList/Overview/Vue/EmployeeCell.vue
@@ -5,7 +5,7 @@
:src="cellData.Task_Assigned_Employee.Picture"
alt=""
class="img"
- >
+ >{{ ' ' }}
-`; without it every jQuery demo runs, about five minutes per theme. The first run builds the image and takes a few minutes more. The second loop compares as CI does: exactly.
+`--grep` takes test names, `-`; without it every jQuery demo runs, about five minutes per theme. Record etalons from the jQuery demos only; check a framework against them with `CONSTEL=react` (or `vue`, `angular`) and without `--update-snapshots`. The first run builds the image and takes a few minutes more. The second loop compares as CI does: exactly.
The repository is mounted case-insensitively on macOS: a file that a demo requests in the wrong case loads in the container and is missing on CI.
diff --git a/apps/demos/package.json b/apps/demos/package.json
index c55c3e58b9eb..9fa10a18495a 100644
--- a/apps/demos/package.json
+++ b/apps/demos/package.json
@@ -142,7 +142,6 @@
"lint": "pnpm exec nx run-many -t lint-js lint-demos lint-css lint-html -p devextreme-demos",
"test-playwright": "playwright test",
"test-testcafe": "ts-node utils/visual-tests/testcafe-runner.ts",
- "test-testcafe:csp": "cross-env CSP_REPORT=true ts-node utils/visual-tests/testcafe-runner.ts",
"test-testcafe:accessibility": "cross-env STRATEGY=accessibility CONSTEL=jquery node utils/visual-tests/testcafe-runner.ts",
"csp-server": "node utils/server/csp-server.js 8080",
"csp-check": "node utils/server/csp-check.js",
diff --git a/apps/demos/testing/common.spec.ts b/apps/demos/testing/common.spec.ts
index d6974fdedd1d..bbec4d3c4ddc 100644
--- a/apps/demos/testing/common.spec.ts
+++ b/apps/demos/testing/common.spec.ts
@@ -1,4 +1,4 @@
-import { existsSync } from 'fs';
+import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
import { glob } from 'glob';
import { expect, test } from '@playwright/test';
@@ -18,19 +18,18 @@ import { mockApi } from '../utils/visual-tests/playwright/api-mocks';
import { BASE_URL, THEME } from '../utils/visual-tests/playwright/const';
import {
getConsoleMessages,
+ getVendorVizWidgets,
openDemo,
prepareDemoPage,
runTestCode,
trackPageActivity,
} from '../utils/visual-tests/playwright/demo-page';
import { knownWarnings } from './known-warnings';
+import { getTestGlobalsScriptPath } from '../utils/visual-tests/test-globals-bundle';
import { skippedTests } from './skipped-tests';
type DemoSteps = (page: Page) => Promise;
-// The other frameworks still run in TestCafe (common.test.ts).
-const MIGRATED_FRAMEWORKS = [FRAMEWORKS.jquery];
-
const DEMOS_ROOT = join(__dirname, '..');
// Demos are selected by name with --grep, so the command line holds no demo masks.
@@ -38,9 +37,14 @@ updateConfig({ explicitTestArgs: [], verbose: false });
const demoPaths = glob.sync('Demos/*/*', { cwd: DEMOS_ROOT }).sort();
-MIGRATED_FRAMEWORKS.forEach((approach) => {
+Object.values(FRAMEWORKS).forEach((approach) => {
if (!shouldRunFramework(approach)) { return; }
+ // The widgets test-code.js reaches through window.DevExpress; the React and Vue bundles expose them only with this script.
+ const testGlobalsPath = getTestGlobalsScriptPath(approach);
+ const testGlobals = testGlobalsPath ? readFileSync(testGlobalsPath, 'utf8') : null;
+ const vendorVizWidgets = getVendorVizWidgets(approach);
+
test.describe(approach, () => {
demoPaths.forEach((demoPath, index) => {
const demoDir = join(DEMOS_ROOT, demoPath);
@@ -75,7 +79,7 @@ MIGRATED_FRAMEWORKS.forEach((approach) => {
const waitForIdle = trackPageActivity(page);
await mockApi(page);
- await prepareDemoPage(page, pageURL, THEME, clientScript);
+ await prepareDemoPage(page, pageURL, THEME, clientScript, testGlobals, vendorVizWidgets);
await openDemo(page, pageURL, waitForIdle);
if (testStyles) {
diff --git a/apps/demos/testing/common.test.ts b/apps/demos/testing/common.test.ts
index da103fa0fa21..9211597acd82 100644
--- a/apps/demos/testing/common.test.ts
+++ b/apps/demos/testing/common.test.ts
@@ -1,9 +1,7 @@
import { glob } from 'glob';
import { join } from 'path';
-import { existsSync, mkdirSync, appendFileSync } from 'fs';
-import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
+import { existsSync } from 'fs';
import { axeCheck, createReport } from '@testcafe-community/axe';
-import { ClientFunction } from 'testcafe';
import {
runTestAtPage,
shouldRunFramework,
@@ -12,20 +10,13 @@ import {
changeTheme,
waitForAngularLoading,
waitForStylesheets,
- shouldSkipDemo,
FRAMEWORKS,
execCode,
injectStyle,
} from '../utils/visual-tests/matrix-test-helper';
-import {
- testScreenshot,
- isMaterial,
- isFluent,
-} from '../utils/visual-tests/helpers/theme-utils';
+import { isMaterial, isFluent } from '../utils/visual-tests/helpers/theme-utils';
import { createMdReport, createTestCafeReport } from '../utils/axe-reporter/reporter';
import { getTestGlobalsScriptPath } from '../utils/visual-tests/test-globals-bundle';
-import { knownWarnings } from './known-warnings';
-import { skippedTests } from './skipped-tests';
import { widgetsGalleryServiceMock } from './apiMocks/widgetsGalleryServiceMock';
import { xmlaServiceMock } from './apiMocks/xmlaServiceMock';
@@ -35,28 +26,6 @@ const execTestCafeCode = (t, code) => {
return testCafeFunction(t);
};
-const getClientCspViolations = ClientFunction(() => (window as any).__cspViolations || []);
-
-const isCspEnabled = () => process.env.CSP_REPORT === 'true';
-
-const cspReportDir = join(__dirname, '..', 'csp-reports');
-const cspReportFile = join(cspReportDir, 'csp-violations.jsonl');
-
-const writeCspReport = (testName: string, framework: string, violations: any[]) => {
- if (!violations.length) return;
- if (!existsSync(cspReportDir)) {
- mkdirSync(cspReportDir, { recursive: true });
- }
- for (const v of violations) {
- const entry = {
- test: testName,
- framework,
- ...v,
- };
- appendFileSync(cspReportFile, `${JSON.stringify(entry)}\n`);
- }
-};
-
const getIgnoredRules = (testName) => {
const ignoredRules = [];
@@ -115,25 +84,15 @@ const getIgnoredRules = (testName) => {
const getClientScripts = (approach: string) => {
const scripts = [
{ module: 'mockdate' },
+ { module: 'axe-core/axe.min.js' },
];
- if (process.env.STRATEGY === 'accessibility') {
- scripts.push({ module: 'axe-core/axe.min.js' });
- }
-
const testGlobalsScriptPath = getTestGlobalsScriptPath(approach);
if (testGlobalsScriptPath) {
// @ts-expect-error
scripts.push(testGlobalsScriptPath);
}
- if (isCspEnabled()) {
- scripts.push(
- // @ts-expect-error
- join(__dirname, '../utils/visual-tests/inject/csp-listener.js'),
- );
- }
-
scripts.push(
// @ts-expect-error
join(__dirname, '../utils/visual-tests/inject/test-utils.js'),
@@ -149,16 +108,10 @@ const getClientScripts = (approach: string) => {
return scripts;
};
+// The demo screenshots are taken by Playwright (common.spec.ts); this test runs the accessibility checks.
Object.values(FRAMEWORKS).forEach((approach) => {
- if (!shouldRunFramework(approach)) { return; }
- // jQuery screenshots are taken by Playwright (common.spec.ts).
- if (approach === FRAMEWORKS.jquery && process.env.STRATEGY !== 'accessibility') { return; }
+ if (process.env.STRATEGY !== 'accessibility' || !shouldRunFramework(approach)) { return; }
fixture(approach)
- .beforeEach(async (t) => {
- if (process.env.STRATEGY !== 'accessibility') {
- await t.resizeWindow(1000, 800);
- }
- })
.clientScripts(getClientScripts(approach))
.requestHooks(widgetsGalleryServiceMock, xmlaServiceMock);
@@ -181,32 +134,19 @@ Object.values(FRAMEWORKS).forEach((approach) => {
const visualTestSettings = readFrom('../visualtestrc.json', (x) => JSON.parse(x));
const visualTestStyles = readFrom('../test-styles.css', (x) => injectStyle(x));
- let comparisonOptions;
- if (process.env.DISABLE_DEMO_TEST_SETTINGS !== 'all') {
- const approachLowerCase = approach.toLowerCase();
- const mergedTestSettings = (visualTestSettings && {
+ if (process.env.CI_ENV && !['all', 'ignore'].includes(process.env.DISABLE_DEMO_TEST_SETTINGS)) {
+ const mergedTestSettings = {
...visualTestSettings,
- ...visualTestSettings[approachLowerCase],
- }) || {};
+ ...visualTestSettings?.[approach.toLowerCase()],
+ };
- if (process.env.CI_ENV && process.env.DISABLE_DEMO_TEST_SETTINGS !== 'ignore') {
- if (mergedTestSettings.ignore) { return; }
- }
- if (process.env.DISABLE_DEMO_TEST_SETTINGS !== 'comparison-options') {
- comparisonOptions = mergedTestSettings['comparison-options'];
- }
+ if (mergedTestSettings.ignore) { return; }
}
changeTheme(__dirname, `../${demoPath}/index.html`, process.env.THEME);
const pageURL = `http://127.0.0.1:8080/apps/demos/Demos/${widgetName}/${demoName}/${approach}/`;
- if (shouldSkipDemo(approach, widgetName, demoName, skippedTests) && process.env.STRATEGY !== 'accessibility') {
- return;
- }
-
- if (process.env.STRATEGY === 'accessibility'
- && process.env.THEME?.startsWith('fluent-next')
- && getIgnoredRules(testName).includes('color-contrast')) {
+ if (process.env.THEME?.startsWith('fluent-next') && getIgnoredRules(testName).includes('color-contrast')) {
return;
}
@@ -232,49 +172,28 @@ Object.values(FRAMEWORKS).forEach((approach) => {
await execTestCafeCode(t, testCafeCodeSource);
}
- if (process.env.STRATEGY === 'accessibility') {
- const ignoredRules = getIgnoredRules(testName);
- const isDesignSystemFluent = process.env.THEME?.startsWith('fluent-next');
- const colorContrastIgnored = ignoredRules.includes('color-contrast');
- const options = isDesignSystemFluent
- ? { runOnly: { type: 'rule' as const, values: colorContrastIgnored ? [] : ['color-contrast'] }, rules: {} }
- : { rules: {} };
-
- ignoredRules.forEach((ruleName) => {
- if (isDesignSystemFluent && ruleName === 'color-contrast') return;
- options.rules[ruleName] = { enabled: false };
- });
+ const ignoredRules = getIgnoredRules(testName);
+ const isDesignSystemFluent = process.env.THEME?.startsWith('fluent-next');
+ const colorContrastIgnored = ignoredRules.includes('color-contrast');
+ const options = isDesignSystemFluent
+ ? { runOnly: { type: 'rule' as const, values: colorContrastIgnored ? [] : ['color-contrast'] }, rules: {} }
+ : { rules: {} };
- const axeResult = await axeCheck(t, '.demo-container', options);
- const { error, results } = axeResult;
+ ignoredRules.forEach((ruleName) => {
+ if (isDesignSystemFluent && ruleName === 'color-contrast') return;
+ options.rules[ruleName] = { enabled: false };
+ });
- if (results.violations.length > 0) {
- createMdReport({ testName, results });
- await t.report(createTestCafeReport(results.violations));
- }
+ const axeResult = await axeCheck(t, '.demo-container', options);
+ const { error, results } = axeResult;
- await t.expect(error).notOk();
- await t.expect(results.violations.length === 0).ok(createReport(results.violations));
- } else {
- const consoleMessages = await t.getBrowserConsoleMessages();
- const errors = [...consoleMessages.error, ...consoleMessages.warn]
- .filter((e) => !knownWarnings.some((kw) => e.startsWith(kw)))
- .filter((e) => !e.startsWith('[CSP Violation]'));
- await t.expect(errors).eql([]);
-
- if (isCspEnabled()) {
- const cspViolations = await getClientCspViolations();
- writeCspReport(testName, approach, cspViolations);
- }
-
- const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
-
- await testScreenshot(t, takeScreenshot, `${testName}.png`, undefined, comparisonOptions);
-
- await t
- .expect(compareResults.isValid())
- .ok(compareResults.errorMessages());
+ if (results.violations.length > 0) {
+ createMdReport({ testName, results });
+ await t.report(createTestCafeReport(results.violations));
}
+
+ await t.expect(error).notOk();
+ await t.expect(results.violations.length === 0).ok(createReport(results.violations));
});
});
});
diff --git a/apps/demos/testing/etalons/Autocomplete-Overview (fluent-next.blue.light).png b/apps/demos/testing/etalons/Autocomplete-Overview (fluent-next.blue.light).png
index 9828cb54906d..3798aa495925 100644
Binary files a/apps/demos/testing/etalons/Autocomplete-Overview (fluent-next.blue.light).png and b/apps/demos/testing/etalons/Autocomplete-Overview (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Autocomplete-Overview (fluent.blue.light).png b/apps/demos/testing/etalons/Autocomplete-Overview (fluent.blue.light).png
index 3d2baf72e3a8..1da4bda4f75a 100644
Binary files a/apps/demos/testing/etalons/Autocomplete-Overview (fluent.blue.light).png and b/apps/demos/testing/etalons/Autocomplete-Overview (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Autocomplete-Overview (material.blue.light).png b/apps/demos/testing/etalons/Autocomplete-Overview (material.blue.light).png
index 92e249627651..1a5ff5713abe 100644
Binary files a/apps/demos/testing/etalons/Autocomplete-Overview (material.blue.light).png and b/apps/demos/testing/etalons/Autocomplete-Overview (material.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent-next.blue.light).png b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent-next.blue.light).png
index aa39a4c0209f..52b9f540e7e8 100644
Binary files a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent-next.blue.light).png and b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent.blue.light).png b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent.blue.light).png
index 376ed3a94616..5b9b3a0a0083 100644
Binary files a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent.blue.light).png and b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (material.blue.light).png b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (material.blue.light).png
index c44d3baf08d9..3dd129eff692 100644
Binary files a/apps/demos/testing/etalons/Charts-ExportCustomMarkup (material.blue.light).png and b/apps/demos/testing/etalons/Charts-ExportCustomMarkup (material.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent-next.blue.light).png b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent-next.blue.light).png
index 08bb44a764ac..7ecc3fb16690 100644
Binary files a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent-next.blue.light).png and b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent.blue.light).png b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent.blue.light).png
index 381a8c391c8a..7b6267ba2dd8 100644
Binary files a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent.blue.light).png and b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (material.blue.light).png b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (material.blue.light).png
index 4bfeccdc2063..917f7094d731 100644
Binary files a/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (material.blue.light).png and b/apps/demos/testing/etalons/Charts-LegendMarkersCustomization (material.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent-next.blue.light).png b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent-next.blue.light).png
index d1b097091f65..baca76bc911c 100644
Binary files a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent-next.blue.light).png and b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent.blue.light).png b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent.blue.light).png
index 9d3e7e6b0bc4..6e06beb2043c 100644
Binary files a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent.blue.light).png and b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (material.blue.light).png b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (material.blue.light).png
index b286afbb70a9..3c62ed36e364 100644
Binary files a/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (material.blue.light).png and b/apps/demos/testing/etalons/Charts-PolarChartZoomingAndScrollingAPI (material.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent-next.blue.light).png b/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent-next.blue.light).png
index 3ee90ab59b61..0bababbb1ba5 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent-next.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent.blue.light).png b/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent.blue.light).png
index 53e51ab4698c..a4d594f92a1d 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-OLAPDataSource (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent-next.blue.light).png b/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent-next.blue.light).png
index d7cebfdfc9b3..1b38937297a9 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent-next.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent.blue.light).png b/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent.blue.light).png
index ea79b667a6c9..db6d01862cb0 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-RemoteVirtualScrolling (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent-next.blue.light).png b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent-next.blue.light).png
index a81b69bcf651..f67cd38eca60 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent-next.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent-next.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent.blue.light).png b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent.blue.light).png
index bb532f564185..20982f03b900 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (fluent.blue.light).png differ
diff --git a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (material.blue.light).png b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (material.blue.light).png
index cce381a909e6..0eee09ad0c87 100644
Binary files a/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (material.blue.light).png and b/apps/demos/testing/etalons/PivotGrid-StandaloneFieldChooser (material.blue.light).png differ
diff --git a/apps/demos/testing/skipped-tests.js b/apps/demos/testing/skipped-tests.js
index cdd9e5ce7dcf..2e6653992f74 100644
--- a/apps/demos/testing/skipped-tests.js
+++ b/apps/demos/testing/skipped-tests.js
@@ -10,6 +10,9 @@ export const skippedTests = {
React: {
// WebGL initialization error at the provider. There is no point in adding a mask
Map: ['ProvidersAndTypes', 'Markers', 'Routes'],
+ // With templatesRenderAsynchronously the search highlighting nests spans once per column,
+ // which shifts the column widths. Remove once the grid_core search fix is merged.
+ TreeList: ['FilterModes'],
},
Vue: {
// WebGL initialization error at the provider. There is no point in adding a mask
diff --git a/apps/demos/utils/server/demo-bundle-angular.js b/apps/demos/utils/server/demo-bundle-angular.js
index 5d43649ec76a..813a8f68904d 100644
--- a/apps/demos/utils/server/demo-bundle-angular.js
+++ b/apps/demos/utils/server/demo-bundle-angular.js
@@ -6,7 +6,9 @@ const path = require('path');
const fs = require('fs');
const os = require('os');
const esbuild = require('esbuild');
-const { extractDemoHeadExtras, extractDemoBodyInner } = require('./demo-html');
+const {
+ extractDemoHeadExtras, extractDemoBodyInner, PACKAGE_CSS_RE, packageCssLinks,
+} = require('./demo-html');
const { createEntryShimSource } = require('./demo-render-signal');
const { discoverTestGlobalsFromContent } = require('../visual-tests/test-globals-bundle');
const { readShardConfig, applyShard: applyShardGeneric } = require('./shard');
@@ -120,11 +122,39 @@ function testGlobalsShimSource(entries) {
`;
}
+// The viz widgets whose start-up animation the screenshot tests switch off (see
+// utils/visual-tests/playwright/demo-page.ts), by their Angular module name and public module.
+const VIZ_WIDGET_MODULES = {
+ Chart: ['dxChart', 'devextreme/viz/chart'],
+ PieChart: ['dxPieChart', 'devextreme/viz/pie_chart'],
+ PolarChart: ['dxPolarChart', 'devextreme/viz/polar_chart'],
+ CircularGauge: ['dxCircularGauge', 'devextreme/viz/circular_gauge'],
+ LinearGauge: ['dxLinearGauge', 'devextreme/viz/linear_gauge'],
+ BarGauge: ['dxBarGauge', 'devextreme/viz/bar_gauge'],
+ RangeSelector: ['dxRangeSelector', 'devextreme/viz/range_selector'],
+};
+
+// Hands the widget classes of the demo to the test page before the demo renders. The static
+// imports add nothing to the bundle: the demo imports the same modules. Outside the tests the hook
+// is not defined and nothing happens.
+function vizAnimationHookSource(demo) {
+ const source = findDemoTsFiles(demo.srcDir).map((file) => fs.readFileSync(file, 'utf8')).join('\n');
+ const used = Object.entries(VIZ_WIDGET_MODULES)
+ .filter(([widget]) => new RegExp(`\\bDx${widget}(Module|Component)\\b`).test(source));
+ if (used.length === 0) return '';
+ return `
+${used.map(([, [name, specifier]]) => ` import ${name} from ${JSON.stringify(specifier)};`).join('\n')}
+${used.map(([, [name]]) => ` window.dxTestDisableVizAnimation?.(${name}, ${JSON.stringify(name)});`).join('\n')}
+`;
+}
+
function writeEntryShim(demo, entryPath) {
fs.mkdirSync(GENERATED_SHIM_DIR, { recursive: true });
const slug = `${demo.widget}-${demo.name}`.replace(/[^a-zA-Z0-9_.-]/g, '_');
const dest = path.join(GENERATED_SHIM_DIR, `${slug}.ts`);
- const source = createEntryShimSource(entryPath, { tsNoCheck: true }) + testGlobalsShimSource(demoTestGlobals(demo));
+ const source = createEntryShimSource(entryPath, { tsNoCheck: true })
+ + vizAnimationHookSource(demo)
+ + testGlobalsShimSource(demoTestGlobals(demo));
fs.writeFileSync(dest, source);
allEntryShims.add(dest);
return dest;
@@ -143,10 +173,15 @@ const DEFAULT_BODY_INNER = `
Loading...
`;
-function buildHtml({ jsFiles, cssFiles, srcDir }) {
+function buildHtml({
+ jsFiles, cssFiles, packageCss = [], srcDir,
+}) {
+ const packageLinks = packageCssLinks(packageCss);
const cssLinks = [
+ ...packageLinks,
'',
- ...extractDemoHeadExtras(srcDir),
+ // The demo's index.html is the page generated last time; its package links are already above.
+ ...extractDemoHeadExtras(srcDir).filter((tag) => !packageLinks.includes(tag)),
...cssFiles.map((f) => ``),
].join('\n ');
const bodyInner = extractDemoBodyInner(srcDir) || DEFAULT_BODY_INNER;
@@ -316,7 +351,26 @@ function patchedSiblingPath(tsFile) {
return path.join(path.dirname(tsFile), `${PATCHED_TS_PREFIX}${path.basename(tsFile)}`);
}
-function patchComponentTs(tsFile) {
+const CSS_IMPORT_RE = /@import\s+(?:url\(\s*)?(['"])([^'"]+)\1\s*\)?\s*;?/g;
+
+// Writes a copy of a component style sheet without its package imports, which go to packageCss.
+function stripPackageCssImports(cssFile, packageCss) {
+ const original = fs.readFileSync(cssFile, 'utf8');
+ let stripped = false;
+ const patched = original.replace(CSS_IMPORT_RE, (match, _quote, spec) => {
+ if (!PACKAGE_CSS_RE.test(spec)) return match;
+ if (!packageCss.includes(spec)) packageCss.push(spec);
+ stripped = true;
+ return '';
+ });
+ if (!stripped) return null;
+ const dest = patchedSiblingPath(cssFile);
+ fs.writeFileSync(dest, patched);
+ allPatchedTsFiles.add(dest);
+ return dest;
+}
+
+function patchComponentTs(tsFile, packageCss = []) {
if (!fs.existsSync(tsFile)) return null;
const original = fs.readFileSync(tsFile, 'utf8');
let patched = original;
@@ -332,6 +386,11 @@ function patchComponentTs(tsFile) {
if (!fixed) return match;
return `styleUrls: ['${fixed}']`;
});
+ patched = patched.replace(STYLE_URLS_INLINE_RE, (match, _quote, spec) => {
+ const cssFile = path.resolve(path.dirname(tsFile), spec);
+ const stripped = fs.existsSync(cssFile) && stripPackageCssImports(cssFile, packageCss);
+ return stripped ? `styleUrls: ['./${path.basename(stripped)}']` : match;
+ });
// Prepend @ts-nocheck so JIT-era demo code (never strictly typed) compiles under AOT.
patched = `// @ts-nocheck\n${patched}`;
const dest = patchedSiblingPath(tsFile);
@@ -526,14 +585,15 @@ function makeCompilerPlugin(createCompilerPlugin, tsconfig, fileReplacements) {
function prepareDemo(demo) {
const fileReplacements = {};
+ const packageCss = [];
for (const tsFile of findDemoTsFiles(path.join(demo.srcDir, 'app'))) {
- const patched = patchComponentTs(tsFile);
+ const patched = patchComponentTs(tsFile, packageCss);
if (patched) fileReplacements[tsFile] = patched;
}
const effectiveEntry = fileReplacements[demo.entry] || demo.entry;
const shimEntry = writeEntryShim(demo, effectiveEntry);
return {
- ...demo, effectiveEntry, shimEntry, fileReplacements,
+ ...demo, effectiveEntry, shimEntry, fileReplacements, packageCss,
};
}
@@ -706,7 +766,9 @@ async function bundleDemo(demo, createCompilerPlugin, destDirOverride) {
const cssFiles = outputs.filter((o) => o.endsWith('.css')).map((o) => path.basename(o));
- fs.writeFileSync(path.join(destDir, 'index.html'), buildHtml({ jsFiles: localJsFiles, cssFiles, srcDir: prepared.srcDir }));
+ fs.writeFileSync(path.join(destDir, 'index.html'), buildHtml({
+ jsFiles: localJsFiles, cssFiles, packageCss: prepared.packageCss, srcDir: prepared.srcDir,
+ }));
if (IS_GENERATE_MANIFESTS) writeDemoManifest(prepared, destDir);
return { ok: true };
}
@@ -746,7 +808,9 @@ async function bundleDemoBatch(batch, createCompilerPlugin) {
return { ok: false, reason: `no JS output produced for ${demo.widget}/${demo.name}` };
}
- fs.writeFileSync(path.join(destDir, 'index.html'), buildHtml({ jsFiles: localJsFiles, cssFiles, srcDir: demo.srcDir }));
+ fs.writeFileSync(path.join(destDir, 'index.html'), buildHtml({
+ jsFiles: localJsFiles, cssFiles, packageCss: demo.packageCss, srcDir: demo.srcDir,
+ }));
if (IS_GENERATE_MANIFESTS) writeDemoManifest(demo, destDir);
}
diff --git a/apps/demos/utils/server/demo-bundle.js b/apps/demos/utils/server/demo-bundle.js
index 186ec862fea2..29f2f460c0a0 100644
--- a/apps/demos/utils/server/demo-bundle.js
+++ b/apps/demos/utils/server/demo-bundle.js
@@ -4,7 +4,9 @@ const path = require('path');
const fs = require('fs');
const os = require('os');
const esbuild = require('esbuild');
-const { extractDemoHeadExtras, extractDemoBodyInner } = require('./demo-html');
+const {
+ extractDemoHeadExtras, extractDemoBodyInner, PACKAGE_CSS_RE, packageCssLinks,
+} = require('./demo-html');
const { virtualEntryPath, virtualEntryPlugin } = require('./demo-render-signal');
const { readShardConfig, applyShard: applyShardGeneric } = require('./shard');
@@ -86,6 +88,23 @@ const ignoreMissingCssPlugin = {
},
};
+// Leaves a package style sheet out of bundle.css and collects it for a before the theme.
+function packageCssPlugin(collected) {
+ return {
+ name: 'demo-bundle:package-css',
+ setup(build) {
+ build.onResolve({ filter: PACKAGE_CSS_RE }, (args) => {
+ if (!collected.includes(args.path)) collected.push(args.path);
+ return { path: args.path, namespace: 'demo-bundle-package-css' };
+ });
+ build.onLoad({ filter: /.*/, namespace: 'demo-bundle-package-css' }, () => ({
+ contents: '',
+ loader: 'css',
+ }));
+ },
+ };
+}
+
const ANTI_FORGERY_PATH = path.join(DEMOS_APP_ROOT, 'shared', 'anti-forgery', 'fetch-override.js');
const GLOBALIZE_BASE = path.join(NODE_MODULES, 'globalize', 'dist', 'globalize');
@@ -182,11 +201,14 @@ const DEFAULT_BODY_INNER = `
`;
function buildHtml({
- jsFile, cssFiles, srcDir, framework,
+ jsFile, cssFiles, packageCss = [], srcDir, framework,
}) {
+ const packageLinks = packageCssLinks(packageCss);
const headLinks = [
+ ...packageLinks,
'',
- ...extractDemoHeadExtras(srcDir),
+ // The demo's index.html is the page generated last time; its package links are already above.
+ ...extractDemoHeadExtras(srcDir).filter((tag) => !packageLinks.includes(tag)),
...cssFiles.map((f) => ``),
].join('\n ');
@@ -232,12 +254,13 @@ async function bundleDemoTo({ srcDir, destDir, framework }) {
fs.mkdirSync(destDir, { recursive: true });
let result;
+ const packageCss = [];
try {
const shared = getSharedOptions(framework);
result = await esbuild.build({
...shared,
entryPoints: [virtualEntryPath(entry)],
- plugins: [virtualEntryPlugin({ resolveDir: srcDir }), ...shared.plugins],
+ plugins: [virtualEntryPlugin({ resolveDir: srcDir }), packageCssPlugin(packageCss), ...shared.plugins],
outdir: destDir,
entryNames: 'bundle',
assetNames: 'bundle',
@@ -262,7 +285,9 @@ async function bundleDemoTo({ srcDir, destDir, framework }) {
if (IS_GENERATE_MANIFESTS) writeDemoManifest({ srcDir, destDir, framework });
- return { ok: true, jsFiles, cssFiles };
+ return {
+ ok: true, jsFiles, cssFiles, packageCss,
+ };
}
async function bundleDemo(demo, { destDir: destDirOverride, framework = FRAMEWORK } = {}) {
@@ -273,7 +298,7 @@ async function bundleDemo(demo, { destDir: destDirOverride, framework = FRAMEWOR
fs.writeFileSync(
path.join(destDir, 'index.html'),
buildHtml({
- jsFile: result.jsFiles[0], cssFiles: result.cssFiles, srcDir: demo.srcDir, framework,
+ jsFile: result.jsFiles[0], cssFiles: result.cssFiles, packageCss: result.packageCss, srcDir: demo.srcDir, framework,
}),
);
diff --git a/apps/demos/utils/server/demo-html.js b/apps/demos/utils/server/demo-html.js
index fbf92c869104..0100b77016e8 100644
--- a/apps/demos/utils/server/demo-html.js
+++ b/apps/demos/utils/server/demo-html.js
@@ -90,6 +90,20 @@ function extractDemoBodyInner(srcDir) {
return html ? extractBodyInner(html) : null;
}
+// A style sheet a demo imports from a package (`import 'ol/ol.css'`, `@import url('ol/ol.css')`).
+// The jQuery demos link such a sheet before the DevExtreme theme, so the generated pages link it
+// there too instead of bundling it after the theme: rules of equal specificity win by order.
+const PACKAGE_CSS_RE = /^[^./][^:]*\.css$/;
+
+function packageCssLinks(specifiers) {
+ return specifiers.map((specifier) => ``);
+}
+
module.exports = {
- extractHeadExtras, extractBodyInner, extractDemoHeadExtras, extractDemoBodyInner,
+ extractHeadExtras,
+ extractBodyInner,
+ extractDemoHeadExtras,
+ extractDemoBodyInner,
+ PACKAGE_CSS_RE,
+ packageCssLinks,
};
diff --git a/apps/demos/utils/tests/server/demo-html.test.js b/apps/demos/utils/tests/server/demo-html.test.js
index 81f1f3434a39..eb5c56ec1d90 100644
--- a/apps/demos/utils/tests/server/demo-html.test.js
+++ b/apps/demos/utils/tests/server/demo-html.test.js
@@ -1,6 +1,11 @@
const fs = require('fs');
const {
- extractHeadExtras, extractBodyInner, extractDemoHeadExtras, extractDemoBodyInner,
+ extractHeadExtras,
+ extractBodyInner,
+ extractDemoHeadExtras,
+ extractDemoBodyInner,
+ PACKAGE_CSS_RE,
+ packageCssLinks,
} = require('../../server/demo-html');
afterEach(() => {
@@ -88,3 +93,18 @@ test('does not read a file without a demo directory', () => {
expect(extractDemoBodyInner()).toBeNull();
expect(read).not.toHaveBeenCalled();
});
+
+test.each(['ol/ol.css', 'devextreme-dist/css/dx.light.css'])('treats %s as a package style sheet', (specifier) => {
+ expect(PACKAGE_CSS_RE.test(specifier)).toBe(true);
+});
+
+test.each(['./styles.css', '../shared/styles.css', '/styles.css', 'https://cdn.example.com/ol.css', 'ol/ol.js'])('does not treat %s as a package style sheet', (specifier) => {
+ expect(PACKAGE_CSS_RE.test(specifier)).toBe(false);
+});
+
+test('links package style sheets from node_modules of the demos app', () => {
+ expect(packageCssLinks(['ol/ol.css'])).toEqual([
+ '',
+ ]);
+ expect(packageCssLinks([])).toEqual([]);
+});
diff --git a/apps/demos/utils/visual-tests/playwright/demo-page.ts b/apps/demos/utils/visual-tests/playwright/demo-page.ts
index 227050b28a9d..2bb317998eaa 100644
--- a/apps/demos/utils/visual-tests/playwright/demo-page.ts
+++ b/apps/demos/utils/visual-tests/playwright/demo-page.ts
@@ -1,4 +1,4 @@
-import { readFileSync } from 'fs';
+import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
import type { Page, Request } from '@playwright/test';
import { applyTheme } from '../matrix-test-core';
@@ -17,6 +17,7 @@ declare global {
DevExpress?: { viz?: Record };
demoConsoleMessages: ConsoleMessage[];
demoSettled: () => Promise;
+ dxTestDisableVizAnimation: (widget: WidgetClass | undefined, name: string) => void;
}
}
@@ -71,15 +72,75 @@ const collectConsoleMessages = (): void => {
// drawn that way come out a few colour levels apart from run to run, so the tests switch the
// animation off: the widget is drawn once, in its final state. The listener is added before jQuery
// loads, so it runs ahead of the demo code.
-const disableVizAnimation = (): void => {
- document.addEventListener('DOMContentLoaded', () => {
- const viz = window.DevExpress?.viz;
+// The widgets whose start-up animation the tests switch off, by the file of their public module.
+const VIZ_WIDGETS: Record = {
+ chart: 'dxChart',
+ pie_chart: 'dxPieChart',
+ polar_chart: 'dxPolarChart',
+ circular_gauge: 'dxCircularGauge',
+ linear_gauge: 'dxLinearGauge',
+ bar_gauge: 'dxBarGauge',
+ range_selector: 'dxRangeSelector',
+};
+
+interface VendorVizWidgets {
+ globalVar: string;
+ // [key of the module in the vendor global, widget name]
+ widgets: [string, string][];
+}
+
+// React and Vue demos take devextreme from a vendor bundle shared by all demos. Its global holds
+// every module of the bundle under the key its manifest lists, so the widget classes the demo will
+// use are reachable without window.DevExpress.
+export function getVendorVizWidgets(framework: string): VendorVizWidgets | null {
+ const manifestPath = join(__dirname, '..', '..', '..', 'bundles', 'vendor', `${framework.toLowerCase()}.manifest.json`);
+
+ if (!existsSync(manifestPath)) {
+ return null;
+ }
+
+ const { globalVar, coverage } = JSON.parse(readFileSync(manifestPath, 'utf8')) as {
+ globalVar: string;
+ coverage: [string, string][];
+ };
+ const widgets = coverage.flatMap(([file, key]): [string, string][] => {
+ const name = /[\\/]esm[\\/]viz[\\/](\w+)\.js$/.exec(file)?.[1];
+
+ return name && VIZ_WIDGETS[name] ? [[key, VIZ_WIDGETS[name]]] : [];
+ });
+
+ return { globalVar, widgets };
+}
+
+const disableVizAnimation = (vendor: VendorVizWidgets | null, names: string[]): void => {
+ const disable = (widget: WidgetClass | undefined, name: string): void => {
+ widget?.defaultOptions({
+ options: name === 'dxRangeSelector'
+ ? { behavior: { animationEnabled: false } }
+ : { animation: { enabled: false } },
+ });
+ };
+
+ // An Angular demo bundle calls it for the widgets it uses before the demo renders.
+ window.dxTestDisableVizAnimation = disable;
- ['dxChart', 'dxPieChart', 'dxPolarChart', 'dxCircularGauge', 'dxLinearGauge', 'dxBarGauge'].forEach((name) => {
- viz?.[name]?.defaultOptions({ options: { animation: { enabled: false } } });
+ // The vendor script assigns its global before the demo bundle runs.
+ if (vendor) {
+ let modules: Record | undefined;
+
+ Object.defineProperty(window, vendor.globalVar, {
+ configurable: true,
+ get: () => modules,
+ set: (value: typeof modules) => {
+ modules = value;
+ vendor.widgets.forEach(([key, name]) => disable(modules?.[key]?.default, name));
+ },
});
+ }
- viz?.dxRangeSelector?.defaultOptions({ options: { behavior: { animationEnabled: false } } });
+ // A jQuery demo takes the widgets from dx.all.js, which exposes them on window.DevExpress.
+ document.addEventListener('DOMContentLoaded', () => {
+ names.forEach((name) => disable(window.DevExpress?.viz?.[name], name));
});
};
@@ -128,15 +189,43 @@ const trackPageSettling = (): void => {
});
};
+// Demos that generate their data with Math.random() draw the same picture only if they get the
+// same numbers. The seeded random of Chrome gives a sequence, but which numbers a demo gets depends
+// on how many calls the framework and DevExtreme (guids) made before it, and that differs between
+// frameworks. So every call site gets its own counter, and its n-th call returns the n-th number.
+const makeRandomDeterministic = (): void => {
+ const calls = new Map();
+
+ Math.random = (): number => {
+ const site = new Error().stack?.split('\n')[2] ?? '';
+ const index = calls.get(site) ?? 0;
+
+ calls.set(site, index + 1);
+
+ // A 32-bit integer hash of the index (mulberry32), scaled to [0, 1).
+ let t = (index + 0x6D2B79F5) | 0;
+ t = Math.imul(t ^ (t >>> 15), t | 1);
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
+
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+};
+
// One script instead of several: a demo script may use MockDate and testUtils, and the order of
// separate init scripts is not guaranteed.
-const getInitScript = (clientScript: string | null): string => [
+const getInitScript = (
+ clientScript: string | null,
+ testGlobals: string | null,
+ vendor: VendorVizWidgets | null,
+): string => [
+ `(${makeRandomDeterministic.toString()})();`,
`(function () { ${MOCKDATE_SOURCE} }).call(window);`,
+ testGlobals ?? '',
`(function () { ${TEST_UTILS_SOURCE} })();`,
`(${addTestStyles.toString()})(${JSON.stringify(TEST_STYLES)});`,
`(${collectConsoleMessages.toString()})();`,
`(${trackPageSettling.toString()})();`,
- `(${disableVizAnimation.toString()})();`,
+ `(${disableVizAnimation.toString()})(${JSON.stringify(vendor)}, ${JSON.stringify(Object.values(VIZ_WIDGETS))});`,
clientScript ?? '',
].join('\n');
@@ -145,8 +234,10 @@ export async function prepareDemoPage(
url: string,
theme: string,
clientScript: string | null,
+ testGlobals: string | null = null,
+ vendor: VendorVizWidgets | null = null,
): Promise {
- await page.addInitScript({ content: getInitScript(clientScript) });
+ await page.addInitScript({ content: getInitScript(clientScript, testGlobals, vendor) });
await page.route((requestUrl) => requestUrl.href === url, async (route) => {
const response = await route.fetch();
@@ -198,6 +289,12 @@ export async function openDemo(
await page.waitForFunction(() => Array
.from(document.querySelectorAll('link[rel="stylesheet"]'))
.every((link) => link.sheet !== null));
+
+ // An Angular demo shows "Loading..." in until the application has bootstrapped.
+ if (await page.locator('demo-app').count()) {
+ await page.waitForFunction(() => document.querySelector('demo-app')?.innerText !== 'Loading...');
+ await waitForIdle();
+ }
}
export async function runTestCode(page: Page, code: string): Promise {