-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-estimation.spec.ts
More file actions
65 lines (52 loc) · 1.94 KB
/
Copy pathedit-estimation.spec.ts
File metadata and controls
65 lines (52 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { test, expect } from '@playwright/test';
import { setupVercelBypass } from './helpers/general';
import { fillEstimationForm } from './helpers/estimation';
test.describe('edit estimation', () => {
test.beforeEach(async ({ page }) => {
await setupVercelBypass(page);
await page.goto('/?demo=with-premium-benefits-cost-calculator');
});
test('edits an estimation', async ({ page }) => {
await fillEstimationForm(page, {
country: 'Sweden',
currency: 'USD',
salary: '100',
});
const title = page.getByTestId('estimation-results-header-title');
await expect(title).toHaveText('Estimate #01');
// Open actions dropdown and click edit
const actionsDropdown = page.getByRole('button', { name: /actions/i });
await actionsDropdown.click();
const editAction = page.getByRole('button', { name: /edit/i });
await editAction.click();
// Check drawer content
const drawerTitle = page.getByTestId(
'drawer-edit-estimation-form-header-title',
);
await expect(drawerTitle).toHaveText('Edit estimate');
await expect(
page.getByText(
'The billing currency will appear as the one you picked earlier',
),
).toBeVisible();
await expect(
page.getByText(
'Your billing currency will be shown as USD, based on your earlier selection',
),
).toBeVisible();
const drawerDescription = page.getByTestId(
'drawer-edit-estimation-form-header-description',
);
await expect(drawerDescription).toHaveText('Estimate #1');
// Update salary and submit
await page.fill('#salary_conversion', '200');
await page.fill('#estimation_title', 'Test estimation');
await page.click('.submit-button');
// Verify updated amount
const employerAmount = page.getByTestId(
'annual-gross-salary-employer-amount',
);
await expect(employerAmount).toHaveText('$200.00');
await page.getByText('Test estimation');
});
});