-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from TheoGicquel/develop
Release 1.0.0 - End of project
- Loading branch information
Showing
18 changed files
with
276 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
describe('Title tags', () => { | ||
|
||
|
||
it('Index page correctly named', () => { | ||
cy.visit('/') | ||
cy.get("[data-cy=page-title]").should("contain", "index") | ||
}) | ||
|
||
it('About page correctly named', () => { | ||
cy.visit('/about') | ||
cy.get("[data-cy=page-title]").should("contain", "About") | ||
}) | ||
|
||
it('Search page correctly named', () => { | ||
cy.visit('/search') | ||
cy.get("[data-cy=page-title]").should("contain", "Search") | ||
}) | ||
|
||
|
||
it('Create page correctly named', () => { | ||
cy.visit('/create') | ||
cy.get("[data-cy=page-title]").should("contain", "Create") | ||
}) | ||
|
||
|
||
it('Beer page correctly named', () => { | ||
cy.visit('/beer/1/view') | ||
cy.get("[data-cy=page-title]").should("contain", "View") | ||
}) | ||
|
||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
|
||
}) | ||
|
||
|
||
|
||
|
||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
|
||
|
||
describe('A user i searching for a Kwak beer', () => { | ||
// reset database to reload fixtures | ||
|
||
before(() => { | ||
cy.exec("npx nx run djangolic:db-init") | ||
}) | ||
|
||
/** | ||
* We assume the user does not remember the spelling of kwak, searches by country instead | ||
*/ | ||
|
||
it('successfully loads', () => { | ||
cy.visit('/') | ||
}) | ||
|
||
it('goes to the search page', () => { | ||
cy.get("[data-cy=search-button]").click() | ||
cy.url().should('include', '/search') | ||
cy.get("[data-cy=page-title]").should("contain", "Search",{ matchCase: false }) | ||
}) | ||
|
||
it('selects belgium', () => { | ||
cy.get('select#id_countries_sold_in').select(['Belgium']) | ||
}) | ||
|
||
it('submits the form', () => { | ||
cy.get('button[type*="submit"]').click() | ||
|
||
}) | ||
|
||
it('finds the card associated to the Kwak beer', () => { | ||
cy.get("[data-cy=beer-article] h3").should("contain", "Kwak") | ||
|
||
cy.get('[data-cy=edit-button]').should('exist').closest('[data-cy=beer-article]') | ||
.should('have.attr', 'data-cy', 'beer-article').and('contain', 'Kwak') | ||
|
||
cy.get('[data-cy=beer-card-view-link]').should('exist').closest('[data-cy=beer-article]') | ||
.should('have.attr', 'data-cy', 'beer-article').and('contain', 'Kwak') | ||
|
||
}) | ||
|
||
it('goes to kwak page', () => { | ||
|
||
cy.get("h3").contains("Kwak").click() | ||
}) | ||
|
||
|
||
it('changes Taste value', () => { | ||
cy.url().should('include', '/beer/3') | ||
cy.get("a").contains("Edit").click() | ||
cy.get("input[name='taste']").clear().type("lorem ipsum dolor sit amet") | ||
cy.get("button").contains("Search").click() | ||
cy.url().should('include', '/beer/3') | ||
cy.get("p").contains("lorem ipsum dolor sit amet") | ||
|
||
}) | ||
|
||
|
||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,50 @@ | ||
const baseUrl = Cypress.config().baseUrl; | ||
describe('Testing filling a form', () => { | ||
it('successfully loads', () => { | ||
cy.visit('/search') | ||
|
||
// this needs refactoring, we dont know what the testing file is supposed to do.. | ||
// btw, since we are using GET requests, we can't really test the url, since it will include our form data | ||
/* | ||
|
||
}) | ||
|
||
it('fills name',() => { | ||
|
||
cy.get('input[name*="name"]').type('Guiness').should('have.value', 'Guiness') | ||
cy.get('select[name*="brewery"]').select('Asahi Biiru Kabushiki Gaisha') | ||
|
||
cy.get('select[name*="countries_sold_in"]').select('France') | ||
|
||
}) | ||
|
||
it('fills abv',() => { | ||
|
||
cy.get('input[name*="abv"]').type('-1').should('have.value', '-1') | ||
cy.get('button[type*="submit"]').click() | ||
cy.url().should('not.include', 'http://127.0.0.1:8000/search/results') | ||
cy.get('input[name*="abv"]').clear() | ||
|
||
cy.get('input[name*="abv"]').type('101').should('have.value', '101') | ||
cy.get('button[type*="submit"]').click() | ||
cy.url().should('not.include', 'http://127.0.0.1:8000/search/results') | ||
cy.get('input[name*="abv"]').clear() | ||
|
||
cy.get('input[name*="ibu"]').type('-1').should('have.value', '-1') | ||
cy.get('button[type*="submit"]').click() | ||
cy.url().should('not.include', 'http://127.0.0.1:8000/search/results') | ||
cy.get('input[name*="ibu"]').clear() | ||
}) | ||
|
||
it('modifies IBU value',() => { | ||
|
||
|
||
cy.get('input[name*="ibu"]').type('201').should('have.value', '201') | ||
cy.get('button[type*="submit"]').click() | ||
cy.url().should('not.include', 'http://127.0.0.1:8000/search/results') | ||
cy.get('input[name*="ibu"]').clear() | ||
|
||
cy.get('input[name*="ibu"]').type('20').should('have.value', '20') | ||
cy.get('input[name*="ibu"]').clear() | ||
|
||
cy.get('input[name*="ibu"]').type('120').should('have.value', '120') | ||
cy.get('input[name*="ibu"]').clear() | ||
|
||
|
||
}) | ||
|
||
it('submits form',() => { | ||
|
||
cy.get('button[type*="submit"]').click() | ||
cy.url().should('include', 'http://127.0.0.1:8000/search/results/') | ||
*/ | ||
}) | ||
}) | ||
|
||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.