Merge pull request 'Test: OfferingFormPage niet meer haperend onder CI-belasting' (#30) from fix/offering-form-test-flaky into master
Continuous Integration / config-asf (push) Successful in 6s
Continuous Integration / config-sls (push) Successful in 8s
Continuous Integration / changes (push) Successful in 12s
Continuous Integration / backend-build (push) Skipped
Continuous Integration / compile-sites (push) Skipped
Continuous Integration / backend-test (push) Skipped
Continuous Integration / vulnerability-scan (push) Skipped
Continuous Integration / frontend-prepare (push) Successful in 21s
Continuous Integration / frontend-build (push) Successful in 38s
Continuous Integration / frontend-lint (push) Successful in 41s
Continuous Integration / frontend-test (push) Successful in 2m39s
Continuous Integration / publish-sls-production (push) Skipped
Continuous Integration / deploy-sls-production (push) Skipped
Continuous Integration / publish-asf-test (push) Successful in 1m40s
Continuous Integration / publish-sls-test (push) Successful in 1m47s
Continuous Integration / deploy-asf-test (push) Successful in 1m4s
Continuous Integration / deploy-sls-test (push) Successful in 1m0s
Continuous Integration / smoke-asf-test (push) Successful in 12s
Continuous Integration / smoke-sls-test (push) Successful in 11s
Deploy (SCP) / deploy (push) Successful in 1m0s
Continuous Integration / config-asf (push) Successful in 6s
Continuous Integration / config-sls (push) Successful in 8s
Continuous Integration / changes (push) Successful in 12s
Continuous Integration / backend-build (push) Skipped
Continuous Integration / compile-sites (push) Skipped
Continuous Integration / backend-test (push) Skipped
Continuous Integration / vulnerability-scan (push) Skipped
Continuous Integration / frontend-prepare (push) Successful in 21s
Continuous Integration / frontend-build (push) Successful in 38s
Continuous Integration / frontend-lint (push) Successful in 41s
Continuous Integration / frontend-test (push) Successful in 2m39s
Continuous Integration / publish-sls-production (push) Skipped
Continuous Integration / deploy-sls-production (push) Skipped
Continuous Integration / publish-asf-test (push) Successful in 1m40s
Continuous Integration / publish-sls-test (push) Successful in 1m47s
Continuous Integration / deploy-asf-test (push) Successful in 1m4s
Continuous Integration / deploy-sls-test (push) Successful in 1m0s
Continuous Integration / smoke-asf-test (push) Successful in 12s
Continuous Integration / smoke-sls-test (push) Successful in 11s
Deploy (SCP) / deploy (push) Successful in 1m0s
This commit was merged in pull request #30.
This commit is contained in:
@@ -5,7 +5,12 @@ import { renderApp, mockAuthenticated } from '@/test/utils';
|
||||
import { resetMockOfferings } from '@/features/offerings/mocks/handlers';
|
||||
import { _resetSetupStatusCache } from '@/router';
|
||||
|
||||
// No pause between keystrokes: the form is typed into dozens of characters per test and, with the default zero-delay
|
||||
// timer between each, a loaded CI machine could take longer than the test timeout (20 s) in this one file.
|
||||
let user: ReturnType<typeof userEvent.setup>;
|
||||
|
||||
beforeEach(() => {
|
||||
user = userEvent.setup({ delay: null });
|
||||
_resetSetupStatusCache();
|
||||
resetMockOfferings();
|
||||
});
|
||||
@@ -17,14 +22,14 @@ describe('OfferingFormPage', () => {
|
||||
|
||||
await screen.findByTestId('offering-form-submit', {}, { timeout: 10000 });
|
||||
|
||||
await userEvent.type(screen.getByTestId('offering-title'), 'Enterprise');
|
||||
await userEvent.type(screen.getByTestId('offering-description'), 'A large website');
|
||||
await userEvent.type(screen.getByTestId('offering-price'), '€ 2000');
|
||||
await userEvent.type(screen.getByTestId('offering-price-note'), 'one-time');
|
||||
await userEvent.type(screen.getByTestId('offering-feature-0'), 'Unlimited pages');
|
||||
await userEvent.type(screen.getByTestId('offering-cta-label'), 'Contact us');
|
||||
await user.type(screen.getByTestId('offering-title'), 'Enterprise');
|
||||
await user.type(screen.getByTestId('offering-description'), 'A large website');
|
||||
await user.type(screen.getByTestId('offering-price'), '€ 2000');
|
||||
await user.type(screen.getByTestId('offering-price-note'), 'one-time');
|
||||
await user.type(screen.getByTestId('offering-feature-0'), 'Unlimited pages');
|
||||
await user.type(screen.getByTestId('offering-cta-label'), 'Contact us');
|
||||
|
||||
await userEvent.click(screen.getByTestId('offering-form-submit'));
|
||||
await user.click(screen.getByTestId('offering-form-submit'));
|
||||
|
||||
expect(await screen.findByTestId('offerings-title', {}, { timeout: 10000 })).toBeInTheDocument();
|
||||
expect(screen.getByText('Enterprise')).toBeInTheDocument();
|
||||
@@ -37,11 +42,11 @@ describe('OfferingFormPage', () => {
|
||||
await screen.findByTestId('offering-form-submit', {}, { timeout: 10000 });
|
||||
expect(screen.getByLabelText(/optioneel|optional/i, { selector: '#offering-description' })).toBeInTheDocument();
|
||||
|
||||
await userEvent.type(screen.getByTestId('offering-title'), 'Gezin');
|
||||
await userEvent.type(screen.getByTestId('offering-price'), '€ 175');
|
||||
await userEvent.type(screen.getByTestId('offering-feature-0'), '1 uur fotografie');
|
||||
await userEvent.type(screen.getByTestId('offering-cta-label'), 'Boek');
|
||||
await userEvent.click(screen.getByTestId('offering-form-submit'));
|
||||
await user.type(screen.getByTestId('offering-title'), 'Gezin');
|
||||
await user.type(screen.getByTestId('offering-price'), '€ 175');
|
||||
await user.type(screen.getByTestId('offering-feature-0'), '1 uur fotografie');
|
||||
await user.type(screen.getByTestId('offering-cta-label'), 'Boek');
|
||||
await user.click(screen.getByTestId('offering-form-submit'));
|
||||
|
||||
expect(await screen.findByTestId('offerings-title', {}, { timeout: 10000 })).toBeInTheDocument();
|
||||
expect(screen.getByText('Gezin')).toBeInTheDocument();
|
||||
@@ -53,7 +58,7 @@ describe('OfferingFormPage', () => {
|
||||
renderApp('/offerings/new');
|
||||
|
||||
await screen.findByTestId('offering-form-submit', {}, { timeout: 10000 });
|
||||
await userEvent.click(screen.getByTestId('offering-form-submit'));
|
||||
await user.click(screen.getByTestId('offering-form-submit'));
|
||||
|
||||
expect(await screen.findByTestId('offering-title-error')).toBeInTheDocument();
|
||||
});
|
||||
@@ -74,9 +79,9 @@ describe('OfferingFormPage', () => {
|
||||
await screen.findByTestId('offering-form-submit', {}, { timeout: 10000 });
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent(/automatisch|auto-generated/i);
|
||||
|
||||
await userEvent.click(screen.getByTestId('offering-slug-edit'));
|
||||
await userEvent.type(screen.getByTestId('offering-slug'), 'custom-slug');
|
||||
await userEvent.click(screen.getByTestId('offering-slug-confirm'));
|
||||
await user.click(screen.getByTestId('offering-slug-edit'));
|
||||
await user.type(screen.getByTestId('offering-slug'), 'custom-slug');
|
||||
await user.click(screen.getByTestId('offering-slug-confirm'));
|
||||
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent('custom-slug');
|
||||
});
|
||||
@@ -87,10 +92,10 @@ describe('OfferingFormPage', () => {
|
||||
|
||||
await screen.findByTestId('offering-form-submit', {}, { timeout: 10000 });
|
||||
|
||||
await userEvent.type(screen.getByTestId('offering-title'), 'Mijn Nieuwe Pakket');
|
||||
await user.type(screen.getByTestId('offering-title'), 'Mijn Nieuwe Pakket');
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent('mijn-nieuwe-pakket');
|
||||
|
||||
await userEvent.type(screen.getByTestId('offering-title'), '!');
|
||||
await user.type(screen.getByTestId('offering-title'), '!');
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent('mijn-nieuwe-pakket');
|
||||
});
|
||||
|
||||
@@ -99,13 +104,13 @@ describe('OfferingFormPage', () => {
|
||||
renderApp('/offerings/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/edit');
|
||||
|
||||
await screen.findByTestId('offering-title', {}, { timeout: 10000 });
|
||||
await userEvent.click(screen.getByTestId('offering-slug-edit'));
|
||||
await userEvent.clear(screen.getByTestId('offering-slug'));
|
||||
await userEvent.type(screen.getByTestId('offering-slug'), 'manually-set');
|
||||
await userEvent.click(screen.getByTestId('offering-slug-confirm'));
|
||||
await user.click(screen.getByTestId('offering-slug-edit'));
|
||||
await user.clear(screen.getByTestId('offering-slug'));
|
||||
await user.type(screen.getByTestId('offering-slug'), 'manually-set');
|
||||
await user.click(screen.getByTestId('offering-slug-confirm'));
|
||||
|
||||
await userEvent.clear(screen.getByTestId('offering-title'));
|
||||
await userEvent.type(screen.getByTestId('offering-title'), 'Compleet Andere Titel');
|
||||
await user.clear(screen.getByTestId('offering-title'));
|
||||
await user.type(screen.getByTestId('offering-title'), 'Compleet Andere Titel');
|
||||
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent('manually-set');
|
||||
});
|
||||
@@ -115,10 +120,10 @@ describe('OfferingFormPage', () => {
|
||||
renderApp('/offerings/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/edit');
|
||||
|
||||
await screen.findByTestId('offering-title', {}, { timeout: 10000 });
|
||||
await userEvent.click(screen.getByTestId('offering-slug-edit'));
|
||||
await userEvent.clear(screen.getByTestId('offering-slug'));
|
||||
await userEvent.type(screen.getByTestId('offering-slug'), 'something-else');
|
||||
await userEvent.click(screen.getByTestId('offering-slug-cancel'));
|
||||
await user.click(screen.getByTestId('offering-slug-edit'));
|
||||
await user.clear(screen.getByTestId('offering-slug'));
|
||||
await user.type(screen.getByTestId('offering-slug'), 'something-else');
|
||||
await user.click(screen.getByTestId('offering-slug-cancel'));
|
||||
|
||||
expect(screen.getByTestId('offering-slug-display')).toHaveTextContent('starter');
|
||||
});
|
||||
@@ -128,12 +133,12 @@ describe('OfferingFormPage', () => {
|
||||
renderApp('/offerings/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/edit');
|
||||
|
||||
await screen.findByTestId('offering-title', {}, { timeout: 10000 });
|
||||
await userEvent.click(screen.getByTestId('offering-slug-edit'));
|
||||
await userEvent.clear(screen.getByTestId('offering-slug'));
|
||||
await userEvent.type(screen.getByTestId('offering-slug'), 'pro');
|
||||
await userEvent.click(screen.getByTestId('offering-slug-confirm'));
|
||||
await user.click(screen.getByTestId('offering-slug-edit'));
|
||||
await user.clear(screen.getByTestId('offering-slug'));
|
||||
await user.type(screen.getByTestId('offering-slug'), 'pro');
|
||||
await user.click(screen.getByTestId('offering-slug-confirm'));
|
||||
|
||||
await userEvent.click(screen.getByTestId('offering-form-submit'));
|
||||
await user.click(screen.getByTestId('offering-form-submit'));
|
||||
|
||||
expect(await screen.findByText(/pro.*al in gebruik|already.*taken/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user