Skip to content
Snippets Groups Projects
Commit 7c1b9f21 authored by Adam G-H's avatar Adam G-H
Browse files

Fix the test

parent 3c5bd3a5
No related branches found
No related tags found
1 merge request!339Updates contact form to use a basic page
Pipeline #383975 failed
......@@ -9,8 +9,6 @@ third_party_settings:
antibot: true
honeypot:
honeypot: true
_core:
default_config_hash: Fcw7hXWj_zgosggPLJsVnXVpfHDrnjSh7rv8a_EhoVI
weight: 0
open: null
close: null
......
describe('Contact form', () => {
beforeEach(() => {
cy.setUp('standard').applyRecipe().visit('/contact');
cy.setUp('standard').applyRecipe();
});
after(() => {
cy.tearDown();
});
it('appears in the main menu', () => {
it('requires all fields and has spam protection', () => {
// Ensure the viewport is wide enough to see the main menu links.
cy.viewport('macbook-13');
cy.findByText('Main navigation').parent().find('a:contains("Contact")');
});
// Use the main menu link to visit the contact form.
cy.findByText('Main navigation')
.parent()
.find('a:contains("Contact")')
.click();
it('requires all fields', () => {
cy.findByLabelText('Name').should('have.attr', 'required');
cy.findByLabelText('Email').should('have.attr', 'required');
cy.findByLabelText('Message').should('have.attr', 'required');
cy.findByText('CAPTCHA', { selector: 'fieldset > legend' }).should('exist');
});
cy.get('[id^"=webform-submission-contact-form-node-"]').within(() => {
cy.findByLabelText('Name').should('have.attr', 'required');
cy.findByLabelText('Email').should('have.attr', 'required');
cy.findByLabelText('Message').should('have.attr', 'required');
cy.findByText('CAPTCHA', { selector: 'fieldset > legend' })
.should('exist')
.findByText('Click to start verification')
.should('exist');
it('has spam protection', () => {
// Confirm the Antibot, Honeypot and Friendly CAPTCHA fields exist within the form.
cy.get('[id^=webform-submission-contact-form-node]').within(() => {
cy.get('input[type="hidden"][name="antibot_key"]').should('exist');
cy.get('input[name="url"]').should('not.be.visible');
// Confirm the friendly CAPTCHA is present.
cy.findByText('Click to start verification').should('exist');
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment