From 484b38b91b2b3b4b97b0bdc426fad26e22a4236a Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 15:19:34 +0500 Subject: [PATCH 1/7] trigger workflow --- cypress/integration/app.spec.js | 777 +++++++++++++------------------- 1 file changed, 318 insertions(+), 459 deletions(-) diff --git a/cypress/integration/app.spec.js b/cypress/integration/app.spec.js index 8d5049f7..0b7a0596 100644 --- a/cypress/integration/app.spec.js +++ b/cypress/integration/app.spec.js @@ -20,11 +20,11 @@ // https://github.com/tastejs/todomvc/blob/master/tests/test.js // *********************************************** -describe('TodoMVC', function () { +describe("TodoMVC", function () { // setup these constants to match what TodoMVC does - let TODO_ITEM_ONE = 'buy some cheese' - let TODO_ITEM_TWO = 'feed the cat' - let TODO_ITEM_THREE = 'book a doctors appointment' + let TODO_ITEM_ONE = "buy some cheese"; + let TODO_ITEM_TWO = "feed the cat"; + let TODO_ITEM_THREE = "book a doctors appointment"; beforeEach(function () { // By default Cypress will automatically @@ -40,8 +40,8 @@ describe('TodoMVC', function () { // which is automatically prepended to cy.visit // // https://on.cypress.io/api/visit - cy.visit('/') - }) + cy.visit("/"); + }); afterEach(() => { // In firefox, blur handlers will fire upon navigation if there is an activeElement. @@ -49,34 +49,34 @@ describe('TodoMVC', function () { // this is needed to blur activeElement after each test to prevent state leakage between tests. cy.window().then((win) => { // @ts-ignore - win.document.activeElement.blur() - }) - }) + win.document.activeElement.blur(); + }); + }); // a very simple example helpful during presentations - it('adds 2 todos', function () { - cy.get('.new-todo') - .type('learn testing{enter}') - .type('be cool{enter}') + it("adds 2 todos", function () { + cy.get(".new-todo") + .type("learn testing in Cypress{enter}") + .type("be cool{enter}"); - cy.get('.todo-list li').should('have.length', 2) - }) + cy.get(".todo-list li").should("have.length", 2); + }); - context('No Todos', function () { - it('should hide #main and #footer', function () { + context("No Todos", function () { + it("should hide #main and #footer", function () { // Unlike the TodoMVC tests, we don't need to create // a gazillion helper functions which are difficult to // parse through. Instead we'll opt to use real selectors // so as to make our testing intentions as clear as possible. // // http://on.cypress.io/get - cy.get('.todo-list li').should('not.exist') - cy.get('[data-layer="Content"]').should('not.exist') - cy.get('.footer').should('not.be.visible') - }) - }) + cy.get(".todo-list li").should("not.exist"); + cy.get('[data-layer="Content"]').should("not.exist"); + cy.get(".footer").should("not.be.visible"); + }); + }); - context('New Todo', function () { + context("New Todo", function () { // New commands used here: // https://on.cypress.io/type // https://on.cypress.io/eq @@ -85,83 +85,68 @@ describe('TodoMVC', function () { // https://on.cypress.io/should // https://on.cypress.io/as - it('should allow me to add todo items', function () { + it("should allow me to add todo items", function () { // create 1st todo - cy.get('.new-todo') - .type(TODO_ITEM_ONE) - .type('{enter}') + cy.get(".new-todo").type(TODO_ITEM_ONE).type("{enter}"); // make sure the 1st label contains the 1st todo text - cy.get('.todo-list li') - .eq(0) - .find('label') - .should('contain', TODO_ITEM_ONE) + cy.get(".todo-list li") + .eq(0) + .find("label") + .should("contain", TODO_ITEM_ONE); // create 2nd todo - cy.get('.new-todo') - .type(TODO_ITEM_TWO) - .type('{enter}') + cy.get(".new-todo").type(TODO_ITEM_TWO).type("{enter}"); // make sure the 2nd label contains the 2nd todo text - cy.get('.todo-list li') - .eq(1) - .find('label') - .should('contain', TODO_ITEM_TWO) - }) + cy.get(".todo-list li") + .eq(1) + .find("label") + .should("contain", TODO_ITEM_TWO); + }); - it('adds items', function () { + it("adds items", function () { // create several todos then check the number of items in the list - cy.get('.new-todo') - .type('todo A{enter}') - .type('todo B{enter}') // we can continue working with same element - .type('todo C{enter}') // and keep adding new items - .type('todo D{enter}') + cy.get(".new-todo") + .type("todo A{enter}") + .type("todo B{enter}") // we can continue working with same element + .type("todo C{enter}") // and keep adding new items + .type("todo D{enter}"); - cy.get('.todo-list li').should('have.length', 4) - }) + cy.get(".todo-list li").should("have.length", 4); + }); - it('should clear text input field when an item is added', function () { - cy.get('.new-todo') - .type(TODO_ITEM_ONE) - .type('{enter}') + it("should clear text input field when an item is added", function () { + cy.get(".new-todo").type(TODO_ITEM_ONE).type("{enter}"); - cy.get('.new-todo').should('have.text', '') - }) + cy.get(".new-todo").should("have.text", ""); + }); - it('should append new items to the bottom of the list', function () { + it("should append new items to the bottom of the list", function () { // this is an example of a custom command // defined in cypress/support/commands.js - cy.createDefaultTodos().as('todos') + cy.createDefaultTodos().as("todos"); // even though the text content is split across // multiple and elements // `cy.contains` can verify this correctly - cy.get('.todo-count').contains('3 items left') - - cy.get('@todos') - .eq(0) - .find('label') - .should('contain', TODO_ITEM_ONE) - - cy.get('@todos') - .eq(1) - .find('label') - .should('contain', TODO_ITEM_TWO) - - cy.get('@todos') - .eq(2) - .find('label') - .should('contain', TODO_ITEM_THREE) - }) - - it('should show #main and #footer when items added', function () { - cy.createTodo(TODO_ITEM_ONE) - cy.get('.main').should('be.visible') - cy.get('.footer').should('be.visible') - }) - }) - - context('Mark all as completed', function () { + cy.get(".todo-count").contains("3 items left"); + + cy.get("@todos").eq(0).find("label").should("contain", TODO_ITEM_ONE); + + cy.get("@todos").eq(1).find("label").should("contain", TODO_ITEM_TWO); + + cy.get("@todos").eq(2).find("label").should("contain", TODO_ITEM_THREE); + }); + + it("should show #main and #footer when items added", function () { + cy.createTodo(TODO_ITEM_ONE); + cy.get(".main").should("be.visible"); + cy.get(".footer").should("be.visible"); + }); + }); + + context("Mark all as completed", function () { // New commands used here: // - cy.check https://on.cypress.io/api/check // - cy.uncheck https://on.cypress.io/api/uncheck @@ -172,351 +157,260 @@ describe('TodoMVC', function () { // Aliases will automatically persist // between hooks and are available // in your tests below - cy.createDefaultTodos().as('todos') - }) + cy.createDefaultTodos().as("todos"); + }); - it('should allow me to mark all items as completed', function () { + it("should allow me to mark all items as completed", function () { // complete all todos // we use 'check' instead of 'click' // because that indicates our intention much clearer - cy.get('.toggle-all').check() + cy.get(".toggle-all").check(); // get each todo li and ensure its class is 'completed' - cy.get('@todos') - .eq(0) - .should('have.class', 'completed') + cy.get("@todos").eq(0).should("have.class", "completed"); - cy.get('@todos') - .eq(1) - .should('have.class', 'completed') + cy.get("@todos").eq(1).should("have.class", "completed"); - cy.get('@todos') - .eq(2) - .should('have.class', 'completed') - }) + cy.get("@todos").eq(2).should("have.class", "completed"); + }); - it('should allow me to clear the complete state of all items', function () { + it("should allow me to clear the complete state of all items", function () { // check and then immediately uncheck - cy.get('.toggle-all') - .check() - .uncheck() + cy.get(".toggle-all").check().uncheck(); - cy.get('@todos') - .eq(0) - .should('not.have.class', 'completed') + cy.get("@todos").eq(0).should("not.have.class", "completed"); - cy.get('@todos') - .eq(1) - .should('not.have.class', 'completed') + cy.get("@todos").eq(1).should("not.have.class", "completed"); - cy.get('@todos') - .eq(2) - .should('not.have.class', 'completed') - }) + cy.get("@todos").eq(2).should("not.have.class", "completed"); + }); - it('complete all checkbox should update state when items are completed / cleared', function () { + it("complete all checkbox should update state when items are completed / cleared", function () { // alias the .toggle-all for reuse later - cy.get('.toggle-all') - .as('toggleAll') - .check() - // this assertion is silly here IMO but - // it is what TodoMVC does - .should('be.checked') + cy.get(".toggle-all") + .as("toggleAll") + .check() + // this assertion is silly here IMO but + // it is what TodoMVC does + .should("be.checked"); // alias the first todo and then click it - cy.get('.todo-list li') - .eq(0) - .as('firstTodo') - .find('.toggle') - .uncheck() + cy.get(".todo-list li").eq(0).as("firstTodo").find(".toggle").uncheck(); // reference the .toggle-all element again // and make sure its not checked - cy.get('@toggleAll').should('not.be.checked') + cy.get("@toggleAll").should("not.be.checked"); // reference the first todo again and now toggle it - cy.get('@firstTodo') - .find('.toggle') - .check() + cy.get("@firstTodo").find(".toggle").check(); // assert the toggle all is checked again - cy.get('@toggleAll').should('be.checked') - }) - }) + cy.get("@toggleAll").should("be.checked"); + }); + }); - context('Item', function () { + context("Item", function () { // New commands used here: // - cy.clear https://on.cypress.io/api/clear - it('should allow me to mark items as complete', function () { + it("should allow me to mark items as complete", function () { // we are aliasing the return value of // our custom command 'createTodo' // // the return value is the
  • in the - cy.createTodo(TODO_ITEM_ONE).as('firstTodo') - cy.createTodo(TODO_ITEM_TWO).as('secondTodo') + cy.createTodo(TODO_ITEM_ONE).as("firstTodo"); + cy.createTodo(TODO_ITEM_TWO).as("secondTodo"); - cy.get('@firstTodo') - .find('.toggle') - .check() + cy.get("@firstTodo").find(".toggle").check(); - cy.get('@firstTodo').should('have.class', 'completed') + cy.get("@firstTodo").should("have.class", "completed"); - cy.get('@secondTodo').should('not.have.class', 'completed') - cy.get('@secondTodo') - .find('.toggle') - .check() + cy.get("@secondTodo").should("not.have.class", "completed"); + cy.get("@secondTodo").find(".toggle").check(); - cy.get('@firstTodo').should('have.class', 'completed') - cy.get('@secondTodo').should('have.class', 'completed') - }) + cy.get("@firstTodo").should("have.class", "completed"); + cy.get("@secondTodo").should("have.class", "completed"); + }); - it('should allow me to un-mark items as complete', function () { - cy.createTodo(TODO_ITEM_ONE).as('firstTodo') - cy.createTodo(TODO_ITEM_TWO).as('secondTodo') + it("should allow me to un-mark items as complete", function () { + cy.createTodo(TODO_ITEM_ONE).as("firstTodo"); + cy.createTodo(TODO_ITEM_TWO).as("secondTodo"); - cy.get('@firstTodo') - .find('.toggle') - .check() + cy.get("@firstTodo").find(".toggle").check(); - cy.get('@firstTodo').should('have.class', 'completed') - cy.get('@secondTodo').should('not.have.class', 'completed') + cy.get("@firstTodo").should("have.class", "completed"); + cy.get("@secondTodo").should("not.have.class", "completed"); - cy.get('@firstTodo') - .find('.toggle') - .uncheck() + cy.get("@firstTodo").find(".toggle").uncheck(); - cy.get('@firstTodo').should('not.have.class', 'completed') - cy.get('@secondTodo').should('not.have.class', 'completed') - }) + cy.get("@firstTodo").should("not.have.class", "completed"); + cy.get("@secondTodo").should("not.have.class", "completed"); + }); - it('should allow me to edit an item', function () { - cy.createDefaultTodos().as('todos') + it("should allow me to edit an item", function () { + cy.createDefaultTodos().as("todos"); - cy.get('@todos') - .eq(1) - .as('secondTodo') - // TODO: fix this, dblclick should - // have been issued to label - .find('label') - .dblclick() + cy.get("@todos") + .eq(1) + .as("secondTodo") + // TODO: fix this, dblclick should + // have been issued to label + .find("label") + .dblclick(); // clear out the inputs current value // and type a new value - cy.get('@secondTodo') - .find('.edit') - .clear() - .type('buy some sausages') - .type('{enter}') + cy.get("@secondTodo") + .find(".edit") + .clear() + .type("buy some sausages") + .type("{enter}"); // explicitly assert about the text value - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@secondTodo').should('contain', 'buy some sausages') - cy.get('@todos') - .eq(2) - .should('contain', TODO_ITEM_THREE) - }) - }) - - context('Editing', function () { + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@secondTodo").should("contain", "buy some sausages"); + cy.get("@todos").eq(2).should("contain", TODO_ITEM_THREE); + }); + }); + + context("Editing", function () { // New commands used here: // - cy.blur https://on.cypress.io/api/blur beforeEach(function () { - cy.createDefaultTodos().as('todos') - }) - - it('should hide other controls when editing', function () { - cy.get('@todos') - .eq(1) - .as('secondTodo') - .find('label') - .dblclick() - - cy.get('@secondTodo') - .find('.toggle') - .should('not.be.visible') - - cy.get('@secondTodo') - .find('label') - .should('not.be.visible') - }) - - it('should save edits on blur', function () { - cy.get('@todos') - .eq(1) - .as('secondTodo') - .find('label') - .dblclick() - - cy.get('@secondTodo') - .find('.edit') - .clear() - .type('buy some sausages') - // we can just send the blur event directly - // to the input instead of having to click - // on another button on the page. though you - // could do that its just more mental work - .blur() - - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@secondTodo').should('contain', 'buy some sausages') - cy.get('@todos') - .eq(2) - .should('contain', TODO_ITEM_THREE) - }) - - it('should trim entered text', function () { - cy.get('@todos') - .eq(1) - .as('secondTodo') - .find('label') - .dblclick() - - cy.get('@secondTodo') - .find('.edit') - .clear() - .type(' buy some sausages ') - .type('{enter}') - - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@secondTodo').should('contain', 'buy some sausages') - cy.get('@todos') - .eq(2) - .should('contain', TODO_ITEM_THREE) - }) - - it('should remove the item if an empty text string was entered', function () { - cy.get('@todos') - .eq(1) - .as('secondTodo') - .find('label') - .dblclick() - - cy.get('@secondTodo') - .find('.edit') - .clear() - .type('{enter}') - - cy.get('@todos').should('have.length', 2) - }) - - it('should cancel edits on escape', function () { - cy.get('@todos') - .eq(1) - .as('secondTodo') - .find('label') - .dblclick() - - cy.get('@secondTodo') - .find('.edit') - .clear() - .type('foo{esc}') - - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@todos') - .eq(1) - .should('contain', TODO_ITEM_TWO) - - cy.get('@todos') - .eq(2) - .should('contain', TODO_ITEM_THREE) - }) - }) - - context('Counter', function () { - it('should display the current number of todo items', function () { - cy.createTodo(TODO_ITEM_ONE) - cy.get('.todo-count').contains('1 item left') - cy.createTodo(TODO_ITEM_TWO) - cy.get('.todo-count').contains('2 items left') - }) - }) - - context('Clear completed button', function () { + cy.createDefaultTodos().as("todos"); + }); + + it("should hide other controls when editing", function () { + cy.get("@todos").eq(1).as("secondTodo").find("label").dblclick(); + + cy.get("@secondTodo").find(".toggle").should("not.be.visible"); + + cy.get("@secondTodo").find("label").should("not.be.visible"); + }); + + it("should save edits on blur", function () { + cy.get("@todos").eq(1).as("secondTodo").find("label").dblclick(); + + cy.get("@secondTodo") + .find(".edit") + .clear() + .type("buy some sausages") + // we can just send the blur event directly + // to the input instead of having to click + // on another button on the page. though you + // could do that its just more mental work + .blur(); + + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@secondTodo").should("contain", "buy some sausages"); + cy.get("@todos").eq(2).should("contain", TODO_ITEM_THREE); + }); + + it("should trim entered text", function () { + cy.get("@todos").eq(1).as("secondTodo").find("label").dblclick(); + + cy.get("@secondTodo") + .find(".edit") + .clear() + .type(" buy some sausages ") + .type("{enter}"); + + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@secondTodo").should("contain", "buy some sausages"); + cy.get("@todos").eq(2).should("contain", TODO_ITEM_THREE); + }); + + it("should remove the item if an empty text string was entered", function () { + cy.get("@todos").eq(1).as("secondTodo").find("label").dblclick(); + + cy.get("@secondTodo").find(".edit").clear().type("{enter}"); + + cy.get("@todos").should("have.length", 2); + }); + + it("should cancel edits on escape", function () { + cy.get("@todos").eq(1).as("secondTodo").find("label").dblclick(); + + cy.get("@secondTodo").find(".edit").clear().type("foo{esc}"); + + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@todos").eq(1).should("contain", TODO_ITEM_TWO); + + cy.get("@todos").eq(2).should("contain", TODO_ITEM_THREE); + }); + }); + + context("Counter", function () { + it("should display the current number of todo items", function () { + cy.createTodo(TODO_ITEM_ONE); + cy.get(".todo-count").contains("1 item left"); + cy.createTodo(TODO_ITEM_TWO); + cy.get(".todo-count").contains("2 items left"); + }); + }); + + context("Clear completed button", function () { beforeEach(function () { - cy.createDefaultTodos().as('todos') - }) - - it('should display the correct text', function () { - cy.get('@todos') - .eq(0) - .find('.toggle') - .check() - - cy.get('.clear-completed').contains('Clear completed') - }) - - it('should remove completed items when clicked', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.clear-completed').click() - cy.get('@todos').should('have.length', 2) - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@todos') - .eq(1) - .should('contain', TODO_ITEM_THREE) - }) - - it('should be hidden when there are no items that are completed', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.clear-completed') - .should('be.visible') - .click() - - cy.get('.clear-completed').should('not.be.visible') - }) - }) - - context('Persistence', function () { - it('should persist its data', function () { + cy.createDefaultTodos().as("todos"); + }); + + it("should display the correct text", function () { + cy.get("@todos").eq(0).find(".toggle").check(); + + cy.get(".clear-completed").contains("Clear completed"); + }); + + it("should remove completed items when clicked", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".clear-completed").click(); + cy.get("@todos").should("have.length", 2); + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@todos").eq(1).should("contain", TODO_ITEM_THREE); + }); + + it("should be hidden when there are no items that are completed", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".clear-completed").should("be.visible").click(); + + cy.get(".clear-completed").should("not.be.visible"); + }); + }); + + context("Persistence", function () { + it("should persist its data", function () { // mimicking TodoMVC tests // by writing out this function - function testState () { - cy.get('@firstTodo') - .should('contain', TODO_ITEM_ONE) - .and('have.class', 'completed') - - cy.get('@secondTodo') - .should('contain', TODO_ITEM_TWO) - .and('not.have.class', 'completed') + function testState() { + cy.get("@firstTodo") + .should("contain", TODO_ITEM_ONE) + .and("have.class", "completed"); + + cy.get("@secondTodo") + .should("contain", TODO_ITEM_TWO) + .and("not.have.class", "completed"); } - cy.createTodo(TODO_ITEM_ONE).as('firstTodo') - cy.createTodo(TODO_ITEM_TWO).as('secondTodo') - cy.get('@firstTodo') - .find('.toggle') - .check() - .then(testState) + cy.createTodo(TODO_ITEM_ONE).as("firstTodo"); + cy.createTodo(TODO_ITEM_TWO).as("secondTodo"); + cy.get("@firstTodo") + .find(".toggle") + .check() + .then(testState) - .reload() - .then(testState) - }) - }) + .reload() + .then(testState); + }); + }); - context('Routing', function () { + context("Routing", function () { // New commands used here: // https://on.cypress.io/window // https://on.cypress.io/its @@ -524,97 +418,62 @@ describe('TodoMVC', function () { // https://on.cypress.io/within beforeEach(function () { - cy.createDefaultTodos().as('todos') - }) - - it('should allow me to display active items', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.filters') - .contains('Active') - .click() - - cy.get('@todos') - .eq(0) - .should('contain', TODO_ITEM_ONE) - - cy.get('@todos') - .eq(1) - .should('contain', TODO_ITEM_THREE) - }) - - it('should respect the back button', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.filters') - .contains('Active') - .click() - - cy.get('.filters') - .contains('Completed') - .click() - - cy.get('@todos').should('have.length', 1) - cy.go('back') - cy.get('@todos').should('have.length', 2) - cy.go('back') - cy.get('@todos').should('have.length', 3) - }) - - it('should allow me to display completed items', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.filters') - .contains('Completed') - .click() - - cy.get('@todos').should('have.length', 1) - }) - - it('should allow me to display all items', function () { - cy.get('@todos') - .eq(1) - .find('.toggle') - .check() - - cy.get('.filters') - .contains('Active') - .click() - - cy.get('.filters') - .contains('Completed') - .click() - - cy.get('.filters') - .contains('All') - .click() - - cy.get('@todos').should('have.length', 3) - }) - - it('should highlight the currently applied filter', function () { + cy.createDefaultTodos().as("todos"); + }); + + it("should allow me to display active items", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".filters").contains("Active").click(); + + cy.get("@todos").eq(0).should("contain", TODO_ITEM_ONE); + + cy.get("@todos").eq(1).should("contain", TODO_ITEM_THREE); + }); + + it("should respect the back button", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".filters").contains("Active").click(); + + cy.get(".filters").contains("Completed").click(); + + cy.get("@todos").should("have.length", 1); + cy.go("back"); + cy.get("@todos").should("have.length", 2); + cy.go("back"); + cy.get("@todos").should("have.length", 3); + }); + + it("should allow me to display completed items", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".filters").contains("Completed").click(); + + cy.get("@todos").should("have.length", 1); + }); + + it("should allow me to display all items", function () { + cy.get("@todos").eq(1).find(".toggle").check(); + + cy.get(".filters").contains("Active").click(); + + cy.get(".filters").contains("Completed").click(); + + cy.get(".filters").contains("All").click(); + + cy.get("@todos").should("have.length", 3); + }); + + it("should highlight the currently applied filter", function () { // using a within here which will automatically scope // nested 'cy' queries to our parent element - cy.get('.filters').within(function () { - cy.contains('All').should('have.class', 'selected') - cy.contains('Active') - .click() - .should('have.class', 'selected') - - cy.contains('Completed') - .click() - .should('have.class', 'selected') - }) - }) - }) - -}) + cy.get(".filters").within(function () { + cy.contains("All").should("have.class", "selected"); + cy.contains("Active").click().should("have.class", "selected"); + + cy.contains("Completed").click().should("have.class", "selected"); + }); + }); + }); +}); From 53f7647bb6776335be7ca2e17718a96e5aa7347d Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 15:21:43 +0500 Subject: [PATCH 2/7] trigger workflow --- cypress/integration/app.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/app.spec.js b/cypress/integration/app.spec.js index 0b7a0596..29256696 100644 --- a/cypress/integration/app.spec.js +++ b/cypress/integration/app.spec.js @@ -56,7 +56,7 @@ describe("TodoMVC", function () { // a very simple example helpful during presentations it("adds 2 todos", function () { cy.get(".new-todo") - .type("learn testing in Cypress{enter}") + .type("learn testing in Cypress now{enter}") .type("be cool{enter}"); cy.get(".todo-list li").should("have.length", 2); From a8d9d3fbd929b4fd6273bc463a4540cc4d4414b7 Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 16:46:26 +0500 Subject: [PATCH 3/7] second flow --- .github/workflows/test-app.yml | 6 +++++- cypress.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-app.yml b/.github/workflows/test-app.yml index ae2b0501..621aa5f8 100644 --- a/.github/workflows/test-app.yml +++ b/.github/workflows/test-app.yml @@ -14,4 +14,8 @@ jobs: uses: cypress-io/github-action@v2 with: build: npm run build - start: npm start \ No newline at end of file + start: npm start + record: true + env: + CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}}, + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/cypress.json b/cypress.json index e69d185f..21250db2 100644 --- a/cypress.json +++ b/cypress.json @@ -1,4 +1,4 @@ { "baseUrl": "http://localhost:8080", - "projectId": "4qto2e" + "projectId": "bjihq9" } From 95431e4048b5968d95ec01b1d71be676272724f5 Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 16:58:15 +0500 Subject: [PATCH 4/7] third flow --- .github/workflows/test-app.yml | 4 ---- cypress/integration/app.spec.js | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test-app.yml b/.github/workflows/test-app.yml index 621aa5f8..8a23e60d 100644 --- a/.github/workflows/test-app.yml +++ b/.github/workflows/test-app.yml @@ -15,7 +15,3 @@ jobs: with: build: npm run build start: npm start - record: true - env: - CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}}, - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/cypress/integration/app.spec.js b/cypress/integration/app.spec.js index 29256696..4a8a3a43 100644 --- a/cypress/integration/app.spec.js +++ b/cypress/integration/app.spec.js @@ -55,9 +55,7 @@ describe("TodoMVC", function () { // a very simple example helpful during presentations it("adds 2 todos", function () { - cy.get(".new-todo") - .type("learn testing in Cypress now{enter}") - .type("be cool{enter}"); + cy.get(".new-todo").type("learn testing{enter}").type("be cool{enter}"); cy.get(".todo-list li").should("have.length", 2); }); From 94f8c97047984cd7c579b4a98f5893d11d769356 Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 17:08:47 +0500 Subject: [PATCH 5/7] fourth flow --- .github/workflows/test-app.yml | 4 ++++ cypress.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-app.yml b/.github/workflows/test-app.yml index 8a23e60d..bc9326e5 100644 --- a/.github/workflows/test-app.yml +++ b/.github/workflows/test-app.yml @@ -15,3 +15,7 @@ jobs: with: build: npm run build start: npm start + record: true + env: + CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/cypress.json b/cypress.json index 21250db2..9f3f8012 100644 --- a/cypress.json +++ b/cypress.json @@ -1,4 +1,4 @@ { "baseUrl": "http://localhost:8080", - "projectId": "bjihq9" + "projectId": "cq1bvo" } From 5c668875d9cca892be56120eeae95990abfb9f2c Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 17:13:19 +0500 Subject: [PATCH 6/7] fifth flow --- .github/workflows/test-app.yml | 4 ++++ cypress.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-app.yml b/.github/workflows/test-app.yml index 8a23e60d..bc9326e5 100644 --- a/.github/workflows/test-app.yml +++ b/.github/workflows/test-app.yml @@ -15,3 +15,7 @@ jobs: with: build: npm run build start: npm start + record: true + env: + CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/cypress.json b/cypress.json index 21250db2..9f3f8012 100644 --- a/cypress.json +++ b/cypress.json @@ -1,4 +1,4 @@ { "baseUrl": "http://localhost:8080", - "projectId": "bjihq9" + "projectId": "cq1bvo" } From dcddc5779db69d0aed6c7db44c684fe964feae17 Mon Sep 17 00:00:00 2001 From: UsmanGhani-Emumba Date: Sun, 18 Jul 2021 17:38:34 +0500 Subject: [PATCH 7/7] sixth flow --- .vscode/mocha.tree.json | 8 ++++++++ cypress/integration/app.spec.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .vscode/mocha.tree.json diff --git a/.vscode/mocha.tree.json b/.vscode/mocha.tree.json new file mode 100644 index 00000000..60b22ecd --- /dev/null +++ b/.vscode/mocha.tree.json @@ -0,0 +1,8 @@ +{ + "id": "root", + "title": "root", + "file": null, + "state": "idle", + "tests": null, + "suites": null +} \ No newline at end of file diff --git a/cypress/integration/app.spec.js b/cypress/integration/app.spec.js index 4a8a3a43..0e222f3b 100644 --- a/cypress/integration/app.spec.js +++ b/cypress/integration/app.spec.js @@ -57,7 +57,7 @@ describe("TodoMVC", function () { it("adds 2 todos", function () { cy.get(".new-todo").type("learn testing{enter}").type("be cool{enter}"); - cy.get(".todo-list li").should("have.length", 2); + cy.get(".todo-list li").should("have.length", 3); }); context("No Todos", function () {