scrabble-solver 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/bunx.yml +13 -10
- package/.github/workflows/e2e.yml +7 -9
- package/.github/workflows/npx.yml +13 -10
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +591 -587
- package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
- package/.nx/workspace-data/lockfile-nodes.hash +1 -1
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/parsed-lock-file.dependencies.json +212 -1317
- package/.nx/workspace-data/parsed-lock-file.nodes.json +758 -2693
- package/.nx/workspace-data/project-graph.json +1015 -4140
- package/.nx/workspace-data/source-maps.json +32 -0
- package/.oxlintrc.json +8 -11
- package/CLAUDE.md +18 -15
- package/README.md +8 -1
- package/bun.lock +230 -499
- package/e2e/app.spec.ts +124 -0
- package/e2e/bugs/112-character-bonus.spec.ts +25 -0
- package/e2e/bugs/129-esc-sidebar.spec.ts +17 -0
- package/e2e/bugs/2-q-tile-in-english.spec.ts +19 -0
- package/e2e/bugs/3-x-tile-in-polish.spec.ts +19 -0
- package/e2e/bugs/30-click-inside-radio-icon.spec.ts +25 -0
- package/e2e/bugs/333-disabled-radio-cursor.spec.ts +18 -0
- package/e2e/bugs/342-results-sorting.spec.ts +30 -0
- package/e2e/bugs/352-dictionary-race-condition.spec.ts +27 -0
- package/e2e/bugs/363-dictionary-input-unique-words.spec.ts +27 -0
- package/e2e/bugs/380-transliteration-when-pasting.spec.ts +55 -0
- package/e2e/bugs/398-digraphs-in-created-words.spec.ts +23 -0
- package/e2e/bugs/401-board-state-on-game-change.spec.ts +24 -0
- package/e2e/features/198-highlight-unreachable-cells.spec.ts +85 -0
- package/e2e/features/91-hover-remaining-tile-highlights.spec.ts +76 -0
- package/e2e/features/hidden-coordinates-migration.spec.ts +27 -0
- package/e2e/features/solver-paths.spec.ts +45 -0
- package/e2e/lib/actions.ts +119 -0
- package/e2e/lib/selectors.ts +71 -0
- package/e2e/tsconfig.json +10 -0
- package/lerna.json +1 -1
- package/package.json +14 -17
- package/packages/configs/package.json +3 -3
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +22 -20
- package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
- package/packages/scrabble-solver/.next/dynamic-css-manifest.json +8 -1
- package/packages/scrabble-solver/.next/next-minimal-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
- package/packages/scrabble-solver/.next/react-loadable-manifest.json +176 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/309.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/{785.js → 316.js} +1 -1
- package/packages/scrabble-solver/.next/server/chunks/344.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/371.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/465.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/546.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/623.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/624.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/641.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/671.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/692.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/705.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/846.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/853.js +15 -0
- package/packages/scrabble-solver/.next/server/chunks/886.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/916.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/953.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/961.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/968.js +1 -0
- package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +28 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +28 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js +28 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +28 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +28 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +30 -1
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/not-found.html +28 -1
- package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/webpack-api-runtime.js +1 -1
- package/packages/scrabble-solver/.next/server/webpack-runtime.js +1 -1
- package/packages/scrabble-solver/.next/static/FL82obwzFHRzvV6z76I-U/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/101-829ab8a8d310e7a0.js +3 -0
- package/packages/scrabble-solver/.next/static/chunks/106.e414e88694add27f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/127.125d896a19061d71.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/18.8b91e137d239e15c.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/277.6785dfaf22fdb0b7.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/307.67f52f13e3d60d4e.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/341.79535ba85bf1986f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/363.01eed3233f92b6a4.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/422.1559ae6756912ca5.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/541.dcd9e8b804f88da5.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/631.98d42abad0a60af6.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/663.d2c9ca36b26695b8.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/711.ba7b8f900dfd40d0.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/744.b06c9a3de4a1d877.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/820.97b82f751ca49579.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/865.a9b563a45848a83c.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/912.ff8037ba9d4db5c8.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/939.19b33a3d3c351d73.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/990.61296e5870b91f11.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/framework-626cbd48ac5aca57.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/main-b92e08f3fc96dd8d.js +5 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-ba5d628e81a15461.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/{_error-afeda7c5231b6c3c.js → _error-f0290a98eb3ed0ec.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-5f9fa6ac3cd3d97b.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/not-found-23d61fd3ed791cad.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack-e34c3ae12275e978.js +1 -0
- package/packages/scrabble-solver/.next/static/css/2d03f0da2c678dfc.css +1 -0
- package/packages/scrabble-solver/.next/static/css/7b6724d2df70f48f.css +1 -0
- package/packages/scrabble-solver/.next/static/css/abc2425d3ba607bc.css +1 -0
- package/packages/scrabble-solver/.next/static/css/b736be3bd02b5d99.css +1 -0
- package/packages/scrabble-solver/.next/static/css/b74cd7de82dabcdd.css +1 -0
- package/packages/scrabble-solver/.next/static/css/c403ce739a9c0d83.css +1 -0
- package/packages/scrabble-solver/.next/static/css/ca311e6c030663d4.css +1 -0
- package/packages/scrabble-solver/.next/static/css/dee878eb64099d92.css +1 -0
- package/packages/scrabble-solver/.next/static/css/fbfdce70731d0d2b.css +1 -0
- package/packages/scrabble-solver/.next/trace +21 -21
- package/packages/scrabble-solver/.next/trace-build +1 -1
- package/packages/scrabble-solver/empty-module.js +2 -0
- package/packages/scrabble-solver/next.config.js +13 -2
- package/packages/scrabble-solver/package.json +33 -14
- package/packages/scrabble-solver/public/llms.txt +11 -0
- package/packages/scrabble-solver/public/robots.txt +4 -0
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/scripts/generate-scss-types.ts +112 -0
- package/packages/scrabble-solver/src/@types/scss.d.ts +6 -9
- package/packages/scrabble-solver/src/@types/svg.d.ts +1 -1
- package/packages/scrabble-solver/src/components/Alert/Alert.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/Alert/Alert.tsx +4 -1
- package/packages/scrabble-solver/src/components/Badge/Badge.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +10 -0
- package/packages/scrabble-solver/src/components/Board/Board.module.scss.d.ts +17 -0
- package/packages/scrabble-solver/src/components/Board/Board.tsx +14 -26
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +54 -49
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss +18 -18
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.tsx +6 -3
- package/packages/scrabble-solver/src/components/Board/components/Actions/lib.ts +3 -1
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +28 -33
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.tsx +1 -1
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +2 -2
- package/packages/scrabble-solver/src/components/Board/getBoardBackground.ts +175 -0
- package/packages/scrabble-solver/src/components/Board/hooks/index.ts +0 -1
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +10 -20
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingActions.ts +3 -6
- package/packages/scrabble-solver/src/components/Board/hooks/useGrid.ts +6 -3
- package/packages/scrabble-solver/src/components/Board/selectors.ts +1 -1
- package/packages/scrabble-solver/src/components/Button/Button.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss +1 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss.d.ts +14 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +1 -3
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.tsx +1 -1
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.tsx +1 -1
- package/packages/scrabble-solver/src/components/IconButton/IconButton.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/components/Key/Key.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.tsx +4 -1
- package/packages/scrabble-solver/src/components/Keys/index.tsx +1 -1
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/components/Loading/Loading.tsx +1 -1
- package/packages/scrabble-solver/src/components/Logo/Logo.tsx +4 -9
- package/packages/scrabble-solver/src/components/Logo/LogoBlueprint.tsx +1 -0
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss.d.ts +15 -0
- package/packages/scrabble-solver/src/components/Modal/Modal.tsx +16 -3
- package/packages/scrabble-solver/src/components/Modal/components/Section/Section.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.module.scss +20 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +29 -45
- package/packages/scrabble-solver/src/components/NotFound/NotFound.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/components/NotFound/NotFound.tsx +1 -1
- package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.tsx +0 -1
- package/packages/scrabble-solver/src/components/PlainTiles/Tile.tsx +3 -4
- package/packages/scrabble-solver/src/components/PlainTiles/lib.ts +4 -19
- package/packages/scrabble-solver/src/components/PlainTiles/types.ts +0 -1
- package/packages/scrabble-solver/src/components/Progress/Progress.module.scss +7 -0
- package/packages/scrabble-solver/src/components/Progress/Progress.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Progress/Progress.tsx +2 -11
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss +3 -0
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Rack/Rack.tsx +8 -11
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss +2 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.tsx +1 -13
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/lib.ts +1 -1
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.tsx +5 -4
- package/packages/scrabble-solver/src/components/Rack/selectors.ts +1 -1
- package/packages/scrabble-solver/src/components/Radio/Radio.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/components/Results/Cell.tsx +3 -12
- package/packages/scrabble-solver/src/components/Results/Header.tsx +9 -18
- package/packages/scrabble-solver/src/components/Results/HeaderButton.tsx +4 -5
- package/packages/scrabble-solver/src/components/Results/Result.tsx +4 -12
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +4 -6
- package/packages/scrabble-solver/src/components/Results/Results.module.scss.d.ts +27 -0
- package/packages/scrabble-solver/src/components/Results/Results.tsx +4 -3
- package/packages/scrabble-solver/src/components/Results/SolveButton.tsx +1 -1
- package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.tsx +1 -1
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +6 -5
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss.d.ts +20 -0
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +19 -21
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/InsertButton.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/InsertButton.tsx +1 -1
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss.d.ts +18 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +3 -1
- package/packages/scrabble-solver/src/components/Spinner/Spinner.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +3 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss.d.ts +19 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.tsx +5 -14
- package/packages/scrabble-solver/src/components/Tile/TilePure.tsx +2 -12
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.tsx +14 -3
- package/packages/scrabble-solver/src/components/Tooltip/useTooltip.ts +1 -0
- package/packages/scrabble-solver/src/hooks/useColumns.ts +4 -7
- package/packages/scrabble-solver/src/hooks/useDeferredRender.ts +20 -0
- package/packages/scrabble-solver/src/hooks/useDirection.ts +4 -3
- package/packages/scrabble-solver/src/hooks/useLanguage.ts +2 -2
- package/packages/scrabble-solver/src/hooks/useLocalStorage.ts +32 -8
- package/packages/scrabble-solver/src/hooks/useMedia.ts +26 -26
- package/packages/scrabble-solver/src/i18n/constants.ts +2 -15
- package/packages/scrabble-solver/src/i18n/i18n.ts +18 -17
- package/packages/scrabble-solver/src/i18n/languages/english.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/french.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/german.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/persian.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/polish.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/romanian.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/spanish.json +0 -1
- package/packages/scrabble-solver/src/i18n/languages/turkish.json +0 -1
- package/packages/scrabble-solver/src/i18n/localeIcons.ts +24 -0
- package/packages/scrabble-solver/src/lib/localeTransliterate.test.ts +5 -0
- package/packages/scrabble-solver/src/lib/localeTransliterate.ts +26 -6
- package/packages/scrabble-solver/src/lib/waitForIdleOrFirstIntent.ts +33 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.tsx +3 -1
- package/packages/scrabble-solver/src/modals/KeyMapModal/KeyMapModal.tsx +3 -1
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss +5 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.tsx +16 -5
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss +4 -1
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +4 -6
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.module.scss +1 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +5 -12
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +8 -4
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/HighlightUnreachableCellsSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/HighlightUnreachableCellsSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +24 -21
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/RemoveCellFiltersSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/RemoveCellFiltersSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.tsx +1 -5
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +4 -2
- package/packages/scrabble-solver/src/modals/preload.ts +24 -0
- package/packages/scrabble-solver/src/pages/_app.tsx +5 -8
- package/packages/scrabble-solver/src/pages/_document.tsx +91 -5
- package/packages/scrabble-solver/src/pages/api/solve.ts +1 -1
- package/packages/scrabble-solver/src/pages/index.module.scss +1 -0
- package/packages/scrabble-solver/src/pages/index.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/pages/index.tsx +98 -38
- package/packages/scrabble-solver/src/pages/not-found.tsx +1 -1
- package/packages/scrabble-solver/src/parameters/index.ts +24 -93
- package/packages/scrabble-solver/src/serviceWorkerManager.ts +5 -2
- package/packages/scrabble-solver/src/state/actions.ts +1 -1
- package/packages/scrabble-solver/src/state/app/index.ts +4 -0
- package/packages/scrabble-solver/src/state/app/initialState.ts +6 -0
- package/packages/scrabble-solver/src/state/app/selectors.ts +5 -0
- package/packages/scrabble-solver/src/state/app/slice.ts +20 -0
- package/packages/scrabble-solver/src/state/app/types.ts +4 -0
- package/packages/scrabble-solver/src/state/board/initialState.ts +1 -2
- package/packages/scrabble-solver/src/state/i18n/index.ts +4 -0
- package/packages/scrabble-solver/src/state/i18n/initialState.ts +5 -0
- package/packages/scrabble-solver/src/state/i18n/selectors.ts +3 -0
- package/packages/scrabble-solver/src/state/i18n/slice.ts +16 -0
- package/packages/scrabble-solver/src/state/i18n/types.ts +7 -0
- package/packages/scrabble-solver/src/state/index.ts +2 -0
- package/packages/scrabble-solver/src/state/lib.ts +1 -1
- package/packages/scrabble-solver/src/state/localStorage.ts +86 -29
- package/packages/scrabble-solver/src/state/rack/initialState.ts +1 -2
- package/packages/scrabble-solver/src/state/rack/slice.ts +4 -1
- package/packages/scrabble-solver/src/state/results/lib.ts +5 -5
- package/packages/scrabble-solver/src/state/results/selectors.ts +1 -1
- package/packages/scrabble-solver/src/state/sagas.ts +125 -9
- package/packages/scrabble-solver/src/state/selectors.ts +1 -1
- package/packages/scrabble-solver/src/state/settings/initialState.ts +7 -10
- package/packages/scrabble-solver/src/state/settings/selectors.ts +7 -2
- package/packages/scrabble-solver/src/state/settings/slice.ts +5 -2
- package/packages/scrabble-solver/src/state/store.ts +4 -0
- package/packages/scrabble-solver/src/state/types.ts +4 -0
- package/packages/scrabble-solver/src/styles/_tokens.scss +1 -0
- package/packages/scrabble-solver/src/styles/global.scss +9 -0
- package/packages/scrabble-solver/src/styles/variables.module.scss +0 -21
- package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +27 -0
- package/packages/scrabble-solver/src/styles/variables.scss +46 -2
- package/packages/scrabble-solver/src/types/index.ts +1 -2
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
- package/packages/solver/package.json +5 -5
- package/packages/types/build/Direction.d.ts +1 -0
- package/packages/types/build/Direction.js +2 -0
- package/packages/types/build/ShowCoordinates.d.ts +1 -2
- package/packages/types/build/TextDirection.d.ts +1 -0
- package/packages/types/build/TextDirection.js +2 -0
- package/packages/types/build/index.d.ts +2 -0
- package/packages/types/package.json +2 -2
- package/packages/types/src/Direction.ts +1 -0
- package/packages/types/src/ShowCoordinates.ts +1 -2
- package/packages/types/src/TextDirection.ts +1 -0
- package/packages/types/src/index.ts +2 -0
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package.json +2 -2
- package/playwright-report/index.html +49 -0
- package/playwright.config.ts +30 -0
- package/screencast.gif +0 -0
- package/scripts/record-screencast.ts +347 -0
- package/test-results/.last-run.json +4 -0
- package/tsconfig.json +1 -1
- package/babel.config.js +0 -4
- package/cypress/e2e/app.spec.cy.ts +0 -123
- package/cypress/e2e/bugs/112-character-bonus.ts +0 -40
- package/cypress/e2e/bugs/129-esc-sidebar.ts +0 -23
- package/cypress/e2e/bugs/2-q-tile-in-english.ts +0 -33
- package/cypress/e2e/bugs/3-x-tile-in-polish.ts +0 -33
- package/cypress/e2e/bugs/30-click-inside-radio-icon.ts +0 -26
- package/cypress/e2e/bugs/333-disabled-radio-cursor.ts +0 -24
- package/cypress/e2e/bugs/342-results-sorting.ts +0 -48
- package/cypress/e2e/bugs/348-results-word-padding.ts +0 -74
- package/cypress/e2e/bugs/352-dictionary-race-condition.ts +0 -29
- package/cypress/e2e/bugs/363-dictionary-input-unique-words.ts +0 -41
- package/cypress/e2e/bugs/380-transliteration-when-pasting.ts +0 -75
- package/cypress/e2e/bugs/398-digraphs-in-created-words.ts +0 -38
- package/cypress/e2e/bugs/401-board-state-on-game-change.ts +0 -36
- package/cypress/e2e/bugs.spec.cy.ts +0 -13
- package/cypress/e2e/features/198-highlight-unreachable-cells.ts +0 -101
- package/cypress/e2e/features/91-hover-remaining-tile-highlights.ts +0 -90
- package/cypress/e2e/features/solver-paths.ts +0 -66
- package/cypress/e2e/features.spec.cy.ts +0 -3
- package/cypress/support/commands.ts +0 -4
- package/cypress/support/e2e.ts +0 -1
- package/cypress/support/index.ts +0 -1
- package/cypress/support/lib/actions.ts +0 -104
- package/cypress/support/lib/selectors.ts +0 -70
- package/cypress/tsconfig.json +0 -10
- package/cypress.config.ts +0 -17
- package/packages/scrabble-solver/.next/server/chunks/129.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/318.js +0 -3
- package/packages/scrabble-solver/.next/server/chunks/791.js +0 -15
- package/packages/scrabble-solver/.next/static/OLE8_ZInlGH7ENU0NIOpf/_buildManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/830.661816bf0de8c2f1.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/framework-3cf15b8041c59dd3.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/main-5b999f3f24ebfa84.js +0 -5
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-7024e7a27ffbb2fa.js +0 -7
- package/packages/scrabble-solver/.next/static/chunks/pages/index-8b398b0a5d870773.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/not-found-9e076427bad69d90.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/webpack-3943d624bbb47a64.js +0 -1
- package/packages/scrabble-solver/.next/static/css/a78e04fe95452380.css +0 -1
- package/packages/scrabble-solver/.next/static/css/aedeaada218d7280.css +0 -2
- package/packages/scrabble-solver/src/app-layout/AppLayoutContext.tsx +0 -25
- package/packages/scrabble-solver/src/app-layout/index.ts +0 -1
- package/packages/scrabble-solver/src/app-layout/useAppLayoutValue.ts +0 -112
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +0 -279
- package/packages/scrabble-solver/src/components/index.ts +0 -26
- package/packages/scrabble-solver/src/hooks/index.ts +0 -12
- package/packages/scrabble-solver/src/hooks/useOnWindowResize.ts +0 -11
- package/packages/scrabble-solver/src/hooks/useViewportSize.ts +0 -17
- package/packages/scrabble-solver/src/i18n/index.ts +0 -2
- package/packages/scrabble-solver/src/icons/Flag.svg +0 -4
- package/packages/scrabble-solver/src/icons/Star.svg +0 -4
- package/packages/scrabble-solver/src/icons/index.ts +0 -49
- package/packages/scrabble-solver/src/lib/getTileSizes.ts +0 -13
- package/packages/scrabble-solver/src/lib/index.ts +0 -24
- package/packages/scrabble-solver/src/modals/index.ts +0 -7
- /package/{cypress/support → e2e}/lib/index.ts +0 -0
- /package/packages/scrabble-solver/.next/static/{OLE8_ZInlGH7ENU0NIOpf → FL82obwzFHRzvV6z76I-U}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-restricted-exports
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
expect: {
|
|
6
|
+
timeout: 10_000,
|
|
7
|
+
},
|
|
8
|
+
forbidOnly: Boolean(process.env.CI),
|
|
9
|
+
fullyParallel: true,
|
|
10
|
+
projects: [
|
|
11
|
+
{
|
|
12
|
+
name: 'chromium',
|
|
13
|
+
use: {
|
|
14
|
+
...devices['Desktop Chrome'],
|
|
15
|
+
viewport: { height: 900, width: 1440 },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
reporter: [['list'], ['html', { open: 'never' }]],
|
|
20
|
+
retries: process.env.CI ? 2 : 0,
|
|
21
|
+
testDir: './e2e',
|
|
22
|
+
timeout: 120_000,
|
|
23
|
+
use: {
|
|
24
|
+
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000',
|
|
25
|
+
screenshot: 'only-on-failure',
|
|
26
|
+
serviceWorkers: 'block',
|
|
27
|
+
trace: 'retain-on-failure',
|
|
28
|
+
},
|
|
29
|
+
workers: process.env.CI ? 2 : undefined,
|
|
30
|
+
});
|
package/screencast.gif
CHANGED
|
Binary file
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regenerates screencast.gif by replaying the oxyphenbutazone scenario in a real browser.
|
|
3
|
+
* Requires the app running at BASE_URL (default http://localhost:3333) - `bun run screencast` boots it.
|
|
4
|
+
*/
|
|
5
|
+
import { type BrowserContext, chromium, type Locator, type Page } from '@playwright/test';
|
|
6
|
+
import { Board } from '@scrabble-solver/types';
|
|
7
|
+
import { execFileSync } from 'node:child_process';
|
|
8
|
+
import { linkSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
|
|
13
|
+
interface Point {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface CapturedFrame {
|
|
19
|
+
file: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const BASE_URL = process.env.BASE_URL ?? 'http://localhost:3333';
|
|
24
|
+
const LOCALE = 'en-GB';
|
|
25
|
+
const WIDTH = 1680;
|
|
26
|
+
const HEIGHT = 1233;
|
|
27
|
+
const CAPTURE_SCALE = 2;
|
|
28
|
+
const FPS = 15;
|
|
29
|
+
const RACK = 'oypbaze';
|
|
30
|
+
const TARGET_WORD = 'oxyphenbutazone';
|
|
31
|
+
const DEFINITIONS_TO_PLACEMENT_DELAY = 1200;
|
|
32
|
+
const DEFINITIONS_REQUEST_DELAY = 1000;
|
|
33
|
+
const CURSOR_START: Point = { x: 1478, y: 1154 };
|
|
34
|
+
const OUTPUT_FILE = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'screencast.gif');
|
|
35
|
+
|
|
36
|
+
await recordScreencast();
|
|
37
|
+
|
|
38
|
+
async function recordScreencast(): Promise<void> {
|
|
39
|
+
await ensureAppIsRunning();
|
|
40
|
+
await warmUpDictionary();
|
|
41
|
+
|
|
42
|
+
const framesDirectory = mkdtempSync(path.join(os.tmpdir(), 'screencast-'));
|
|
43
|
+
const browser = await chromium.launch({ args: ['--force-color-profile=srgb'] });
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const context = await browser.newContext({
|
|
47
|
+
deviceScaleFactor: CAPTURE_SCALE,
|
|
48
|
+
locale: LOCALE,
|
|
49
|
+
serviceWorkers: 'block',
|
|
50
|
+
viewport: { height: HEIGHT, width: WIDTH },
|
|
51
|
+
});
|
|
52
|
+
await seedBoard(context);
|
|
53
|
+
await seedSettings(context);
|
|
54
|
+
await delayDefinitionRequests(context);
|
|
55
|
+
await installCursor(context);
|
|
56
|
+
|
|
57
|
+
const page = await context.newPage();
|
|
58
|
+
await preparePage(page);
|
|
59
|
+
|
|
60
|
+
const capture = await startCapture(page, framesDirectory);
|
|
61
|
+
await playScenario(page);
|
|
62
|
+
const endTimestamp = await capture.stop();
|
|
63
|
+
await browser.close();
|
|
64
|
+
|
|
65
|
+
const gifFramesDirectory = resampleFrames(capture.frames, endTimestamp, framesDirectory);
|
|
66
|
+
encodeGif(gifFramesDirectory, OUTPUT_FILE);
|
|
67
|
+
console.log(`Captured ${capture.frames.length} frames, wrote ${OUTPUT_FILE}`);
|
|
68
|
+
} finally {
|
|
69
|
+
await browser.close();
|
|
70
|
+
rmSync(framesDirectory, { force: true, recursive: true });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function ensureAppIsRunning(): Promise<void> {
|
|
75
|
+
try {
|
|
76
|
+
await fetch(BASE_URL);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(`App is not running at ${BASE_URL} - run "bun run screencast" or start it with "bun start:app"`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function warmUpDictionary(): Promise<void> {
|
|
83
|
+
await fetch(new URL(`/api/dictionary/${LOCALE}`, BASE_URL));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function seedBoard(context: BrowserContext): Promise<void> {
|
|
87
|
+
await context.addInitScript((serializedBoard: string) => {
|
|
88
|
+
window.localStorage.setItem('scrabble-solver.board', JSON.stringify(serializedBoard));
|
|
89
|
+
}, JSON.stringify(createBoard().toJson()));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function seedSettings(context: BrowserContext): Promise<void> {
|
|
93
|
+
await context.addInitScript((locale: string) => {
|
|
94
|
+
window.localStorage.setItem('scrabble-solver.settings', JSON.stringify({ locale }));
|
|
95
|
+
}, LOCALE);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Definitions on localhost load faster than a viewer can read - a latency floor keeps
|
|
100
|
+
* fly-over rows from rendering their definitions and makes the loading state visible.
|
|
101
|
+
*/
|
|
102
|
+
async function delayDefinitionRequests(context: BrowserContext): Promise<void> {
|
|
103
|
+
await context.route('**/api/dictionary/*/*', async (route) => {
|
|
104
|
+
await new Promise((resolve) => setTimeout(resolve, DEFINITIONS_REQUEST_DELAY));
|
|
105
|
+
await route.continue().catch(() => undefined);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function createBoard(): Board {
|
|
110
|
+
const board = Board.fromStringArray([
|
|
111
|
+
' x hen ut on ',
|
|
112
|
+
'puer or amas j',
|
|
113
|
+
'a led a er a',
|
|
114
|
+
'c ki i elf c',
|
|
115
|
+
'i snot n is u',
|
|
116
|
+
'f t o w do l',
|
|
117
|
+
'y e moa er a',
|
|
118
|
+
'i r solar t',
|
|
119
|
+
'n v h t i',
|
|
120
|
+
'g i i bitten',
|
|
121
|
+
' e n v g',
|
|
122
|
+
' w g e ',
|
|
123
|
+
' e ',
|
|
124
|
+
' d ',
|
|
125
|
+
' ',
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
board.rows[4][3].tile.isBlank = true;
|
|
129
|
+
board.rows[9][11].tile.isBlank = true;
|
|
130
|
+
|
|
131
|
+
return board;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function installCursor(context: BrowserContext): Promise<void> {
|
|
135
|
+
await context.addInitScript(`(${showFakeCursor.toString()})(${CURSOR_START.x}, ${CURSOR_START.y})`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function showFakeCursor(startX: number, startY: number): void {
|
|
139
|
+
const cursor = document.createElement('div');
|
|
140
|
+
cursor.style.cssText = 'position:fixed;top:0;left:0;z-index:2147483647;pointer-events:none;will-change:transform;';
|
|
141
|
+
cursor.innerHTML =
|
|
142
|
+
'<svg width="21" height="24" viewBox="0 0 14 16" xmlns="http://www.w3.org/2000/svg">' +
|
|
143
|
+
'<polygon points="0.5,0.5 0.5,12.4 3.4,9.7 5.2,14 7.3,13.1 5.5,8.9 9.4,8.7" ' +
|
|
144
|
+
'fill="#000" stroke="#fff" stroke-width="0.8" stroke-linejoin="round"/></svg>';
|
|
145
|
+
cursor.style.transform = `translate(${startX}px, ${startY}px)`;
|
|
146
|
+
|
|
147
|
+
document.addEventListener(
|
|
148
|
+
'mousemove',
|
|
149
|
+
(event) => {
|
|
150
|
+
cursor.style.transform = `translate(${event.clientX}px, ${event.clientY}px)`;
|
|
151
|
+
},
|
|
152
|
+
true,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
function mount(): void {
|
|
156
|
+
document.documentElement.appendChild(cursor);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (document.readyState === 'loading') {
|
|
160
|
+
document.addEventListener('DOMContentLoaded', mount);
|
|
161
|
+
} else {
|
|
162
|
+
mount();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function preparePage(page: Page): Promise<void> {
|
|
167
|
+
await page.goto(BASE_URL);
|
|
168
|
+
await page.getByTestId('board').waitFor();
|
|
169
|
+
await page.evaluate(() => document.fonts.ready);
|
|
170
|
+
await page.getByTestId('rack').getByRole('textbox').first().focus();
|
|
171
|
+
await page.mouse.move(CURSOR_START.x, CURSOR_START.y);
|
|
172
|
+
await page.waitForTimeout(500);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function playScenario(page: Page): Promise<void> {
|
|
176
|
+
await page.waitForTimeout(700);
|
|
177
|
+
await page.keyboard.type(RACK, { delay: 160 });
|
|
178
|
+
await page.waitForTimeout(300);
|
|
179
|
+
await page.keyboard.press('Enter');
|
|
180
|
+
await waitForResults(page);
|
|
181
|
+
await page.waitForTimeout(400);
|
|
182
|
+
|
|
183
|
+
const topRowBox = await boxOf(page.getByTestId('results').getByTestId('result').first());
|
|
184
|
+
const hoverX = topRowBox.x + topRowBox.width * 0.8;
|
|
185
|
+
const topRowY = topRowBox.y + topRowBox.height / 2;
|
|
186
|
+
|
|
187
|
+
const cursor = await glide(page, CURSOR_START, { x: hoverX, y: topRowY }, 1800);
|
|
188
|
+
|
|
189
|
+
await waitForDefinitions(page, TARGET_WORD);
|
|
190
|
+
await page.waitForTimeout(DEFINITIONS_TO_PLACEMENT_DELAY);
|
|
191
|
+
await page.mouse.click(cursor.x, cursor.y, { delay: 60 });
|
|
192
|
+
await waitForPlacement(page);
|
|
193
|
+
await page.waitForTimeout(1600);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function waitForResults(page: Page): Promise<unknown> {
|
|
197
|
+
return page.waitForFunction(
|
|
198
|
+
() => {
|
|
199
|
+
const container = document.querySelector('[data-testid="results"]');
|
|
200
|
+
return (
|
|
201
|
+
container?.getAttribute('data-outdated') === 'false' &&
|
|
202
|
+
container.querySelector('[data-testid="result"]') !== null &&
|
|
203
|
+
container.querySelector('[data-testid="loading"]') === null
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
undefined,
|
|
207
|
+
{ timeout: 90_000 },
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function waitForDefinitions(page: Page, word: string): Promise<unknown> {
|
|
212
|
+
return page.waitForFunction(
|
|
213
|
+
(expectedWord: string) => {
|
|
214
|
+
const dictionary = document.querySelector('[data-testid="dictionary"]');
|
|
215
|
+
const title = dictionary?.querySelector('h2');
|
|
216
|
+
return (
|
|
217
|
+
title?.textContent?.toLowerCase() === expectedWord &&
|
|
218
|
+
dictionary?.querySelector('[data-testid="loading"]') === null
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
word,
|
|
222
|
+
{ timeout: 90_000 },
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function waitForPlacement(page: Page): Promise<unknown> {
|
|
227
|
+
return page.waitForFunction(() => {
|
|
228
|
+
const inputs = document.querySelectorAll<HTMLInputElement>('[data-testid="rack"] input');
|
|
229
|
+
return inputs.length > 0 && [...inputs].every((input) => input.value === '');
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async function glide(page: Page, from: Point, to: Point, durationMs: number): Promise<Point> {
|
|
234
|
+
const distance = Math.hypot(to.x - from.x, to.y - from.y);
|
|
235
|
+
|
|
236
|
+
if (distance === 0) {
|
|
237
|
+
return to;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const bow = Math.min(40, distance * 0.12);
|
|
241
|
+
const normal = { x: -(to.y - from.y) / distance, y: (to.x - from.x) / distance };
|
|
242
|
+
const control = {
|
|
243
|
+
x: (from.x + to.x) / 2 + normal.x * bow,
|
|
244
|
+
y: (from.y + to.y) / 2 + normal.y * bow,
|
|
245
|
+
};
|
|
246
|
+
const steps = Math.max(2, Math.round(durationMs / (1000 / 60)));
|
|
247
|
+
|
|
248
|
+
for (let step = 1; step <= steps; ++step) {
|
|
249
|
+
const progress = easeInOutCubic(step / steps);
|
|
250
|
+
const inverse = 1 - progress;
|
|
251
|
+
const x = inverse * inverse * from.x + 2 * inverse * progress * control.x + progress * progress * to.x;
|
|
252
|
+
const y = inverse * inverse * from.y + 2 * inverse * progress * control.y + progress * progress * to.y;
|
|
253
|
+
await page.mouse.move(x, y);
|
|
254
|
+
await page.waitForTimeout(durationMs / steps);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return to;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function easeInOutCubic(progress: number): number {
|
|
261
|
+
return progress < 0.5 ? 4 * progress ** 3 : 1 - (-2 * progress + 2) ** 3 / 2;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async function boxOf(locator: Locator): Promise<{ height: number; width: number; x: number; y: number }> {
|
|
265
|
+
const box = await locator.boundingBox();
|
|
266
|
+
|
|
267
|
+
if (!box) {
|
|
268
|
+
throw new Error(`Cannot measure ${String(locator)}`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return box;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async function startCapture(
|
|
275
|
+
page: Page,
|
|
276
|
+
directory: string,
|
|
277
|
+
): Promise<{ frames: CapturedFrame[]; stop: () => Promise<number> }> {
|
|
278
|
+
const client = await page.context().newCDPSession(page);
|
|
279
|
+
const frames: CapturedFrame[] = [];
|
|
280
|
+
|
|
281
|
+
client.on('Page.screencastFrame', (frame) => {
|
|
282
|
+
const file = path.join(directory, `capture-${String(frames.length).padStart(5, '0')}.png`);
|
|
283
|
+
writeFileSync(file, Buffer.from(frame.data, 'base64'));
|
|
284
|
+
frames.push({ file, timestamp: frame.metadata.timestamp ?? Date.now() / 1000 });
|
|
285
|
+
client.send('Page.screencastFrameAck', { sessionId: frame.sessionId }).catch(() => undefined);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
await client.send('Page.startScreencast', {
|
|
289
|
+
everyNthFrame: 1,
|
|
290
|
+
format: 'png',
|
|
291
|
+
maxHeight: HEIGHT * CAPTURE_SCALE,
|
|
292
|
+
maxWidth: WIDTH * CAPTURE_SCALE,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
frames,
|
|
297
|
+
stop: async (): Promise<number> => {
|
|
298
|
+
await client.send('Page.stopScreencast');
|
|
299
|
+
await client.detach();
|
|
300
|
+
return Date.now() / 1000;
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function resampleFrames(frames: CapturedFrame[], endTimestamp: number, framesDirectory: string): string {
|
|
306
|
+
if (frames.length === 0) {
|
|
307
|
+
throw new Error('No frames captured');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const gifFramesDirectory = path.join(framesDirectory, 'gif');
|
|
311
|
+
mkdirSync(gifFramesDirectory);
|
|
312
|
+
|
|
313
|
+
const startTimestamp = frames[0].timestamp;
|
|
314
|
+
const frameCount = Math.max(1, Math.ceil((endTimestamp - startTimestamp) * FPS));
|
|
315
|
+
let sourceIndex = 0;
|
|
316
|
+
|
|
317
|
+
for (let index = 0; index < frameCount; ++index) {
|
|
318
|
+
const tickTimestamp = startTimestamp + index / FPS;
|
|
319
|
+
|
|
320
|
+
while (sourceIndex + 1 < frames.length && frames[sourceIndex + 1].timestamp <= tickTimestamp) {
|
|
321
|
+
++sourceIndex;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
linkSync(frames[sourceIndex].file, path.join(gifFramesDirectory, `frame-${String(index).padStart(5, '0')}.png`));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return gifFramesDirectory;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function encodeGif(framesDirectory: string, outputFile: string): void {
|
|
331
|
+
execFileSync(
|
|
332
|
+
'ffmpeg',
|
|
333
|
+
[
|
|
334
|
+
'-y',
|
|
335
|
+
'-framerate',
|
|
336
|
+
String(FPS),
|
|
337
|
+
'-i',
|
|
338
|
+
path.join(framesDirectory, 'frame-%05d.png'),
|
|
339
|
+
'-vf',
|
|
340
|
+
`scale=${WIDTH}:${HEIGHT}:flags=lanczos,unsharp=5:5:0.8,split[a][b];[a]palettegen[palette];[b][palette]paletteuse=dither=sierra2_4a:diff_mode=rectangle`,
|
|
341
|
+
'-loop',
|
|
342
|
+
'0',
|
|
343
|
+
outputFile,
|
|
344
|
+
],
|
|
345
|
+
{ stdio: 'inherit' },
|
|
346
|
+
);
|
|
347
|
+
}
|
package/tsconfig.json
CHANGED
package/babel.config.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertResult,
|
|
3
|
-
closeModal,
|
|
4
|
-
getBoardTile,
|
|
5
|
-
getDictionary,
|
|
6
|
-
getDictionaryInput,
|
|
7
|
-
getDictionaryTitles,
|
|
8
|
-
getLoading,
|
|
9
|
-
getRackTile,
|
|
10
|
-
getResult,
|
|
11
|
-
getSettingOption,
|
|
12
|
-
getSettingsButton,
|
|
13
|
-
getTooltip,
|
|
14
|
-
hoverResult,
|
|
15
|
-
moveMouseAway,
|
|
16
|
-
solve,
|
|
17
|
-
typeRack,
|
|
18
|
-
unregisterServiceWorkers,
|
|
19
|
-
visitIndex,
|
|
20
|
-
} from '../support';
|
|
21
|
-
|
|
22
|
-
describe('app', () => {
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
await unregisterServiceWorkers();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
afterEach(() => {
|
|
28
|
-
cy.clearLocalStorage();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('has title', () => {
|
|
32
|
-
visitIndex();
|
|
33
|
-
|
|
34
|
-
cy.title().should('equal', 'Scrabble Solver 2');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('has default setting values', () => {
|
|
38
|
-
visitIndex();
|
|
39
|
-
getSettingsButton().realClick();
|
|
40
|
-
|
|
41
|
-
getSettingOption('Game', 'Scrabble').should('be.checked');
|
|
42
|
-
getSettingOption('Language', 'English (US)').should('be.checked');
|
|
43
|
-
getSettingOption('Coordinates', 'Hidden').should('be.checked');
|
|
44
|
-
getSettingOption('Input mode', 'Keyboard').should('be.checked');
|
|
45
|
-
getSettingOption('Group remaining tiles', 'Do not group').should('be.checked');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('full app test', () => {
|
|
49
|
-
beforeEach(() => {
|
|
50
|
-
cy.intercept('/api/dictionary/*/*').as('dictionary');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('Scrabble - Polish', () => {
|
|
54
|
-
visitIndex();
|
|
55
|
-
getSettingsButton().realClick();
|
|
56
|
-
getSettingOption('Language', 'Polski').check();
|
|
57
|
-
getSettingOption('Współrzędne', 'Oryginalne').check();
|
|
58
|
-
closeModal();
|
|
59
|
-
typeRack('abł');
|
|
60
|
-
solve();
|
|
61
|
-
|
|
62
|
-
assertResult(0, 'bał', 14);
|
|
63
|
-
hoverResult(0);
|
|
64
|
-
getLoading().should('be.visible');
|
|
65
|
-
cy.wait('@dictionary');
|
|
66
|
-
getRackTile(0).parent().should('have.attr', 'role', 'mark');
|
|
67
|
-
getRackTile(1).parent().should('have.attr', 'role', 'mark');
|
|
68
|
-
getRackTile(2).parent().should('have.attr', 'role', 'mark');
|
|
69
|
-
getBoardTile(5, 7).should('have.value', 'b');
|
|
70
|
-
getBoardTile(6, 7).should('have.value', 'a');
|
|
71
|
-
getBoardTile(7, 7).should('have.value', 'ł');
|
|
72
|
-
getBoardTile(5, 7).parent().should('have.attr', 'role', 'mark');
|
|
73
|
-
getBoardTile(6, 7).parent().should('have.attr', 'role', 'mark');
|
|
74
|
-
getBoardTile(7, 7).parent().should('have.attr', 'role', 'mark');
|
|
75
|
-
getDictionaryInput().should('have.value', 'bał');
|
|
76
|
-
getLoading().should('not.exist');
|
|
77
|
-
getTooltip().should('be.visible');
|
|
78
|
-
moveMouseAway();
|
|
79
|
-
getTooltip().should('not.exist');
|
|
80
|
-
getRackTile(0).parent().should('not.have.attr', 'role', 'mark');
|
|
81
|
-
getDictionaryTitles().should('have.length', 1).and('have.text', 'bał');
|
|
82
|
-
getDictionary()
|
|
83
|
-
.should('include.text', 'bać się')
|
|
84
|
-
.and('include.text', 'odczuwać lęk, strach')
|
|
85
|
-
.and('include.text', 'być niespokojnym o kogoś lub o coś')
|
|
86
|
-
.and('include.text', 'nie śmieć, nie odważać się na coś');
|
|
87
|
-
|
|
88
|
-
cy.findByLabelText('Punkty').realClick();
|
|
89
|
-
getTooltip().should('be.visible').and('have.text', 'Punkty');
|
|
90
|
-
assertResult(0, 'ba', 8);
|
|
91
|
-
hoverResult(0);
|
|
92
|
-
getRackTile(0).parent().should('have.attr', 'role', 'mark');
|
|
93
|
-
getRackTile(1).parent().should('have.attr', 'role', 'mark');
|
|
94
|
-
getRackTile(2).parent().should('not.have.attr', 'role', 'mark');
|
|
95
|
-
getBoardTile(5, 7).should('not.have.value');
|
|
96
|
-
getBoardTile(6, 7).should('have.value', 'b');
|
|
97
|
-
getBoardTile(7, 7).should('have.value', 'a');
|
|
98
|
-
getBoardTile(5, 7).parent().should('not.have.attr', 'role', 'mark');
|
|
99
|
-
getBoardTile(6, 7).parent().should('have.attr', 'role', 'mark');
|
|
100
|
-
getBoardTile(7, 7).parent().should('have.attr', 'role', 'mark');
|
|
101
|
-
getDictionaryInput().should('have.value', 'ba');
|
|
102
|
-
getLoading().should('be.visible');
|
|
103
|
-
cy.wait('@dictionary');
|
|
104
|
-
getLoading().should('not.exist');
|
|
105
|
-
getDictionaryTitles().should('have.length', 1).and('have.text', 'ba');
|
|
106
|
-
getDictionary()
|
|
107
|
-
.should('include.text', 'wykrzyknik, który wyraża głównie podziw, zdziwienie')
|
|
108
|
-
.and('include.text', 'w wierzeniach staroegipskich: dusza ludzka ginąca wraz z ciałem');
|
|
109
|
-
|
|
110
|
-
getResult(0).realClick();
|
|
111
|
-
getRackTile(0).parent().should('not.have.attr', 'role', 'mark');
|
|
112
|
-
getRackTile(1).parent().should('not.have.attr', 'role', 'mark');
|
|
113
|
-
getRackTile(2).parent().should('not.have.attr', 'role', 'mark');
|
|
114
|
-
getRackTile(0).should('not.have.value');
|
|
115
|
-
getRackTile(1).should('not.have.value');
|
|
116
|
-
getRackTile(2).should('have.value', 'ł');
|
|
117
|
-
getBoardTile(6, 7).should('have.value', 'b');
|
|
118
|
-
getBoardTile(7, 7).should('have.value', 'a');
|
|
119
|
-
|
|
120
|
-
cy.findByLabelText('Rozwiąż').should('be.visible').and('be.enabled');
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertResult,
|
|
3
|
-
closeModal,
|
|
4
|
-
getSettingOption,
|
|
5
|
-
getSettingsButton,
|
|
6
|
-
solve,
|
|
7
|
-
typeRack,
|
|
8
|
-
unregisterServiceWorkers,
|
|
9
|
-
visitIndex,
|
|
10
|
-
} from '../../support';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* @see https://github.com/kamilmielnik/scrabble-solver/issues/112
|
|
14
|
-
*/
|
|
15
|
-
describe('#112 - Scrabble - Character bonus not applied', () => {
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
await unregisterServiceWorkers();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
cy.clearLocalStorage();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('correctly shows points for a result which gets a character bonus', () => {
|
|
25
|
-
visitIndex();
|
|
26
|
-
|
|
27
|
-
getSettingsButton().realClick();
|
|
28
|
-
getSettingOption('Language', 'Français').check();
|
|
29
|
-
closeModal();
|
|
30
|
-
typeRack('jours');
|
|
31
|
-
solve();
|
|
32
|
-
|
|
33
|
-
assertResult(0, 'jours', 40);
|
|
34
|
-
assertResult(1, 'jours', 40);
|
|
35
|
-
assertResult(2, 'jours', 26);
|
|
36
|
-
assertResult(3, 'jours', 26);
|
|
37
|
-
assertResult(4, 'jours', 24);
|
|
38
|
-
assertResult(5, 'jours', 24);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getModal, getSettingsButton, typeRack, unregisterServiceWorkers, visitIndex } from '../../support';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* @see https://github.com/kamilmielnik/scrabble-solver/issues/129
|
|
5
|
-
*/
|
|
6
|
-
describe('#129 - Esc does not close the sidebar when letters input is focused', () => {
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
await unregisterServiceWorkers();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
cy.clearLocalStorage();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('Esc key closes the sidebar when rack is focused', () => {
|
|
16
|
-
visitIndex();
|
|
17
|
-
getSettingsButton().realClick();
|
|
18
|
-
typeRack('a');
|
|
19
|
-
cy.realPress('Escape');
|
|
20
|
-
|
|
21
|
-
getModal().should('not.exist');
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertResult,
|
|
3
|
-
getResults,
|
|
4
|
-
solve,
|
|
5
|
-
typeBoard,
|
|
6
|
-
typeRack,
|
|
7
|
-
unregisterServiceWorkers,
|
|
8
|
-
visitIndex,
|
|
9
|
-
} from '../../support';
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
* @see https://github.com/kamilmielnik/scrabble-solver/issues/2
|
|
13
|
-
*/
|
|
14
|
-
describe('#2 - "Q" tile does not work', () => {
|
|
15
|
-
beforeEach(async () => {
|
|
16
|
-
await unregisterServiceWorkers();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
cy.clearLocalStorage();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('accepts "Q" tile in English', () => {
|
|
24
|
-
visitIndex();
|
|
25
|
-
typeBoard('i', 'horizontal', 7, 7);
|
|
26
|
-
typeRack('q');
|
|
27
|
-
solve();
|
|
28
|
-
|
|
29
|
-
getResults().should('have.length', 2);
|
|
30
|
-
assertResult(0, 'qi', 11);
|
|
31
|
-
assertResult(1, 'qi', 11);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
closeModal,
|
|
3
|
-
getSettingOption,
|
|
4
|
-
getSettingsButton,
|
|
5
|
-
typeBoard,
|
|
6
|
-
typeRack,
|
|
7
|
-
unregisterServiceWorkers,
|
|
8
|
-
visitIndex,
|
|
9
|
-
} from '../../support';
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
* @see https://github.com/kamilmielnik/scrabble-solver/issues/3
|
|
13
|
-
*/
|
|
14
|
-
describe('#3 - "X" tile is allowed in Polish', () => {
|
|
15
|
-
beforeEach(async () => {
|
|
16
|
-
await unregisterServiceWorkers();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
cy.clearLocalStorage();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('does not accept "X" tile in Polish', () => {
|
|
24
|
-
visitIndex();
|
|
25
|
-
getSettingsButton().realClick();
|
|
26
|
-
getSettingOption('Language', 'Polski').check();
|
|
27
|
-
closeModal();
|
|
28
|
-
typeBoard('x', 'horizontal', 7, 7);
|
|
29
|
-
typeRack('x');
|
|
30
|
-
|
|
31
|
-
cy.findByText('x').should('not.exist');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getSettingOption, getSettingsButton, unregisterServiceWorkers, visitIndex } from '../../support';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* @see https://github.com/kamilmielnik/scrabble-solver/issues/30
|
|
5
|
-
*/
|
|
6
|
-
describe('#30 - Clicking inside an icon of non-first unchecked radio button does not select that option', () => {
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
await unregisterServiceWorkers();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
cy.clearLocalStorage();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('Clicking inside an icon of first unchecked radio button selects it', () => {
|
|
16
|
-
visitIndex();
|
|
17
|
-
getSettingsButton().realClick();
|
|
18
|
-
getSettingOption('Language', 'English (GB)').click();
|
|
19
|
-
getSettingOption('Language', 'English (US)') // first unchecked radio button
|
|
20
|
-
.parent('label')
|
|
21
|
-
.findAllByRole('img', { hidden: true })
|
|
22
|
-
.first()
|
|
23
|
-
.realHover({ position: 'center' })
|
|
24
|
-
.realClick({ position: 'center' });
|
|
25
|
-
});
|
|
26
|
-
});
|