Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

single-input.e2e.ts 791 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.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. });