Skip to content

Commit 2ab2445

Browse files
feat: add shopping lists (#359)
1 parent 0ed38d1 commit 2ab2445

File tree

76 files changed

+1156
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1156
-286
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"codeium.codeium",
55
"dbaeumer.vscode-eslint",
66
"esbenp.prettier-vscode",
7-
"bradlc.vscode-tailwindcss"
7+
"bradlc.vscode-tailwindcss",
8+
"huuums.vscode-fast-folder-structure"
89
]
910
}

.vscode/settings.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,29 @@
66
"editor.detectIndentation": false,
77
"editor.defaultFormatter": "esbenp.prettier-vscode",
88
"editor.formatOnSave": true,
9-
"[jsonc]": {
10-
"editor.defaultFormatter": "vscode.json-language-features"
11-
},
12-
"[xml]": {
13-
"editor.defaultFormatter": "mikeburgh.xml-format"
14-
},
15-
"[html]": {
16-
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
"folderTemplates.structures": [
10+
{
11+
"name": "Aurelia Component ( HTML + TS )",
12+
"customVariables": ["fileName"],
13+
"omitParentDirectory": true,
14+
"omitFTName": true,
15+
"openFilesWhenDone": ["*.html", "*.ts"],
16+
"structure": [
17+
{
18+
"fileName": "<fileName | kebabcase>/<fileName | kebabcase>.ts",
19+
"template": "ts-class-with-autoinject"
20+
},
21+
{
22+
"fileName": "<fileName | kebabcase>/<fileName | kebabcase>.html",
23+
"template": "empty-html-file"
24+
}
25+
]
26+
}
27+
],
28+
"folderTemplates.fileTemplates": {
29+
"empty-html-file": ["<template> </template>"],
30+
"ts-class-with-autoinject": [
31+
"import { autoinject } from 'aurelia-framework' \n\n @autoinject \n\n export class <fileName | pascalcase> { \n\n constructor() {} \n\n } \n\n"
32+
]
1733
}
1834
}

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.moimob.drinkable"
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
10-
versionCode 13500
11-
versionName "1.35.0"
10+
versionCode 13600
11+
versionName "1.36.0"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
aaptOptions {
1414
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from 'cypress';
22

33
export default defineConfig({
44
e2e: {
5-
setupNodeEvents(on, config) {
5+
setupNodeEvents() {
66
// implement node event listeners here
77
},
88
baseUrl: 'http://localhost:8080',

cypress/e2e/cocktails.cy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ describe('Cocktails', () => {
1313

1414
cy.dataCy('save-cocktail').click();
1515

16-
cy.dataCy('cocktail-name').should('have.class', 'input-error').type('Test Cocktail').blur();
16+
cy.dataCy('cocktail-name').should('have.class', 'input-error').type('Test Cocktail');
17+
cy.dataCy('cocktail-name').blur();
1718

1819
cy.dataCy('cocktail-image').selectFile('static/images/balmoral.jpg', { force: true });
1920

@@ -83,7 +84,8 @@ describe('Cocktails', () => {
8384

8485
cy.dataCy('create-cocktail').click();
8586

86-
cy.dataCy('cocktail-name').type('Test Cocktail').blur();
87+
cy.dataCy('cocktail-name').type('Test Cocktail');
88+
cy.dataCy('cocktail-name').blur();
8789
cy.dataCy('cocktail-image').selectFile('static/images/balmoral.jpg', { force: true });
8890
cy.dataCy('textarea').type('Test Instructions');
8991
cy.dataCy('save-cocktail').click();

cypress/e2e/home.cy.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
describe('Home', () => {
2+
it('Navigate to Favorites', () => {
3+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
4+
cy.visit('#/');
5+
6+
cy.get('header').should('contain.text', 'Home');
7+
cy.url().should('include', `home-router`);
8+
9+
cy.dataCy('navigate-favorites').click();
10+
11+
cy.get('header').should('contain.text', 'Cocktails');
12+
cy.url().should('include', `cocktails`);
13+
});
14+
15+
it('Navigate to Shopping Lists', () => {
16+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
17+
cy.visit('#/');
18+
19+
cy.get('header').should('contain.text', 'Home');
20+
cy.url().should('include', `home-router`);
21+
22+
cy.dataCy('navigate-shopping-lists').click();
23+
24+
cy.get('header').should('contain.text', 'Profile');
25+
cy.url().should('include', `shopping-lists`);
26+
});
27+
});

cypress/e2e/ingredients.cy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ describe('Ingredients', () => {
4040

4141
cy.visit('#/ingredients');
4242

43-
cy.dataCy('add-ingredients-search').type('a').clear();
43+
cy.dataCy('add-ingredients-search').type('a');
44+
cy.dataCy('add-ingredients-search').clear();
4445

4546
cy.dataCy('ingredient-tags-container')
4647
.children()
@@ -51,9 +52,9 @@ describe('Ingredients', () => {
5152
});
5253

5354
function navigateToInventory() {
54-
cy.dataCy('nav-0').click().wait(200);
55+
cy.dataCy('nav-0').click();
5556
}
5657

5758
function navigateToAllIngredients() {
58-
cy.dataCy('nav-1').click().wait(200);
59+
cy.dataCy('nav-1').click();
5960
}

cypress/e2e/settings.cy.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ describe('General Settings', () => {
3535
cy.dataCy('input-email').should('have.class', 'input-error');
3636
cy.dataCy('textarea').should('have.class', 'input-error');
3737

38-
cy.dataCy('input-email').type('[email protected]').blur();
39-
cy.dataCy('textarea').type('message').blur();
38+
cy.dataCy('input-email').type('[email protected]');
39+
cy.dataCy('input-email').blur();
40+
41+
cy.dataCy('textarea').type('message');
42+
cy.dataCy('textarea').blur();
4043

4144
cy.dataCy('input-email').should('not.have.class', 'input-error');
4245
cy.dataCy('textarea').should('not.have.class', 'input-error');

cypress/e2e/shopping-list.cy.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
describe('Shopping Lists', () => {
2+
it('Add Ingredients to list and Mark one as Shopped', () => {
3+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
4+
window.localStorage.setItem(
5+
'CapacitorStorage.shopping-lists',
6+
JSON.stringify([{ name: 'New Shopping List', id: 1, ingredients: [] }])
7+
);
8+
cy.visit('#/user');
9+
cy.dataCy('menu-user-shopping-lists').click();
10+
11+
cy.dataCy('shopping-list-container').children().first().click();
12+
13+
cy.dataCy('unshopped-ingredient-list').should('not.exist');
14+
cy.dataCy('shopped-ingredient-list').should('not.exist');
15+
16+
cy.dataCy('add-ingredients-search').type('Vodka');
17+
cy.dataCy('ingredient-tags-container').children().first().click();
18+
cy.dataCy('close-x-button').click();
19+
20+
cy.dataCy('add-ingredients-search').type('Tonic');
21+
cy.dataCy('ingredient-tags-container').children().first().click();
22+
cy.dataCy('close-x-button').click();
23+
24+
cy.dataCy('add-ingredients-search').type('Lime');
25+
cy.dataCy('ingredient-tags-container').children().first().click();
26+
cy.dataCy('close-x-button').click();
27+
28+
cy.dataCy('unshopped-ingredient-list')
29+
.children()
30+
.filter('[data-cy="shopping-list-ingredient"]')
31+
.should('have.length', 3);
32+
cy.dataCy('shopped-ingredient-list').should('not.exist');
33+
34+
cy.dataCy('unshopped-ingredient-list')
35+
.children()
36+
.filter('[data-cy="shopping-list-ingredient"]')
37+
.first()
38+
.find('input')
39+
.check();
40+
41+
cy.dataCy('unshopped-ingredient-list')
42+
.children()
43+
.filter('[data-cy="shopping-list-ingredient"]')
44+
.should('have.length', 2);
45+
cy.dataCy('shopped-ingredient-list')
46+
.children()
47+
.filter('[data-cy="shopping-list-ingredient"]')
48+
.should('have.length', 1);
49+
});
50+
51+
it('Delete Shopped Items', () => {
52+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
53+
window.localStorage.setItem(
54+
'CapacitorStorage.shopping-lists',
55+
JSON.stringify([
56+
{
57+
name: 'New Shopping List',
58+
id: 1,
59+
ingredients: [
60+
{ id: '8', shopped: false },
61+
{ id: '7', shopped: false },
62+
{ id: '2', shopped: true }
63+
]
64+
}
65+
])
66+
);
67+
cy.visit('#/user');
68+
cy.dataCy('menu-user-shopping-lists').click();
69+
70+
cy.dataCy('shopping-list-container').children().first().click();
71+
72+
cy.dataCy('unshopped-ingredient-list')
73+
.children()
74+
.filter('[data-cy="shopping-list-ingredient"]')
75+
.should('have.length', 2);
76+
cy.dataCy('shopped-ingredient-list')
77+
.children()
78+
.filter('[data-cy="shopping-list-ingredient"]')
79+
.should('have.length', 1);
80+
81+
cy.dataCy('delete-shopped').click();
82+
83+
cy.dataCy('unshopped-ingredient-list')
84+
.children()
85+
.filter('[data-cy="shopping-list-ingredient"]')
86+
.should('have.length', 2);
87+
88+
cy.dataCy('shopped-ingredient-list').should('not.exist');
89+
});
90+
91+
it('Restore Shopped Items', () => {
92+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
93+
window.localStorage.setItem(
94+
'CapacitorStorage.shopping-lists',
95+
JSON.stringify([
96+
{
97+
name: 'New Shopping List',
98+
id: 1,
99+
ingredients: [
100+
{ id: '8', shopped: false },
101+
{ id: '7', shopped: false },
102+
{ id: '2', shopped: true }
103+
]
104+
}
105+
])
106+
);
107+
cy.visit('#/user');
108+
cy.dataCy('menu-user-shopping-lists').click();
109+
110+
cy.dataCy('shopping-list-container').children().first().click();
111+
112+
cy.dataCy('unshopped-ingredient-list')
113+
.children()
114+
.filter('[data-cy="shopping-list-ingredient"]')
115+
.should('have.length', 2);
116+
cy.dataCy('shopped-ingredient-list')
117+
.children()
118+
.filter('[data-cy="shopping-list-ingredient"]')
119+
.should('have.length', 1);
120+
121+
cy.dataCy('restore-shopped').click();
122+
123+
cy.dataCy('unshopped-ingredient-list')
124+
.children()
125+
.filter('[data-cy="shopping-list-ingredient"]')
126+
.should('have.length', 3);
127+
128+
cy.dataCy('shopped-ingredient-list').should('not.exist');
129+
});
130+
});

cypress/e2e/shopping-lists.cy.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
describe('Shopping Lists', () => {
2+
it('Create - Default Name', () => {
3+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
4+
cy.visit('#/user');
5+
cy.dataCy('menu-user-shopping-lists').click();
6+
7+
cy.dataCy('shopping-list-container').children().should('have.length', 0);
8+
9+
cy.dataCy('add-shopping-list').click();
10+
cy.dataCy('drawer-ok').click();
11+
12+
cy.dataCy('shopping-list-container').children().should('have.length', 1).should('contain.text', 'To Shop on ');
13+
});
14+
15+
it('Create - Verify Form Validation', () => {
16+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
17+
cy.visit('#/user');
18+
cy.dataCy('menu-user-shopping-lists').click();
19+
20+
cy.dataCy('shopping-list-container').children().should('have.length', 0);
21+
22+
cy.dataCy('add-shopping-list').click();
23+
cy.dataCy('name-input').type(' ');
24+
cy.dataCy('drawer-ok').click();
25+
26+
cy.dataCy('shopping-list-drawer').should('contain.text', 'Name cannot be empty');
27+
28+
cy.dataCy('name-input').clear();
29+
cy.dataCy('name-input').type('New Shopping List');
30+
cy.dataCy('drawer-ok').click();
31+
32+
cy.dataCy('shopping-list-container').children().should('have.length', 1);
33+
});
34+
35+
it('Edit Name', () => {
36+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
37+
window.localStorage.setItem(
38+
'CapacitorStorage.shopping-lists',
39+
JSON.stringify([{ name: 'New Shopping List', id: 1, ingredients: [] }])
40+
);
41+
cy.visit('#/user');
42+
cy.dataCy('menu-user-shopping-lists').click();
43+
44+
cy.dataCy('shopping-list-container')
45+
.children()
46+
.should('have.length', 1)
47+
.first()
48+
.should('contain.text', 'New Shopping List');
49+
50+
cy.dataCy('open-dropdown').click();
51+
cy.dataCy('dropdown-edit-name').click();
52+
53+
cy.dataCy('name-input').clear();
54+
cy.dataCy('name-input').type('Updated');
55+
56+
cy.dataCy('drawer-ok').click();
57+
58+
cy.dataCy('shopping-list-container')
59+
.children()
60+
.should('have.length', 1)
61+
.first()
62+
.should('contain.text', 'Updated');
63+
});
64+
65+
it('Delete ShoppingList', () => {
66+
window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric');
67+
window.localStorage.setItem(
68+
'CapacitorStorage.shopping-lists',
69+
JSON.stringify([{ name: 'New Shopping List', id: 1, ingredients: [] }])
70+
);
71+
cy.visit('#/user');
72+
cy.dataCy('menu-user-shopping-lists').click();
73+
74+
cy.dataCy('shopping-list-container')
75+
.children()
76+
.should('have.length', 1)
77+
.first()
78+
.should('contain.text', 'New Shopping List');
79+
80+
cy.dataCy('open-dropdown').click();
81+
cy.dataCy('dropdown-delete').click();
82+
83+
cy.dataCy('shopping-list-container').children().should('have.length', 0);
84+
});
85+
});

0 commit comments

Comments
 (0)