-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
309 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/*! | ||
* -------------------------------------------------------------------------- * | ||
* * | ||
* Kokopu-React - A React-based library of chess-related components. * | ||
* <https://www.npmjs.com/package/kokopu-react> * | ||
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> * | ||
* * | ||
* Kokopu-React is free software: you can redistribute it and/or * | ||
* modify it under the terms of the GNU Lesser General Public License * | ||
* as published by the Free Software Foundation, either version 3 of * | ||
* the License, or (at your option) any later version. * | ||
* * | ||
* Kokopu-React is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Lesser General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General * | ||
* Public License along with this program. If not, see * | ||
* <http://www.gnu.org/licenses/>. * | ||
* * | ||
* -------------------------------------------------------------------------- */ | ||
|
||
|
||
const { describeWithBrowser, itCustom, setSandbox, compareSandbox, takeScreenshot, compareScreenshot, itChecksScreenshots, waitForAutoplay } = require('./common/graphic'); | ||
const { By } = require('selenium-webdriver'); | ||
|
||
|
||
const PLAY_STOP_BUTTON_TITLE = 'Play/stop the game'; | ||
|
||
|
||
describeWithBrowser('Navigation board auto-play - Uncontrolled behavior', browserContext => { | ||
|
||
itChecksScreenshots(browserContext, '14_navigation_board_autoplay/uncontrolled', [ | ||
'initial state default', | ||
'initial state close to end', | ||
]); | ||
|
||
function itCheckClickWaitClick(itemIndex, label, nbMoves) { | ||
itCustom(browserContext, '14_navigation_board_autoplay/uncontrolled', itemIndex, label, async element => { | ||
const buttonElement = await element.findElement(By.xpath(`.//div[@title='${PLAY_STOP_BUTTON_TITLE}']`)); | ||
await buttonElement.click(); | ||
await waitForAutoplay(nbMoves); | ||
await takeScreenshot(browserContext, `${label} before stop`, element); | ||
await buttonElement.click(); | ||
await takeScreenshot(browserContext, `${label} after stop`, element); | ||
await compareScreenshot(browserContext, `${label} before stop`); | ||
await compareScreenshot(browserContext, `${label} after stop`); | ||
}); | ||
} | ||
|
||
itCheckClickWaitClick(0, 'after 2 moves from beginning', 2); | ||
itCheckClickWaitClick(1, 'after reaching the end', 1); | ||
}); | ||
|
||
|
||
describeWithBrowser('Navigation board auto-play - Controlled behavior', browserContext => { | ||
|
||
itChecksScreenshots(browserContext, '14_navigation_board_autoplay/controlled', [ | ||
'initial state not acknowledging node changes', | ||
'initial state acknowledging node changes', | ||
'initial state close to end', | ||
'initial state not acknowledging is-playing changes', | ||
'initial state acknowledging is-playing changes', | ||
'initial state at the end', | ||
]); | ||
|
||
function itCheckClickWaitClick(itemIndex, label, nbMoves, expectedSandboxAfterClick1, expectedSandboxAfterClick2) { | ||
itCustom(browserContext, '14_navigation_board_autoplay/controlled', itemIndex, label, async element => { | ||
await setSandbox(browserContext, ''); | ||
const buttonElement = await element.findElement(By.xpath(`.//div[@title='${PLAY_STOP_BUTTON_TITLE}']`)); | ||
await buttonElement.click(); | ||
await compareSandbox(browserContext, expectedSandboxAfterClick1); | ||
await waitForAutoplay(nbMoves); | ||
await buttonElement.click(); | ||
await takeScreenshot(browserContext, label, element); | ||
await compareSandbox(browserContext, expectedSandboxAfterClick2); | ||
await compareScreenshot(browserContext, label); | ||
}); | ||
} | ||
|
||
itCheckClickWaitClick(0, 'after 2 moves not acknowledging node changes', 2, '', 'Node ID changed: 3b'); | ||
itCheckClickWaitClick(1, 'after 2 moves acknowledging node changes', 2, '', 'Node ID changed: 3b\nNode ID changed: 4w'); | ||
itCheckClickWaitClick(2, 'after reaching the end', 1, '', 'Node ID changed: 20b'); | ||
itCheckClickWaitClick(3, 'after 1 move not acknowledging is-playing changes', 1, 'is-playing flag changed: true', 'is-playing flag changed: true'); | ||
itCheckClickWaitClick(4, 'after 1 move acknowledging is-playing changes', 1, 'is-playing flag changed: true', 'is-playing flag changed: false'); | ||
|
||
function itCheckClick(itemIndex, label, expectedSandboxAfterClick) { | ||
itCustom(browserContext, '14_navigation_board_autoplay/controlled', itemIndex, label, async element => { | ||
await setSandbox(browserContext, ''); | ||
const buttonElement = await element.findElement(By.xpath(`.//div[@title='${PLAY_STOP_BUTTON_TITLE}']`)); | ||
await buttonElement.click(); | ||
await takeScreenshot(browserContext, label, element); | ||
await compareSandbox(browserContext, expectedSandboxAfterClick); | ||
await compareScreenshot(browserContext, label); | ||
}); | ||
} | ||
|
||
itCheckClick(5, 'already at the end', ''); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+47 KB
...ion_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.8 KB
...board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+46.8 KB
...vigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.3 KB
...tion_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.3 KB
...c_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.3 KB
...aphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.8 KB
...on_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.3 KB
...vigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.3 KB
...references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.1 KB
...ferences/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.8 KB
...oard_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.3 KB
...tion_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.2 KB
...igation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.1 KB
...gation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.3 KB
...14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.3 KB
...4_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.1 KB
...rences/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.6 KB
..._references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.