Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 regels
755 B

  1. /// <reference types="cypress" />
  2. import getFormValues from '../../src'
  3. import {makeSearchParams} from '../utils/search';
  4. describe('blank template', () => {
  5. beforeEach(() => {
  6. cy.intercept({ url: '/' }, { fixture: 'templates/blank.html' });
  7. cy.intercept({ url: '/?*' }, { fixture: 'templates/blank.html' }).as('submitted');
  8. })
  9. it('should have blank form value', () => {
  10. let form;
  11. cy
  12. .visit('/')
  13. .get('form')
  14. .then((formResult) => {
  15. [form] = Array.from(formResult);
  16. })
  17. .submit()
  18. .wait('@submitted')
  19. .location('search')
  20. .then(search => {
  21. const before = makeSearchParams(getFormValues(form)).toString();
  22. const after = new URLSearchParams(search).toString();
  23. expect(before).to.equal(after);
  24. })
  25. });
  26. })