0e386b3b92
Implements the new Node Families E2E testing strategy, shifting the primary Playwright suite from Storybook iframes to a dedicated mock-wired app shell (`main.mock.html`). This provides higher-fidelity testing against the actual wallet UI and router without a Tauri runtime or login. Also introduces an optional WebdriverIO + `tauri-driver` suite for native WebKitGTK webview validation, configured as a non-blocking CI job for Linux. A critical fix for `NymCard`'s `data-testid` prop is included to enable robust UI selectors across all E2E tiers. Updates CI workflows, adds new scripts for mock builds and native tests, and provides comprehensive documentation in `e2e/README.md` for the tiered testing approach.
81 lines
2.7 KiB
JavaScript
81 lines
2.7 KiB
JavaScript
const { mergeWithRules } = require('webpack-merge');
|
|
const webpack = require('webpack');
|
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
const ReactRefreshTypeScript = require('react-refresh-typescript');
|
|
const commonConfig = require('./webpack.common');
|
|
|
|
// The mock-wired e2e build (WALLET_MOCK_FAMILIES=on) is driven by Playwright, which reloads
|
|
// pages itself — it doesn't need (or want) React Fast Refresh / HMR. Skipping it also avoids
|
|
// the HMR client's `core-js-pure` polyfill requirement. See e2e/README.md.
|
|
const MOCK_FAMILIES = process.env.WALLET_MOCK_FAMILIES === 'on';
|
|
|
|
module.exports = mergeWithRules({
|
|
module: {
|
|
rules: {
|
|
test: 'match',
|
|
use: 'replace',
|
|
},
|
|
},
|
|
})(commonConfig, {
|
|
mode: 'development',
|
|
devtool: 'inline-source-map',
|
|
// The mock e2e build runs in development mode, where some deps (e.g. prop-types) use a
|
|
// `require('object-assign')`-style transitive. webpack.common sets `resolve.modules` to
|
|
// absolute dirs only, which disables the normal per-module node_modules walk and breaks
|
|
// pnpm's nested symlinks. Re-add the relative walk so those resolve. (Merged/appended.)
|
|
...(MOCK_FAMILIES ? { resolve: { modules: ['node_modules'] } } : {}),
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
options: {
|
|
getCustomTransformers: () => ({
|
|
before: MOCK_FAMILIES ? [] : [ReactRefreshTypeScript()],
|
|
}),
|
|
// `ts-loader` does not work with HMR unless `transpileOnly` is used.
|
|
// If you need type checking, `ForkTsCheckerWebpackPlugin` is an alternative.
|
|
transpileOnly: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: MOCK_FAMILIES
|
|
? []
|
|
: [
|
|
new ReactRefreshWebpackPlugin(),
|
|
|
|
// this can be included automatically by the dev server, however build mode fails if missing
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
],
|
|
|
|
// recommended for faster rebuild
|
|
optimization: {
|
|
runtimeChunk: true,
|
|
removeAvailableModules: false,
|
|
removeEmptyChunks: false,
|
|
splitChunks: false,
|
|
},
|
|
|
|
cache: {
|
|
type: 'filesystem',
|
|
buildDependencies: {
|
|
// restart on config change
|
|
config: ['./webpack.dev.js'],
|
|
},
|
|
},
|
|
|
|
devServer: {
|
|
port: 9000,
|
|
compress: true,
|
|
historyApiFallback: true,
|
|
// Mock e2e: serve a static bundle only — no HMR, no live-reload client injection
|
|
// (Playwright drives reloads). This also avoids the dev-server client's transitive deps.
|
|
hot: !MOCK_FAMILIES,
|
|
liveReload: !MOCK_FAMILIES,
|
|
webSocketServer: MOCK_FAMILIES ? false : undefined,
|
|
client: MOCK_FAMILIES ? false : { overlay: false },
|
|
},
|
|
});
|