-
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.
- Loading branch information
Showing
9 changed files
with
123 additions
and
24 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
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,73 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test("shows current week's veggies", async ({page}) => { | ||
await page.goto('/'); | ||
await page.getByTestId('home-start-button').click(); | ||
await page.getByTestId('veggie-search-button').click(); | ||
await page.getByText(/^apple$/).click(); | ||
await page.getByText('Apricot').click(); | ||
await page.getByText('Avocado').click(); | ||
const elements = await page.getByTestId('toast-message').all(); | ||
for (const element of elements) { | ||
await element.click(); | ||
} | ||
await page.getByTestId('navbar-link-stats').click(); | ||
await expect(page.getByTestId('tag-apple')).toBeVisible(); | ||
await expect(page.getByTestId('tag-apricot')).toBeVisible(); | ||
await expect(page.getByTestId('tag-avocado')).toBeVisible(); | ||
await page.getByTestId('tag-apple').click(); | ||
await page.getByTestId('tag-apricot').click(); | ||
await expect(page.getByTestId('tag-apple')).toBeHidden(); | ||
await expect(page.getByTestId('tag-apricot')).toBeHidden(); | ||
await page.getByTestId('navbar-link-log').click(); | ||
await expect(page.getByTestId('category-status-center-label')).toHaveText('This Week 1 Veggies'); | ||
}); | ||
|
||
test('shows last five weeks', async ({page}) => { | ||
await page.goto('/'); | ||
await page.getByTestId('home-start-button').click(); | ||
await page.getByTestId('veggie-search-button').click(); | ||
await page.getByText('Apricot').click(); | ||
await page.goto('stats'); | ||
await page.getByTestId('stats-dropdown-button').click(); | ||
await page.getByTestId('stats-dropdown-option-1').click(); | ||
await expect(page.getByTestId('weekly-amounts-chart')).toBeVisible(); | ||
await expect(page.getByTestId('weekly-categories-chart')).toBeVisible(); | ||
await expect(page.locator('#weekly-amounts-chart-table')).toBeAttached(); | ||
await expect(page.locator('#weekly-categories-chart-table')).toBeAttached(); | ||
}); | ||
|
||
test('shows all time stats', async ({page}) => { | ||
await page.goto('/'); | ||
await page.getByTestId('home-start-button').click(); | ||
await page.getByTestId('veggie-search-button').click(); | ||
await page.getByText('Apricot').click(); | ||
await page.getByText('Avocado').click(); | ||
await page.goto('stats'); | ||
await page.getByTestId('stats-dropdown-button').click(); | ||
await page.getByTestId('stats-dropdown-option-2').click(); | ||
await expect(page.getByTestId('all-time-weeks')).toHaveText('In Total 1 Weeks'); | ||
await expect(page.getByTestId('all-time-over-30')).toHaveText('Over 30 Veggies in 0 Weeks'); | ||
await expect(page.getByTestId('all-time-unique')).toHaveText('In Total 2 Unique Veggies'); | ||
await expect(page.getByTestId('all-time-at-most')).toHaveText('At Most 2 Veggies in a Week'); | ||
}); | ||
|
||
test('shows achievements', async ({page}) => { | ||
await page.goto('/'); | ||
await page.getByTestId('home-start-button').click(); | ||
await page.getByTestId('veggie-search-button').click(); | ||
const elements = ( | ||
await page.getByTestId('veggie-search-group-Fruit').locator('.veggie-search__option').all() | ||
).slice(0, 15); | ||
for (const element of elements) { | ||
await element.click(); | ||
} | ||
await page.getByTestId('dialog-close-button').click(); | ||
await page.goto('stats'); | ||
await page.getByTestId('stats-dropdown-button').click(); | ||
await page.getByTestId('stats-dropdown-option-3').click(); | ||
await expect(page.getByTestId('badge-experimenterFruit-3')).toHaveAttribute( | ||
'aria-disabled', | ||
'false', | ||
); | ||
}); |
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
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