Skip to content

Commit 5e554ae

Browse files
committed
test: ✅ add keyword filtering browser test
1 parent 9115058 commit 5e554ae

File tree

15 files changed

+195
-0
lines changed

15 files changed

+195
-0
lines changed

apps/402-recipe-search-filter-interaction-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/403-recipe-search-add-button-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/403-recipe-search-add-button-starter/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/404-recipe-filter-material-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/404-recipe-filter-material-starter/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/501-recipe-preview-ct-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/501-recipe-preview-ct-starter/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/502-recipe-filter-ct-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/502-recipe-filter-ct-starter/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

apps/503-recipe-search-ct-solution/src/app/recipe/recipe-search.browser.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ describe(RecipeSearch.name, () => {
1616
await expect.element(getRecipeNameEls().nth(1)).toHaveTextContent('Salad');
1717
});
1818

19+
it('filters recipes by keywords', async () => {
20+
const { getRecipeNameEls, updateFilter } = await mountRecipeSearch();
21+
22+
await updateFilter({
23+
keywords: 'Burg',
24+
});
25+
26+
await expect.element(getRecipeNameEls()).toHaveTextContent('Burger');
27+
});
28+
1929
async function mountRecipeSearch() {
2030
TestBed.configureTestingModule({
2131
providers: [provideRecipeRepositoryFake()],
@@ -32,6 +42,9 @@ describe(RecipeSearch.name, () => {
3242
getRecipeNameEls() {
3343
return page.getByRole('heading');
3444
},
45+
async updateFilter({ keywords }: { keywords: string }) {
46+
await page.getByLabelText('Keywords').fill(keywords);
47+
},
3548
};
3649
}
3750
});

0 commit comments

Comments
 (0)