選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

44 行
1.2 KiB

  1. context('API Resources', () => {
  2. before(() => {
  3. cy.visit('/login');
  4. cy.login();
  5. cy.visit('/app/website');
  6. });
  7. it('Creates two Comments', () => {
  8. cy.insert_doc('Comment', { comment_type: 'Comment', content: "hello" });
  9. cy.insert_doc('Comment', { comment_type: 'Comment', content: "world" });
  10. });
  11. it('Lists the Comments', () => {
  12. cy.get_list('Comment')
  13. .its('data')
  14. .then(data => expect(data.length).to.be.at.least(2));
  15. cy.get_list('Comment', ['name', 'content'], [['content', '=', 'hello']])
  16. .then(body => {
  17. expect(body).to.have.property('data');
  18. expect(body.data).to.have.lengthOf(1);
  19. expect(body.data[0]).to.have.property('content');
  20. expect(body.data[0]).to.have.property('name');
  21. });
  22. });
  23. it('Gets each Comment', () => {
  24. cy.get_list('Comment').then(body => body.data.forEach(comment => {
  25. cy.get_doc('Comment', comment.name);
  26. }));
  27. });
  28. it('Removes the Comments', () => {
  29. cy.get_list('Comment').then(body => {
  30. let comment_names = [];
  31. body.data.map(comment => comment_names.push(comment.name));
  32. comment_names = [...new Set(comment_names)]; // remove duplicates
  33. comment_names.forEach((comment_name) => {
  34. cy.remove_doc('Comment', comment_name);
  35. });
  36. });
  37. });
  38. });