Skip to content

Commit

Permalink
test: fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
everyonesdesign committed Sep 24, 2023
1 parent 793adf6 commit 85cd506
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cypress/integration/analysis.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
const { INPUT_SELECTOR } = require('../constants');

const ARROW_SELECTOR = 'img.chessBoardArrow';
const E2E4_ARROW_SELECTOR = 'chess-board .arrows [data-arrow="e2e4"]';
const SQUARE_SELECTOR = 'chess-board [class^="highlight square-"][style="background-color: rgb(255, 68, 68); opacity: 0.8;"]';
const E2E4_ARROW_SELECTOR = 'chess-board .arrows [data-arrow="e2e4"], wc-chess-board [id="arrow-e2e4"]';
const SQUARE_SELECTOR = 'chess-board [class^="highlight square-"][style="background-color: rgb(255, 68, 68); opacity: 0.8;"], wc-chess-board [class^="highlight square-"][style="background-color: rgb(255, 68, 68); opacity: 0.8;"]';
const BLINDFOLD_SELECTOR = '.ccHelper-blindfold';
const BLINDFOLD_BODY_CLASS = 'ccHelper-docBody--blindfolded';
const BLINDFOLD_HEAD_CLASS = 'ccHelper-docHead--blindfolded';
Expand Down
5 changes: 0 additions & 5 deletions cypress/integration/games.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* (run on analysis board)
*/

const { INPUT_SELECTOR } = require('../constants');

const ARROW_SELECTOR = 'img.chessBoardArrow';
const E2E4_ARROW_SELECTOR = 'chess-board .arrows [data-arrow="e2e4"]';
const SQUARE_SELECTOR = 'chess-board [class^="highlight square-"][style*="background-color: rgb(235, 97, 80)"]';

context('Chess games', () => {
beforeEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Cypress.Commands.add('makeMove', (move, options = {}) => {

Cypress.Commands.add('fenEquals', (expectedFen) => {
return cy
.get('chess-board')
.get('chess-board, wc-chess-board')
.then($chessboard => $chessboard[0].game.getPosition().fen)
.should('eq', expectedFen)
})
Expand All @@ -49,7 +49,7 @@ Cypress.Commands.add('flipBoard', () => {
Cypress.Commands.add('acceptCookies', () => {
return cy.window().then((win) => {
try {
const SELECTOR = '.accept-button, .bottom-banner-close';
const SELECTOR = '.accept-button, .bottom-banner-close, .osano-cm-save';
const buttons = win.document.querySelectorAll(SELECTOR);
buttons.forEach(b => b.click());
} catch(e) {}
Expand All @@ -58,7 +58,7 @@ Cypress.Commands.add('acceptCookies', () => {

Cypress.Commands.add('enablePuzzleBoard', () => {
return cy.window().then((win) => {
const element = win.document.querySelector('chess-board');
const element = win.document.querySelector('chess-board, wc-chess-board');

element.game.setOptions({ enabled: true })

Expand Down

0 comments on commit 85cd506

Please sign in to comment.