From dfc6639b74ab8f97814ebdae98f456a55e469cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Gicquel?= Date: Thu, 15 Dec 2022 23:45:58 +0100 Subject: [PATCH] added create test --- .../src/e2e/scenario_create.cy.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 packages/djangolic-e2e/src/e2e/scenario_create.cy.js diff --git a/packages/djangolic-e2e/src/e2e/scenario_create.cy.js b/packages/djangolic-e2e/src/e2e/scenario_create.cy.js new file mode 100644 index 0000000..49426f5 --- /dev/null +++ b/packages/djangolic-e2e/src/e2e/scenario_create.cy.js @@ -0,0 +1,46 @@ +const fischerTaste = "Avec sa robe dorée et ses délicats arômes sucrés, La Belle Mira met tout le monde d'accord."; + + +describe('A user i searching for a Kwak beer', () => { + // reset database to reload fixtures + + before(() => { + Cypress.Cookies.preserveOnce('csrftoken') + cy.clearCookies() + cy.exec("npx nx run djangolic:db-init") + }) + + + + it('successfully loads', () => { + cy.visit('/') + }) + + + it('fills form', () => { + cy.visit('/create') + + cy.get('input[name*="name"]').type('Fischer La Belle Mira').should('have.value', 'Fischer La Belle Mira') + cy.get('input[name*="abv"]').type('5.8').should('have.value', '5.8') + cy.get('input[name*="taste"]').type(fischerTaste).should('have.value', fischerTaste) + cy.get('input[name*="ibu"]').type('20').should('have.value', '20') + cy.get('input[name*="image"]').type('https://www.biere-discount.com/img/p/5/1/5/515-thickbox_default.jpg') + cy.get('select#id_brewery').select('Brasserie Fischer (brasserie du Pécheur)') + cy.get('select#id_countries_sold_in').select(['France']) + cy.get('select#id_style').select('Generic') + cy.get('select#id_type').select('Spéciale') + cy.get('select#id_glass').select('Goblet') + + + }) + + it('submits the form', () => { + cy.get('button[type*="submit"]').click() + + }) + + + + +}) + \ No newline at end of file