Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: incorrect assertions for <select> components #99

Open
fmaclen opened this issue Sep 20, 2022 · 0 comments
Open

Tests: incorrect assertions for <select> components #99

fmaclen opened this issue Sep 20, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers SvelteKit Involves SvelteKit's code

Comments

@fmaclen
Copy link
Owner

fmaclen commented Sep 20, 2022

For example, these assertions are only testing that Security or Investments are one of the options but NOT that is the selected option:

assets.test.ts

const assetTypeSelect = page.locator('.formSelect__select[name=assetTypeId]');
const balanceGroupSelect = page.locator('.formSelect__select[name=balanceGroup]');

expect(await assetTypeSelect.textContent()).toMatch('Security');
expect(await balanceGroupSelect.textContent()).toMatch('Investments');

This doesn't work:

await expect(assetTypeSelect).toHaveValue('Security')

Because the value is the assetType.id and the number changes on every test run.

@fmaclen fmaclen added bug Something isn't working good first issue Good for newcomers SvelteKit Involves SvelteKit's code labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers SvelteKit Involves SvelteKit's code
Projects
None yet
Development

No branches or pull requests

1 participant