Commit 9f2da8b0 authored by tom's avatar tom

fix tests (hopefully)

parent 53de21d4
...@@ -38,7 +38,8 @@ export function middleware(req: NextRequest) { ...@@ -38,7 +38,8 @@ export function middleware(req: NextRequest) {
* Configure which routes should pass through the Middleware. * Configure which routes should pass through the Middleware.
*/ */
export const config = { export const config = {
matcher: [ matcher: [ '/', '/:notunderscore((?!_next).+)' ],
'/((?!.*\\.|api\\/|node-api\\/).*)', // exclude all static + api + node-api routes // matcher: [
], // '/((?!.*\\.|api\\/|node-api\\/).*)', // exclude all static + api + node-api routes
// ],
}; };
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"lint:tsc": "./node_modules/.bin/tsc -p ./tsconfig.json", "lint:tsc": "./node_modules/.bin/tsc -p ./tsconfig.json",
"prepare": "husky install", "prepare": "husky install",
"format-svg": "./node_modules/.bin/svgo -r ./icons", "format-svg": "./node_modules/.bin/svgo -r ./icons",
"test:pw": "./playwright/make-envs-script.sh && NODE_OPTIONS=\"--max-old-space-size=6144\" playwright test -c playwright-ct.config.ts", "test:pw": "./playwright/make-envs-script.sh && NODE_OPTIONS=\"--max-old-space-size=4096\" playwright test -c playwright-ct.config.ts",
"test:pw:local": "export NODE_PATH=$(pwd)/node_modules && yarn test:pw", "test:pw:local": "export NODE_PATH=$(pwd)/node_modules && yarn test:pw",
"test:pw:docker": "docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.28.0-focal ./playwright/run-tests.sh", "test:pw:docker": "docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.28.0-focal ./playwright/run-tests.sh",
"test:jest": "jest", "test:jest": "jest",
......
...@@ -56,9 +56,6 @@ const config: PlaywrightTestConfig = { ...@@ -56,9 +56,6 @@ const config: PlaywrightTestConfig = {
// https://github.com/storybookjs/builder-vite/issues/409#issuecomment-1152848986 // https://github.com/storybookjs/builder-vite/issues/409#issuecomment-1152848986
sourcemap: false, sourcemap: false,
minify: false, minify: false,
rollupOptions: {
cache: false,
},
}, },
}, },
}, },
......
...@@ -54,7 +54,7 @@ const formConfig: SmartContractVerificationConfig = { ...@@ -54,7 +54,7 @@ const formConfig: SmartContractVerificationConfig = {
], ],
}; };
test.skip('flatten source code method +@dark-mode +@mobile', async({ mount, page }) => { test('flatten source code method +@dark-mode +@mobile', async({ mount, page }) => {
const component = await mount( const component = await mount(
<TestApp> <TestApp>
<ContractVerificationForm config={ formConfig } hash={ hash }/> <ContractVerificationForm config={ formConfig } hash={ hash }/>
...@@ -90,9 +90,9 @@ test.describe('sourcify', () => { ...@@ -90,9 +90,9 @@ test.describe('sourcify', () => {
const testWithSocket = test.extend<socketServer.SocketServerFixture>({ const testWithSocket = test.extend<socketServer.SocketServerFixture>({
createSocket: socketServer.createSocket, createSocket: socketServer.createSocket,
}); });
testWithSocket.describe.configure({ mode: 'serial' }); testWithSocket.describe.configure({ mode: 'serial', timeout: 20_000 });
testWithSocket.skip('with multiple contracts', async({ mount, page, createSocket }) => { testWithSocket('with multiple contracts +@mobile', async({ mount, page, createSocket }) => {
const component = await mount( const component = await mount(
<TestApp withSocket> <TestApp withSocket>
<ContractVerificationForm config={ formConfig } hash={ hash }/> <ContractVerificationForm config={ formConfig } hash={ hash }/>
......
...@@ -11,7 +11,8 @@ import FancySelect from 'ui/shared/FancySelect/FancySelect'; ...@@ -11,7 +11,8 @@ import FancySelect from 'ui/shared/FancySelect/FancySelect';
import ContractVerificationFormRow from '../ContractVerificationFormRow'; import ContractVerificationFormRow from '../ContractVerificationFormRow';
const SOURCIFY_ERROR_REGEXP = /(?<=\bcontracts\s\([^()]*)\w+/gi; // const SOURCIFY_ERROR_REGEXP = /(?<=\bcontracts\s\([^()]*)\w+/gi;
const SOURCIFY_ERROR_REGEXP = /\(([^()]*)\)/;
const ContractVerificationFieldContractIndex = () => { const ContractVerificationFieldContractIndex = () => {
const [ options, setOptions ] = React.useState<Array<Option>>([]); const [ options, setOptions ] = React.useState<Array<Option>>([]);
...@@ -26,7 +27,8 @@ const ContractVerificationFieldContractIndex = () => { ...@@ -26,7 +27,8 @@ const ContractVerificationFieldContractIndex = () => {
return; return;
} }
const parsedMethods = sourcesError.match(SOURCIFY_ERROR_REGEXP); const matchResult = sourcesError.match(SOURCIFY_ERROR_REGEXP);
const parsedMethods = matchResult?.[1].split(',');
if (!Array.isArray(parsedMethods) || parsedMethods.length === 0) { if (!Array.isArray(parsedMethods) || parsedMethods.length === 0) {
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment