Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

single-input-with-double-submitters.e2e.ts 837 B

12345678910111213141516171819202122232425262728
  1. /// <reference types="cypress" />
  2. import getFormValues from '../../src'
  3. describe('single input template', () => {
  4. beforeEach(() => {
  5. cy.intercept({ url: '/' }, { fixture: 'templates/single-input-with-double-submitters.html' });
  6. cy.intercept({ url: '/?*' }, { fixture: 'templates/single-input-with-double-submitters.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. });