-
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
8 changed files
with
79 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { route } from '../src/router/types/route'; | ||
|
||
test('should redirect from root to dashboard', async ({ page }) => { | ||
await page.goto(route.root); | ||
await expect(page).toHaveURL(route.dashboard); | ||
await page.goto('/'); | ||
|
||
await expect(page).toHaveURL('/dashboard'); | ||
}); |
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,23 +1,55 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { route } from '../src/router/types/route'; | ||
import { | ||
addSubscriptionButton, | ||
noSubscriptionsPlaceholder, | ||
subscriptionUpsertForm, | ||
} from '../src/subscriptions/globals/subscription.test-id'; | ||
import type { RawFormValue } from '../src/form/types/raw-form-value'; | ||
import type { InsertSubscriptionModel } from '../src/subscriptions/models/subscription.model'; | ||
|
||
test('should create subscription', async ({ page }) => { | ||
await page.goto(route.subscriptions); | ||
const formValue = { | ||
name: 'Webstorm', | ||
description: 'JetBrains', | ||
icon: 'webstorm', | ||
price: '10', | ||
startedAt: '2024-03-01', | ||
endedAt: '2024-08-01', | ||
} as const satisfies RawFormValue<InsertSubscriptionModel>; | ||
|
||
await page.goto('/'); | ||
await page.getByRole('link', { name: 'subscriptions' }).click(); | ||
|
||
await expect( | ||
page.getByTestId(noSubscriptionsPlaceholder), | ||
`should have no subscriptions initially`, | ||
page.getByText('No Subscriptions'), | ||
`should show no subscriptions placeholder initially`, | ||
).toBeVisible(); | ||
|
||
await page.getByTestId(addSubscriptionButton).click(); | ||
await page.getByRole('button', { name: 'add sub' }).click(); | ||
|
||
await page.getByLabel('name').fill(formValue.name); | ||
await page.getByLabel('description').fill(formValue.description); | ||
await page.getByLabel('icon').fill(formValue.icon); | ||
await page.getByLabel('price').fill(formValue.price); | ||
await page.getByLabel('started at').fill(formValue.startedAt); | ||
await page.getByLabel('ended at').fill(formValue.endedAt); | ||
|
||
await page.getByRole('button', { name: 'insert' }).click(); | ||
|
||
await expect( | ||
page.getByTestId(subscriptionUpsertForm), | ||
`should show subscription upsert form`, | ||
page.getByText('No Subscriptions'), | ||
`should hide no subscriptions placeholder after subscription was inserted`, | ||
).not.toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'update' }), | ||
'should switch to update mode', | ||
).toBeVisible(); | ||
|
||
await expect( | ||
page.getByText(formValue.name), | ||
`should show newly inserted subscription name`, | ||
).toBeVisible(); | ||
await expect( | ||
page.getByText(formValue.description), | ||
`should show newly inserted subscription description`, | ||
).toBeVisible(); | ||
await expect( | ||
page.getByText(formValue.price), | ||
`should show newly inserted subscription price`, | ||
).toBeVisible(); | ||
}); |
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 was deleted.
Oops, something went wrong.