forms.js 1007 B

123456789101112131415161718192021222324252627282930313233343536
  1. describe('Forms', () => {
  2. it('Opens forms page', () => {
  3. cy.resetDB();
  4. cy.loginAndVisit('/lists/forms');
  5. });
  6. it('Checks form URL', () => {
  7. cy.get('a[data-cy=url]').contains('http://localhost:9000');
  8. });
  9. it('Checks public lists', () => {
  10. cy.get('ul[data-cy=lists] li')
  11. .should('contain', 'Opt-in list')
  12. .its('length')
  13. .should('eq', 1);
  14. cy.get('[data-cy=form] pre').should('not.exist');
  15. });
  16. it('Selects public list', () => {
  17. // Click the list checkbox.
  18. cy.get('ul[data-cy=lists] .checkbox').click();
  19. // Make sure the <pre> form HTML has appeared.
  20. cy.get('[data-cy=form] pre').then(($pre) => {
  21. // Check that the ID of the list in the checkbox appears in the HTML.
  22. cy.get('ul[data-cy=lists] input').then(($inp) => {
  23. cy.wrap($pre).contains($inp.val());
  24. });
  25. });
  26. // Click the list checkbox.
  27. cy.get('ul[data-cy=lists] .checkbox').click();
  28. cy.get('[data-cy=form] pre').should('not.exist');
  29. });
  30. });