Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
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. });