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.

single-readonly-input.e2e.ts 809 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-readonly-input.html' });
  6. cy.intercept({ url: '/?*' }, { fixture: 'templates/single-readonly-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. });