Skip to content

Commit 3af693e

Browse files
committed
test: scope invisible character e2e assertions to their cell
The nonBreakingSpace/zeroWidth marker assertions searched the whole document, so they would still pass if the marker appeared on the wrong key or column (LimitedHeightText duplicates its subtree into a hover overlay). Scope both to their translation cell via data-cy-key/data-cy-language, following the pattern already used by the negative test. Also rename the zero-width fixture from "Save​changes" to "Zero​width" so editCell's unscoped cy.contains('Save') can't collide with the editor's Save button.
1 parent 7bf2dec commit 3af693e

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

e2e/cypress/e2e/translations/invisibleCharacters.cy.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Invisible characters', () => {
1313
projectId = data.body.id;
1414
login('franta', 'admin');
1515
createKey(projectId, 'nbsp key', { en: 'Bonjour\u00A0!' });
16-
createKey(projectId, 'zero width key', { en: 'Save\u200Bchanges' });
16+
createKey(projectId, 'zero width key', { en: 'Zero\u200Bwidth' });
1717
createKey(projectId, 'plain key', { en: 'Plain value' });
1818
});
1919
});
@@ -27,18 +27,24 @@ describe('Invisible characters', () => {
2727
visitTranslations(projectId);
2828
waitForGlobalLoading();
2929
gcyAdvanced({
30-
value: 'invisible-character',
31-
kind: 'nonBreakingSpace',
32-
}).should('have.length.at.least', 1);
30+
value: 'translations-table-cell',
31+
key: 'nbsp key',
32+
language: 'en',
33+
})
34+
.find('[data-cy="invisible-character"][data-cy-kind="nonBreakingSpace"]')
35+
.should('have.length.at.least', 1);
3336
});
3437

3538
it('marks a zero-width space in a translation cell', () => {
3639
visitTranslations(projectId);
3740
waitForGlobalLoading();
3841
gcyAdvanced({
39-
value: 'invisible-character',
40-
kind: 'zeroWidth',
41-
}).should('have.length.at.least', 1);
42+
value: 'translations-table-cell',
43+
key: 'zero width key',
44+
language: 'en',
45+
})
46+
.find('[data-cy="invisible-character"][data-cy-kind="zeroWidth"]')
47+
.should('have.length.at.least', 1);
4248
});
4349

4450
it('does not mark regular spaces', () => {
@@ -65,7 +71,7 @@ describe('Invisible characters', () => {
6571
it('marks a zero-width space inside the editor', () => {
6672
visitTranslations(projectId);
6773
waitForGlobalLoading();
68-
editCell('Save');
74+
editCell('Zero');
6975
gcy('global-editor')
7076
.find('.cm-invisible-char-zero-width')
7177
.should('have.length.at.least', 1);

0 commit comments

Comments
 (0)