Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Created January 15, 2021 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotherightthing/338b2eba568a8ae2b5422227eea5d88f to your computer and use it in GitHub Desktop.
Save dotherightthing/338b2eba568a8ae2b5422227eea5d88f to your computer and use it in GitHub Desktop.
Cypress - force No CAPTCHA reCAPTCHA to fail
/**
* @file cypress/integration/recaptcha.spec.js
* @summary Cypress spec for End-to-End UI testing.
*/
/* eslint-disable prefer-arrow-callback */
/* eslint-disable max-len */
// Test principles:
// ARRANGE: SET UP APP STATE > ACT: INTERACT WITH IT > ASSERT: MAKE ASSERTIONS
// Passing arrow functions (“lambdas”) to Mocha is discouraged
// https://mochajs.org/#arrow-functions
/* eslint-disable func-names */
const idOfElementBeforeCaptcha = ''; // TODO
const urlOfPageContainingACaptcha = ''; // TODO
describe('Recaptcha', function () {
before(function () {
cy.visit(urlOfPageContainingACaptcha);
});
describe('Tests', function () {
it('1', function () {
cy.get('#' + idOfElementBeforeCaptcha)
.scrollIntoView()
.tab()
.type(' ');
cy.get('.recaptcha-checkbox-checked')
.should('exist');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment