Skip to content

Commit

Permalink
Merge pull request #10 from TheoGicquel/develop
Browse files Browse the repository at this point in the history
Release 1.0.0 - End of project
  • Loading branch information
TheoGicquel authored Dec 15, 2022
2 parents 495598c + dfc6639 commit 4a869a6
Show file tree
Hide file tree
Showing 18 changed files with 276 additions and 54 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@
<img src="https://github.com/TheoGicquel/Djangolic/actions/workflows/CI.yml/badge.svg?branch=develop">
</a>

<a style="display:inline" href="https://wakatime.com/badge/github/TheoGicquel/Djangolic"><img src="https://wakatime.com/badge/github/TheoGicquel/Djangolic.svg" alt="wakatime"></a>

</div>



A Django + Tailwind CRUD app to search and organize beers.




## Authors

- [@TheoGicquel](https://www.github.com/TheoGicquel) : **Frontend, Backend, Tests** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=TheoGicquel) <a href="https://wakatime.com/badge/github/TheoGicquel/Djangolic"><img src="https://wakatime.com/badge/github/TheoGicquel/Djangolic.svg" alt="wakatime"></a>
- [@Hazarel](https://www.github.com/Hazarel) ( AKA Maxime Joubert ) : **Tests** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=Hazarel)
- [@Volpe08](https://github.com/Volpe08) ( AKA Fabien Rivet ) : **Model** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=Volpe08)

## Features

- Search for beers using different criterias
Expand Down Expand Up @@ -73,11 +83,3 @@ If you wish to run tests in the interactive GUI provided by cypress, launch the
```bash
./cypress.sh
```


## Authors

- [@TheoGicquel](https://www.github.com/TheoGicquel) : **Frontend, Backend, Tests** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=TheoGicquel)
- [@Hazarel](https://www.github.com/Hazarel) ( AKA Maxime Joubert ) : **Tests** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=Hazarel)
- [@Volpe08](https://github.com/Volpe08) ( AKA Fabien Rivet ) : **Model** - [View commits](https://github.com/TheoGicquel/Djangolic/commits?author=Volpe08)

2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
source venv/bin/activate
elif [[ "$OSTYPE" == "msys" ]]; then
source venv/Scripts/activate
elif [[ "$OSTYPE" == "darwin" ]]; then
source venv/Scripts/activate
fi

echo "[OK] venv setup complete"
Expand Down
14 changes: 13 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"devDependencies": {
"@nrwl/cli": "^15.3.0",
"@nrwl/cypress": "^15.2.4",
"@nrwl/devkit": "15.2.4",
"@nrwl/eslint-plugin-nx": "15.2.4",
"@nrwl/js": "15.2.4",
"@nrwl/linter": "15.2.4",
"@nrwl/nx-cloud": "^15.0.2",
"@nrwl/workspace": "15.2.4",
"@types/node": "16.11.7",
"@types/node": "latest",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"cypress": "^11.2.0",
Expand All @@ -22,5 +23,8 @@
"nx": "^15.3.0",
"prettier": "^2.6.2",
"typescript": "~4.8.2"
},
"dependencies": {
"pyyaml": "^0.0.1"
}
}
2 changes: 1 addition & 1 deletion packages/djangolic-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';

export default defineConfig({
projectId: 'j7dkfr',
e2e: {
...nxE2EPreset(__dirname),
experimentalRunAllSpecs: true,
baseUrl: 'http://127.0.0.1:8000',
defaultCommandTimeout: 10000,// prob overkill but github actions is slow
retries: 2,
video: false,
screenshotOnRunFailure: false,
Expand Down
34 changes: 34 additions & 0 deletions packages/djangolic-e2e/src/e2e/page-title.cy.js
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")
})

})


46 changes: 46 additions & 0 deletions packages/djangolic-e2e/src/e2e/scenario_create.cy.js
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()

})




})

63 changes: 63 additions & 0 deletions packages/djangolic-e2e/src/e2e/scenario_search_edit.cy.js
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")

})


})

3 changes: 3 additions & 0 deletions packages/djangolic-e2e/src/e2e/search.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
describe('The Search form', () => {

/**
* We cannot use data-cy at the moment since the form is generated by crispy forms
*/
beforeEach(() => {
cy.visit('/search')
})
Expand Down
44 changes: 28 additions & 16 deletions packages/djangolic-e2e/src/e2e/search_page_inputs.cy.js
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/')
*/
})
})

})

})
2 changes: 1 addition & 1 deletion packages/djangolic/Gueze/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{title}}</title>
<title data-cy="page-title" >{{title}}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
Expand Down
4 changes: 2 additions & 2 deletions packages/djangolic/Gueze/templates/beer/action-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
class="inline-block p-3 text-gray-700 hover:bg-blue-50 focus:relative"
title="Edit Beer"
>
<a href="/beer/{{beer.id}}/edit">
<a data-cy="edit-button" href="/beer/{{beer.id}}/edit">
<i class="fa-solid fa-pen"></i>
</a>
</button>

<button
class="inline-block p-3 text-gray-700 hover:bg-gray-50 focus:relative"
title="View Beer"
><a href="/beer/{{beer.id}}/view">
><a data-cy="view-button" href="/beer/{{beer.id}}/view">
<i class="fa-solid fa-eye"></i>
</a>
</button>
Expand Down
4 changes: 2 additions & 2 deletions packages/djangolic/Gueze/templates/beer/beer-card.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<article
<article data-cy="beer-article"
class="rounded-lg bg-white border border-gray-100 p-4 shadow-sm transition hover:shadow-lg sm:p-6 mt-4"
>
<a href="/beer/{{beer.id}}/view">
<a data-cy="beer-card-view-link" href="/beer/{{beer.id}}/view">
<h3 class="mt-0.5 text-lg font-medium text-gray-900">{{ beer.name }}</h3>
</a>

Expand Down
Loading

0 comments on commit 4a869a6

Please sign in to comment.