Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

30 righe
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. })