diff --git a/package-lock.json b/package-lock.json index 68c5316..2d14fb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "paper": "^0.12.17" }, "devDependencies": { - "chromedriver": "^125.0.3", + "chromedriver": "^128.0.3", "mocha": "^10.4.0", "parcel": "^2.12.0", "selenium-webdriver": "^4.21.0", @@ -3159,15 +3159,15 @@ } }, "node_modules/chromedriver": { - "version": "125.0.3", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-125.0.3.tgz", - "integrity": "sha512-Qzuk5Wian2o3EVGjtbz6V/jv+pT/AV9246HbG6kUljZXXjsKZLZxqJC+kHR3qEh/wdv4EJD0YwAOWV72v9hogw==", + "version": "128.0.3", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-128.0.3.tgz", + "integrity": "sha512-Xn/bknOpGlY9tKinwS/hVWeNblSeZvbbJbF8XZ73X1jeWfAFPRXx3fMLdNNz8DqruDbx3cKEJ5wR3mnst6G3iw==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@testim/chrome-version": "^1.1.4", - "axios": "^1.6.7", + "axios": "^1.7.4", "compare-versions": "^6.1.0", "extract-zip": "^2.0.1", "proxy-agent": "^6.4.0", diff --git a/package.json b/package.json index 6088bc4..72e7f14 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "test-lint": "standard" }, "devDependencies": { - "chromedriver": "^125.0.3", + "chromedriver": "^128.0.3", "mocha": "^10.4.0", "parcel": "^2.12.0", "selenium-webdriver": "^4.21.0", diff --git a/src/components/items/tile.js b/src/components/items/tile.js index 7a506e4..d27b74c 100644 --- a/src/components/items/tile.js +++ b/src/components/items/tile.js @@ -75,7 +75,6 @@ export class Tile extends Item { } onTap (event) { - console.debug(this.coordinates.offset.toString(), this) this.items.forEach((item) => item.onTap(event)) } @@ -88,6 +87,7 @@ export class Tile extends Item { } onSelected (deselectedTile) { + console.debug(this.toString(), 'selected') this.selected = true this.group.bringToFront() this.#ui.hexagon.style = this.styles.selected @@ -119,7 +119,7 @@ export class Tile extends Item { } toString () { - return this.coordinates.offset.toString() + return `[${this.type}:${this.coordinates.offset.toString()}]` } update () { diff --git a/test/fixtures.js b/test/fixtures.js index e8fab2e..cc7943d 100644 --- a/test/fixtures.js +++ b/test/fixtures.js @@ -50,7 +50,7 @@ class PuzzleFixture { this.elements.body = await this.driver.findElement(By.tagName('body')) this.elements.canvas = await this.driver.findElement(By.id('puzzle')) - this.elements.modifiers = await this.driver.findElement(By.id('modifiers-mutable')) + this.elements.modifiers = await this.driver.findElement(By.id('modifiers')) } async clickModifier (name, options = {}) { @@ -81,14 +81,9 @@ class PuzzleFixture { return this.driver.wait(untilElementHasClass(this.elements.body, 'puzzle-solved')) } - async selectModifier (name) { - const origin = this.#getModifier(name) - await this.driver.actions({ async: true }).move({ origin }).press().pause(501).release().perform() - } - async #getModifier (name) { await this.driver.wait(until.elementIsVisible(this.elements.modifiers)) - return await this.driver.findElement(By.className(`modifier-${name}`)) + return await this.driver.findElement(By.css(`.modifier-${name}:not(.disabled)`)) } static baseUrl = 'http://localhost:1234' diff --git a/test/puzzles/002.js b/test/puzzles/002.js index 7debc2a..ac57ca9 100644 --- a/test/puzzles/002.js +++ b/test/puzzles/002.js @@ -9,8 +9,11 @@ describe('Puzzle 002', function () { before(puzzle.before) it('should be solved', async function () { + await puzzle.clickTile(0, 0) + await puzzle.clickModifier('toggle') + await puzzle.clickTile(2, 0) - await puzzle.clickModifier('rotate') + await puzzle.clickModifier('toggle') assert(await puzzle.isSolved()) }) diff --git a/test/puzzles/003.js b/test/puzzles/003.js index c027c54..4b8ab09 100644 --- a/test/puzzles/003.js +++ b/test/puzzles/003.js @@ -9,11 +9,12 @@ describe('Puzzle 003', function () { before(puzzle.before) it('should be solved', async function () { - await puzzle.clickTile(2, 1) - await puzzle.selectModifier('rotate') await puzzle.clickTile(2, 0) await puzzle.clickModifier('rotate') + await puzzle.clickTile(0, 0) + await puzzle.clickModifier('rotate', { times: 3 }) + assert(await puzzle.isSolved()) }) }) diff --git a/test/puzzles/007.js b/test/puzzles/007.js index 87d5da8..728715f 100644 --- a/test/puzzles/007.js +++ b/test/puzzles/007.js @@ -13,14 +13,10 @@ describe('Puzzle 007', function () { await puzzle.clickModifier('move') await puzzle.clickTile(1, 0) - await puzzle.clickTile(2, 2) - await puzzle.selectModifier('move') await puzzle.clickTile(2, 3) await puzzle.clickModifier('move') await puzzle.clickTile(1, 4) - await puzzle.clickTile(2, 3) - await puzzle.selectModifier('move') await puzzle.clickTile(1, 2) await puzzle.clickModifier('rotate') await puzzle.clickModifier('move') diff --git a/test/puzzles/009.js b/test/puzzles/009.js index de85575..7ce777d 100644 --- a/test/puzzles/009.js +++ b/test/puzzles/009.js @@ -13,14 +13,10 @@ describe('Puzzle 009', function () { await puzzle.clickModifier('move') await puzzle.clickTile(0, 0) - await puzzle.clickTile(1, 1) - await puzzle.selectModifier('move') await puzzle.clickTile(1, 5) await puzzle.clickModifier('move') await puzzle.clickTile(2, 5) - await puzzle.clickTile(1, 5) - await puzzle.selectModifier('move') await puzzle.clickTile(1, 4) await puzzle.clickModifier('move') await puzzle.clickTile(0, 5) diff --git a/test/puzzles/010.js b/test/puzzles/010.js index 916b913..801fe2f 100644 --- a/test/puzzles/010.js +++ b/test/puzzles/010.js @@ -13,14 +13,10 @@ describe('Puzzle 010', function () { await puzzle.clickModifier('move') await puzzle.clickTile(2, 4) - await puzzle.clickTile(1, 1) - await puzzle.selectModifier('move') await puzzle.clickTile(1, 5) await puzzle.clickModifier('move') await puzzle.clickTile(0, 5) - await puzzle.clickTile(1, 5) - await puzzle.selectModifier('move') await puzzle.clickTile(1, 0) await puzzle.clickModifier('move') await puzzle.clickTile(2, 5) diff --git a/test/puzzles/011.js b/test/puzzles/011.js index 32a5a31..24350e2 100644 --- a/test/puzzles/011.js +++ b/test/puzzles/011.js @@ -15,8 +15,6 @@ describe('Puzzle 011', function () { await puzzle.clickTile(2, 1) await puzzle.isNotMasked() - await puzzle.clickTile(1, 1) - await puzzle.selectModifier('rotate') await puzzle.clickTile(2, 0) await puzzle.clickModifier('rotate', { times: 3 }) diff --git a/test/puzzles/012.js b/test/puzzles/012.js index 9eca8c6..6b0a665 100644 --- a/test/puzzles/012.js +++ b/test/puzzles/012.js @@ -30,41 +30,29 @@ describe('Puzzle 012', function () { await puzzle.clickTile(4, 4) await puzzle.clickModifier('rotate', { times: 3 }) - await puzzle.clickTile(3, 0) - await puzzle.selectModifier('move') await puzzle.clickTile(4, 1) await puzzle.clickModifier('move') await puzzle.clickTile(1, 4) await puzzle.isMasked() await puzzle.clickTile(3, 1) - await puzzle.clickTile(3, 6) - await puzzle.selectModifier('move') await puzzle.clickTile(4, 4) await puzzle.clickModifier('move') await puzzle.clickTile(1, 2) await puzzle.isMasked() await puzzle.clickTile(3, 5) - await puzzle.clickTile(4, 1) - await puzzle.selectModifier('move') await puzzle.clickTile(3, 2) await puzzle.clickModifier('move') await puzzle.clickTile(2, 2) - await puzzle.clickTile(4, 4) - await puzzle.selectModifier('move') await puzzle.clickTile(3, 4) await puzzle.clickModifier('move') await puzzle.clickTile(2, 3) - await puzzle.clickTile(4, 1) - await puzzle.selectModifier('rotate') await puzzle.clickTile(2, 0) await puzzle.clickModifier('rotate', { times: 2 }) - await puzzle.clickTile(4, 4) - await puzzle.selectModifier('rotate') await puzzle.clickTile(2, 5) await puzzle.clickModifier('rotate', { times: 4 })