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.
 
 
 

29 righe
791 B

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