canutin-desktop
canutin-desktop copied to clipboard
Tests: incorrect assertions for <select> components
For example, these assertions are only testing that Security or Investments are one of the options but NOT that is the selected option:
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.