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.
 
 
 
 
 
 

45 linhas
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"]]).then((body) => {
  16. expect(body).to.have.property("data");
  17. expect(body.data).to.have.lengthOf(1);
  18. expect(body.data[0]).to.have.property("content");
  19. expect(body.data[0]).to.have.property("name");
  20. });
  21. });
  22. it("Gets each Comment", () => {
  23. cy.get_list("Comment").then((body) =>
  24. body.data.forEach((comment) => {
  25. cy.get_doc("Comment", comment.name);
  26. })
  27. );
  28. });
  29. it("Removes the Comments", () => {
  30. cy.get_list("Comment").then((body) => {
  31. let comment_names = [];
  32. body.data.map((comment) => comment_names.push(comment.name));
  33. comment_names = [...new Set(comment_names)]; // remove duplicates
  34. comment_names.forEach((comment_name) => {
  35. cy.remove_doc("Comment", comment_name);
  36. });
  37. });
  38. });
  39. });