Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

blank.e2e.ts 755 B

1234567891011121314151617181920212223242526272829
  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. })