Skip to content

Commit

Permalink
Fix text filter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Jul 10, 2023
1 parent 27ea78b commit 17735be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions projects/bp-gallery/cypress/e2e/link-pictures-with-texts.cy.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { login, logout } from '../utils/login-utils';

const checkTextDisplay = ({ prefix = '', pictureId = '2', textId = '1' } = {}) => {
cy.contains('Nur Bilder anzeigen');
// wait for page to settle
cy.contains('Bilder und Texte anzeigen');
// go through each text filter option
cy.get('[data-testid="text-filter-select"]').click();
cy.contains('Nur Bilder anzeigen').click();
cy.get(`${prefix} #picture-preview-for-${pictureId}`);
cy.get(`${prefix} #picture-preview-for-${textId}`).should('not.exist');
cy.contains('Nur Bilder anzeigen').click();
cy.get('[data-testid="text-filter-select"]').click();
cy.contains('Bilder und Texte anzeigen').click();
cy.get(`${prefix} #picture-preview-for-${pictureId}`);
cy.get(`${prefix} #picture-preview-for-${textId}`);
cy.contains('Bilder und Texte anzeigen').click();
cy.get('[data-testid="text-filter-select"]').click();
cy.contains('Nur Texte anzeigen').click();
cy.get(`${prefix} #picture-preview-for-${pictureId}`).should('not.exist');
cy.get(`${prefix} #picture-preview-for-${textId}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export const TextFilterSelect = ({
);

return (
<Select value={value} onChange={onSelectChange} variant='standard'>
<Select
value={value}
onChange={onSelectChange}
variant='standard'
data-testid='text-filter-select'
>
<MenuItem value={TextFilter.ONLY_PICTURES}>{t('common.textFilter.onlyPictures')}</MenuItem>
<MenuItem value={TextFilter.PICTURES_AND_TEXTS}>
{t('common.textFilter.picturesAndTexts')}
Expand Down

0 comments on commit 17735be

Please sign in to comment.