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

Rtl client #2026

Open
wants to merge 183 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
af16bd8
feat(get texts): functions for getting texts from api-v3 and modifyin…
YishaiGlasner Mar 7, 2024
22591ec
doc(get texts): todo strings.
YishaiGlasner Mar 10, 2024
5b2aa35
refactor(currVersions): this refactor changes the currVersions object…
YishaiGlasner Mar 13, 2024
5e8ba29
chore(currVersions): remove console logs.
YishaiGlasner Mar 13, 2024
e170816
Merge branch 'currVersions' into rtl
YishaiGlasner Mar 14, 2024
488a216
Merge branch 'master' into rtl
YishaiGlasner Mar 17, 2024
1b9b883
feat(translations): use the v3 functions for getting texts in compone…
YishaiGlasner Mar 18, 2024
f726d21
feat(url): insert languageFamilyName to url.
YishaiGlasner Mar 19, 2024
000394c
feat(url): redirect old urls.
YishaiGlasner Mar 19, 2024
ee70e1f
refactor(TextRange): rename handleResize to conditionalPlaceSegmentNu…
YishaiGlasner Mar 19, 2024
4f32748
feat(translations): use text-v3 in work (commit for pushing for worki…
YishaiGlasner Mar 27, 2024
182b2b4
fix(TextRange): do not change ref for link to segment.
YishaiGlasner Mar 28, 2024
aa89537
chore(TextRange): remove console.logs.
YishaiGlasner Mar 28, 2024
a36c7b8
feat(ReaderControls): use the new function for getting text.
YishaiGlasner Mar 31, 2024
1a2d6e1
feat(get texts): add 'sources' and 'heSources' to adapted response.
YishaiGlasner Mar 31, 2024
587e628
refactor(ReaderControls): use data for determining what translation …
YishaiGlasner Mar 31, 2024
7627be5
refactor(currVersions): remove APIResult attributes which are not in …
YishaiGlasner Mar 31, 2024
b27423c
fix(getting texts): add the attributes sources and heSources only whe…
YishaiGlasner Mar 31, 2024
c182498
fix(getting texts): add the attributes sources and heSources only whe…
YishaiGlasner Mar 31, 2024
d787953
fix(SSR): assign an empty array to he/text when there is no source/tr…
YishaiGlasner Mar 31, 2024
018cc74
refactor(ReaderPanel): get data directly with asking it and pass it t…
YishaiGlasner Apr 3, 2024
aaf985e
chore: fix a git accident.
YishaiGlasner Apr 3, 2024
f46619f
refactor(ReaderPanel): rename conditionalSetData to conditionalSetTex…
YishaiGlasner Apr 3, 2024
d23db3f
fix(ReaderPanel): don't try to get things from data when it's null.
YishaiGlasner Apr 3, 2024
76c25e1
fix(ReaderPanel): set translation in ReaderControls when it gots data.
YishaiGlasner Apr 3, 2024
8bf5e77
fix(ReaderPanel): fix the flowing of tata into ReaderControl and maki…
YishaiGlasner Apr 4, 2024
cb80ac5
refactor(ReaderPanel): function for comparing both currVersions.
YishaiGlasner Apr 4, 2024
10e14f0
fix(SSR processing): save the versions according to the new api retur…
YishaiGlasner Apr 4, 2024
43cb1bf
feat(texts): css for rtl as translation and ltr as source.
YishaiGlasner Apr 8, 2024
9c2e835
fix(translations): show currently selected for rtl translations.
YishaiGlasner Apr 8, 2024
3d2ab03
fix(texts): show only the source/translation when this is selected.
YishaiGlasner Apr 9, 2024
ad255e5
fix(texts): show only the source/translation when this is selected.
YishaiGlasner Apr 9, 2024
b5e6172
feat(texts menu): new text menu (with only language button for this PR).
YishaiGlasner Apr 16, 2024
638fcd1
Merge branch 'master' into rtl
YishaiGlasner Apr 16, 2024
2e898ab
feat(texts menu): add layout options to menu.
YishaiGlasner Apr 17, 2024
0f4bc63
feat(texts menu): svg layout files.
YishaiGlasner Apr 17, 2024
af741ed
fix(texts menu): handle cases where data is not loaded yet.
YishaiGlasner Apr 17, 2024
5347781
fix(texts menu): location of the wotd in menu.
YishaiGlasner Apr 17, 2024
4b12c96
fix(texts menu): show only language toggle in compare panel.
YishaiGlasner Apr 17, 2024
4dd2d27
feat(texts menu): add border line.
YishaiGlasner Apr 17, 2024
0713324
fix(texts menu): layout direction.
YishaiGlasner Apr 17, 2024
69b6fbc
fix(texts menu): popover menu direction.
YishaiGlasner Apr 18, 2024
2a1726b
feat(texts menu): layout icon for stacked ltr rtl.
YishaiGlasner Apr 18, 2024
d47135f
fix(texts menu): switch layout icons for mono text.
YishaiGlasner Apr 18, 2024
47ecdcc
fix(texts): direction for mono text.
YishaiGlasner Apr 18, 2024
14d507f
fix(texts): direction for bilingual when primary is ltr and translati…
YishaiGlasner Apr 21, 2024
3414b13
feat(texts): Hebrew strings for 'Translation' and 'Source with Transl…
YishaiGlasner Apr 21, 2024
49bde51
fix(texts): svgs with the right names.
YishaiGlasner Apr 21, 2024
221c1dd
feat(text meny): font size buttons.
YishaiGlasner Apr 21, 2024
27e5f5d
feat(text meny): aliyot toggle switch.
YishaiGlasner Apr 21, 2024
06c79e2
fix(text menu): font size buttons order in Hebrew interface.
YishaiGlasner Apr 21, 2024
e16690d
feat(text menu): vowels and cantillation toggles.
YishaiGlasner Apr 21, 2024
e004f9a
feat(text menu): punctuation toggle.
YishaiGlasner Apr 21, 2024
b129bb6
refactor(text menu): do all toggles in the same format.
YishaiGlasner Apr 21, 2024
7ae7c9d
feat(text menu): Hebrew string for cantillation.
YishaiGlasner Apr 21, 2024
586e609
refactor(text menu): remove old ReaderDisplayOptionsMenu.
YishaiGlasner Apr 21, 2024
2011261
feat(reader panel): gray and margins for translation in stacked layout.
YishaiGlasner May 1, 2024
ceb4fa1
feat(text menu): cursor pointer for buttons.
YishaiGlasner May 1, 2024
8c795d7
feat(texts client): 'empty' text as translation when the api response…
YishaiGlasner May 1, 2024
00f30e2
doc(texts client): remove todo.
YishaiGlasner May 1, 2024
72dbe19
feat(texts): show only one text when there is only one on bilingual s…
YishaiGlasner May 5, 2024
8735c1a
feat(texts): show titles and other content-related texts in the conte…
YishaiGlasner May 6, 2024
92531e7
fix(language toggle button): show only ay or aleph.
YishaiGlasner May 8, 2024
bba4437
fix(layout toggle): show bilayout when there is an 'empty' translation.
YishaiGlasner May 8, 2024
7537960
fix(layout toggle): don't show layout toggle when the panel is biling…
YishaiGlasner May 8, 2024
5379fae
fix(A button): fix location.
YishaiGlasner May 9, 2024
83f3334
fix(text menu): fix location.
YishaiGlasner May 15, 2024
dc7d646
Merge branch 'rtl' of https://github.com/Sefaria/Sefaria-Project into…
YishaiGlasner May 15, 2024
c86cdab
feat(connections panel): menu of 'show source' and 'show translation'…
YishaiGlasner May 16, 2024
c4fb810
fix(connections panel): fix text align and direction in connection pa…
YishaiGlasner May 16, 2024
36a4439
Merge branch 'master' into rtl
YishaiGlasner May 19, 2024
3e60399
Validate interface language is sticky when source language changes
b-w-cole Jul 18, 2024
170d3ce
Merge branch 'master' into sticky-interface-and-source-language
b-w-cole Jul 24, 2024
c120aa6
Parameterized tests for brevity
b-w-cole Jul 24, 2024
622d4c7
Initial Commit of Translation Version Name in Title Bar
b-w-cole Jul 24, 2024
353d8e9
Testing for default source language only
b-w-cole Jul 25, 2024
f1136b2
Neatening parameters
b-w-cole Jul 25, 2024
0197eed
Updating Interface language test
b-w-cole Jul 25, 2024
acb07a8
Expanding test to include different sources, plus utils addition
b-w-cole Jul 25, 2024
018f556
Expanding tests to handle bilingual source texts
b-w-cole Aug 9, 2024
0bb0ec0
Updated test with new global params
b-w-cole Aug 10, 2024
60c6b09
feat(rtl): add caching using Sefaria methods, fixing infinite scroll …
akiva10b Sep 5, 2024
4ed4d05
Merge branch 'master' into rtl-client
akiva10b Sep 5, 2024
51de1de
fix(ReaderPanel): check data exists in shouldLayoutUpdate.
YishaiGlasner Sep 8, 2024
1d8cce2
fix(DisplayOptoinsMenu): fix scrolling when menu is open.
YishaiGlasner Sep 8, 2024
51af0e7
fix(DisplayOptoinsMenu): fix text vertical align.
YishaiGlasner Sep 8, 2024
400442b
chore: remove console.log.
YishaiGlasner Sep 8, 2024
c052ee6
refactor(client refs): use new API in getRef, and get contextRef with…
YishaiGlasner Sep 10, 2024
68a514c
fix(rtl): show ltr text in connections panel commentary in heberw int…
YishaiGlasner Sep 19, 2024
8f300a6
fix(rtl): Fix Base version shows as "merged" even when it's coming fr…
akiva10b Sep 19, 2024
af9f192
fix(rtl): do not show language option in connections panel on hebrew …
YishaiGlasner Sep 19, 2024
ebd5dc3
fix(popup): show popup menu over banner
YishaiGlasner Sep 22, 2024
a58ff8b
refactor: remove TextManager (a previous attempt for api and cache cl…
YishaiGlasner Sep 22, 2024
48c14b7
fix(TextRange): use isSpanning rather than spanning which doesn't exi…
YishaiGlasner Sep 22, 2024
f423e75
fix(getObjectFromUrlParam): do not return pipe as language.
YishaiGlasner Sep 22, 2024
c74abc2
fix(TextRange): handle segment refs and spanning refs.
YishaiGlasner Sep 24, 2024
bd17129
refactor(text fetch): move logic of getting context to sefaria.js fun…
YishaiGlasner Sep 24, 2024
17a7917
fix(text fetch): use context on ReaderPanel.
YishaiGlasner Sep 24, 2024
549a28c
fix(author page): do not show bilingual text for books (rather fallba…
YishaiGlasner Sep 24, 2024
5e9261e
fix(useContentLang): use the right attribute of data.
YishaiGlasner Sep 24, 2024
e02f3c6
fix(rtl): convert TranslationBox component to functional component
akiva10b Sep 24, 2024
8cd54f6
Merge branch 'rtl-client' of https://github.com/Sefaria/Sefaria-Proje…
akiva10b Sep 24, 2024
946ba45
Merge remote-tracking branch 'origin/bug/sc-27995/base-version-shows-…
akiva10b Sep 24, 2024
df2779f
fix(TextRange): use withContext in text call.
YishaiGlasner Sep 24, 2024
fe9c00b
fix(API texts v3): add spanningRefs only if isSpanning (=not in the c…
YishaiGlasner Sep 24, 2024
e4018a6
fix(translations box): show translation also when the content languag…
YishaiGlasner Sep 25, 2024
4b102bb
fix(segmentText): fix rtl class (for viewing version in VersionTextLi…
YishaiGlasner Sep 25, 2024
75ce06b
fix(direction): show source when translation is not available, but al…
YishaiGlasner Sep 25, 2024
33be1dd
redactor(VersionsTextList): refactor VersionsTextList out of Translat…
YishaiGlasner Sep 25, 2024
ab46fcc
fix(VersionsTextList): move proptypes.
YishaiGlasner Sep 25, 2024
8ee48d6
refactor(VersionsTextList): render VersionsTextList with AboutBox whe…
YishaiGlasner Sep 25, 2024
9620756
fix(VersionsTextList): find languageFamilyName in VersionsTextList. f…
YishaiGlasner Sep 25, 2024
7856ff3
fix(VersionsTextList): add new mode 'Version Open' to histories and S…
YishaiGlasner Sep 25, 2024
6210dd3
feat(VersionsTextList): do not push about versions into recentVersion…
YishaiGlasner Sep 25, 2024
5922f1f
fix(AboutBox): bind setFilter for prevConnectionsMode be 'About'.
YishaiGlasner Sep 26, 2024
29e798b
fix(useOutsideClick): add the option not to add a listener (for case …
YishaiGlasner Sep 26, 2024
027feb9
refactor(PopoverMenu): get anonymous function out of jsx.
YishaiGlasner Sep 26, 2024
ac12844
fix(AboutBox): use ContentText for the composed text (rather than no …
YishaiGlasner Sep 26, 2024
699294d
fix(AboutBox): show the title of current version rather than of the l…
YishaiGlasner Sep 26, 2024
a0ceb87
Merge branch 'master' into rtl-client
YishaiGlasner Sep 26, 2024
2ad18ec
chore: remove debugger.
YishaiGlasner Sep 26, 2024
6ee6d4f
fix(ReaderControls): set translation versionTitle even when only sour…
YishaiGlasner Sep 26, 2024
f7cdb4a
fix(ConnectionsPanel): load data when moving from section to segment …
YishaiGlasner Sep 26, 2024
b953eaf
Solving issue with flakey tests by clearing cookies for each test
b-w-cole Sep 30, 2024
e72c264
fix(css): do not show rtl-translation//ltr-source when viewing source…
YishaiGlasner Oct 1, 2024
682fad5
fix(css): show ltr source when selecting translation but no translati…
YishaiGlasner Oct 1, 2024
daa3744
fix(AboutBox): check if versionLangMap were loaded in the right way.
YishaiGlasner Oct 1, 2024
e5131aa
chore(testing): add ip control for bilingual tests
akiva10b Oct 7, 2024
af8b795
feat(versions): get the translation by the user langauge preferences …
YishaiGlasner Oct 8, 2024
7cbe48a
ci: allow integration tests to be run by hand
BrendanGalloway Oct 7, 2024
827ded3
chore: indentation.
YishaiGlasner Oct 8, 2024
da574bb
feat: use old _saveText for enabling the using of getRefFromCache.
YishaiGlasner Oct 9, 2024
f04d45c
Merge pull request #2058 from Sefaria/manual-integration
akiva10b Oct 9, 2024
46faebf
refactor(AddToSourceSheet): refactor 3 functions out of addToSourceSh…
YishaiGlasner Oct 9, 2024
9a97fe2
refactor(AddToSourceSheet): use the full current version objects.
YishaiGlasner Oct 9, 2024
fa91c48
ci: don't skip on manual workflow
BrendanGalloway Oct 9, 2024
1c6a0ac
Merge pull request #2060 from Sefaria/manual-integration
akiva10b Oct 9, 2024
6fab6ed
feat: add source to sheet when source is ltr or translation rtl, and …
YishaiGlasner Oct 10, 2024
7d341e5
refactor(get texts): refactor getPrimaryAndTranslationFromVersions ou…
YishaiGlasner Oct 10, 2024
9c00683
chore: remove console.log.
YishaiGlasner Oct 10, 2024
410b621
fix(AboutBox): fix versions in AboutBox
YishaiGlasner Oct 10, 2024
88c94af
chore: remove console.log.
YishaiGlasner Oct 10, 2024
d5a48c6
fix(add to sheet): add to sheet from sheet of source that is spanning…
YishaiGlasner Oct 10, 2024
9abe2e2
fix(open version): fix open version from toc page.
YishaiGlasner Oct 10, 2024
c9aa2b3
fix(TextRange): show linkCount when it's available.
YishaiGlasner Oct 13, 2024
dca9028
fix: align hebrew source in side panel to right also on english inter…
YishaiGlasner Oct 13, 2024
2e0404a
chore: typo
YishaiGlasner Oct 14, 2024
cb819a8
feat(sheet): sheet display options menu which inclusdes:
YishaiGlasner Oct 14, 2024
de35485
feat(sheet): fix the language - he for hebrew interface, and bi for e…
YishaiGlasner Oct 14, 2024
2945264
feat(sheet): redirect (permanent, 301) the language of sheet - he for…
YishaiGlasner Oct 14, 2024
8ed551f
feat(sheet): display ltr-only sources on hebrew interface.
YishaiGlasner Oct 14, 2024
a9874cd
fix(sheet): fix flow.
YishaiGlasner Oct 14, 2024
4c26e77
fix(TextRange): fix loading message in bilingual state. Use LoadingMe…
YishaiGlasner Oct 14, 2024
efb0bd0
fix(TextRange): typo.
YishaiGlasner Oct 14, 2024
8c6066a
Merge branch 'master' into rtl-client
YishaiGlasner Oct 14, 2024
12bac89
refactor(DropdownMenu): change name from PopoverMeni.
YishaiGlasner Oct 15, 2024
2820045
refactor(components): rename folder to common.
YishaiGlasner Oct 15, 2024
d65bc31
chore(DropDownMenu): typo.
YishaiGlasner Oct 15, 2024
78b73f7
Merge remote-tracking branch 'origin/language-selection-playwright-te…
YishaiGlasner Oct 15, 2024
720dd99
test: fix tests for interface language.
YishaiGlasner Oct 15, 2024
403ac3c
test(playwright): fix tests for translation version name.
YishaiGlasner Oct 15, 2024
083bf4f
refactor(playwright): user changeLanguageOfText rather than duplicate…
YishaiGlasner Oct 15, 2024
2188525
fix(playwright): fix reader.spec tests.
YishaiGlasner Oct 15, 2024
5d6851a
refactor(DropdownMenu): option for using without context from outside…
YishaiGlasner Oct 15, 2024
979a6e3
fix: fix direction of book hebrew title in side panel, and of the con…
YishaiGlasner Oct 15, 2024
46f6699
fix(text api): add versionStatus and heVersionStatus to the response.
YishaiGlasner Oct 28, 2024
4ef9c87
fix(ConnectionsPanel): set data in advanced state (for checking the a…
YishaiGlasner Oct 28, 2024
f2f14a6
chore: indentation.
YishaiGlasner Oct 28, 2024
feb9230
fix(AboutBox): show correctly the 'Current Version' and 'Current Tran…
YishaiGlasner Oct 28, 2024
c888653
fix(get text): check if version exists also when we know the versionT…
YishaiGlasner Oct 29, 2024
4b97f73
fix(TextSegment): use the directions from the props rather than from …
YishaiGlasner Oct 29, 2024
0611f8b
fix(css): show only the interface text for topic in the side panel.
YishaiGlasner Nov 5, 2024
d355740
fix(translations): show the number of translations on the specific se…
YishaiGlasner Nov 5, 2024
57094fa
fix(versions): case where we don't have the translation requested ver…
YishaiGlasner Nov 7, 2024
3d2a3fc
fix(versions stickiness): stickiness for all translations rather than…
YishaiGlasner Nov 7, 2024
bbfac1e
fix(currVersions): check for versionTitle before adding it to edit url.
YishaiGlasner Nov 7, 2024
6170901
fix(currVersions): check for versionTitle before adding it to edit url.
YishaiGlasner Nov 7, 2024
5dd8073
fix(edit): edit rtl translations.
YishaiGlasner Nov 7, 2024
5773c83
feat(translations): rtl translations with sans serif and 100% font size.
YishaiGlasner Nov 11, 2024
d35b171
fix(connections panel): show only one language in panel side texts.
YishaiGlasner Nov 11, 2024
db543b3
fix(hebrew translation): apply stripping vowels for hebrew translations.
YishaiGlasner Nov 11, 2024
a49f6ef
feat(hebrew translation): do not grey the text even in stacked view.
YishaiGlasner Nov 12, 2024
f28b2e1
fix(ReaderDisplayOptionsMenu): in mobile, do not show layout options …
YishaiGlasner Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/integration-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency: integration_environment

jobs:
variables:
if: ${{ github.event_name == 'merge_group' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
date: ${{ steps.data.outputs.date }}
Expand All @@ -29,7 +29,7 @@ jobs:
echo "current_branch=merge-queue"
>> $GITHUB_OUTPUT
build-generic:
if: ${{ github.event_name == 'merge_group' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
name: "Integration Image Build"
needs:
- variables
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-derived:
if: ${{ github.event_name == 'merge_group' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
name: "Integration Image Build Stage 2"
permissions:
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
run-tests:
if: ${{ github.event_name == 'merge_group' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
name: "Playwright" # This name is referenced when slacking status
needs:
- build-derived
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
- name: Uninstall
run: helm delete integration-${{ needs.variables.outputs.commit }} -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} --debug --timeout 10m0s
ending-notification:
if: ${{ github.event_name == 'merge_group' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs:
- run-tests
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export const LANGUAGES = {
'HE': 'hebrew',
}

export const SOURCE_LANGUAGES = {
'EN': /^(תרגום|Translation)$/,
'HE': /^(מקור|Source)$/,
'BI': /^(מקור ותרגום|Source with Translation)$/
}

export const cookieObject = {
"name": "interfaceLang",
"value": DEFAULT_LANGUAGE,
Expand Down
57 changes: 57 additions & 0 deletions e2e-tests/tests/interface-language-is-sticky.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {test, expect} from '@playwright/test';
import {changeLanguageOfText, goToPageWithLang, isIsraelIp} from "../utils";
import {LANGUAGES, SOURCE_LANGUAGES} from '../globals'

const interfaceTextHE = 'מקורות';
const interfaceTextEN = 'Texts';

[
// Hebrew Interface and English Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'English', sourceLanguageToggle: SOURCE_LANGUAGES.EN,
expectedSourceText: 'When God began to create', expectedBilingualText: '', expectedInterfaceText: interfaceTextHE },

// Hebrew Interface and Bilingual Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'Bilingual', sourceLanguageToggle: SOURCE_LANGUAGES.BI,
expectedSourceText: 'רֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃', expectedBilingualText: 'When God began to create', expectedInterfaceText: interfaceTextHE },

// Hebrew Interface and Hebrew Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'Hebrew', sourceLanguageToggle: SOURCE_LANGUAGES.HE,
expectedSourceText: 'רֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃', expectedBilingualText: '', expectedInterfaceText: interfaceTextHE },

// English Interface and English Source
{interfaceLanguage: 'English', interfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'English', sourceLanguageToggle: SOURCE_LANGUAGES.EN,
expectedSourceText: 'When God began to create', expectedBilingualText: '', expectedInterfaceText: interfaceTextEN },

// English Interface and Bilingual Source
{interfaceLanguage: 'English', sinterfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'Bilingual', sourceLanguageToggle: SOURCE_LANGUAGES.BI,
expectedSourceText: 'רֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃', expectedBilingualText: 'When God began to create',
expectedInterfaceText: interfaceTextEN },

// English Interface and Hebrew Source
{interfaceLanguage: 'English', interfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'Hebrew', sourceLanguageToggle: SOURCE_LANGUAGES.HE,
expectedSourceText: 'רֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃', expectedBilingualText: '', expectedInterfaceText: interfaceTextEN }

].forEach(({interfaceLanguage, interfaceLanguageToggle, sourceLanguage, sourceLanguageToggle, expectedSourceText, expectedBilingualText, expectedInterfaceText}) => {
test(`${interfaceLanguage} Interface Language with ${sourceLanguage} Source`, async ({ context }) => {

// Navigating to Bereshit with selected Interface Language, Hebrew or English
const page = await goToPageWithLang(context,'/Genesis.1',`${interfaceLanguageToggle}`)

// Selecting Source Language
await changeLanguageOfText(page, sourceLanguageToggle)

// Locating the source text segment, then verifying translation
await expect(page.locator('div.segmentNumber').first().locator('..').locator('p')).toContainText(`${expectedSourceText}`)

// Validate Hebrew interface language is still toggled
const textLink = page.locator('a.textLink').first()
await expect(textLink).toHaveText(`${expectedInterfaceText}`)

})
})
8 changes: 4 additions & 4 deletions e2e-tests/tests/reader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ test('Navigate to bereshit', async ({ context }) => {
});

test('Verify translations', async ({ context }) => {
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=Wikisource_Talmud_Bavli&lang=bi&with=all&lang2=he');
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=hebrew|Wikisource_Talmud_Bavli&lang=bi&with=all&lang2=he');
await page.getByRole('link', { name: 'Translations (4)' }).click();
await page.locator('#panel-1').getByText('Loading...').waitFor({ state: 'detached' });
page.getByText('A. Cohen, Cambridge University Press, 1921', { exact: true })
});

test('Get word description', async ({ context }) => {
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=Wikisource_Talmud_Bavli&lang=bi&with=all&lang2=he');
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=hebrew|Wikisource_Talmud_Bavli&lang=bi&with=all&lang2=he');
await page.getByRole('link', { name: 'ר\' נחוניא בן הקנה' }).click();
await page.locator('#panel-1').getByText('Loading...').waitFor({ state: 'detached' });
await page.getByText('Looking up words...').waitFor({ state: 'detached' });
Expand All @@ -31,11 +31,11 @@ test('Get word description', async ({ context }) => {


test('Open panel window', async ({ context }) => {
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=Wikisource_Talmud_Bavli&lang=bi&with=all&lang2=he');
const page = await goToPageWithLang(context, '/Berakhot.28b.4?vhe=hebrew|Wikisource_Talmud_Bavli&&lang=bi&with=all&lang2=he');
await page.getByText('ולית הלכתא לא כרב הונא ולא כריב"ל כרב הונא הא דאמרן כריב"ל דאריב"ל כיון שהגיע זמ').click();
await page.locator('#panel-1').getByText('Loading...').waitFor({ state: 'detached' });
await page.getByRole('link', { name: 'תלמוד (1)' }).click();
await page.getByRole('link', { name: 'שבת (1) מלאכות האסורות בשבת ודינים הקשורים לקדושת היום.' }).click();
await page.getByRole('link', { name: /^שבת/ }).click();
await page.getByText('טעינה...').waitFor({ state: 'detached' });
await page.getByRole('link', { name: 'Open' }).click();
await page.getByRole('heading', { name: 'Loading...' }).getByText('Loading...').waitFor({ state: 'detached' });
Expand Down
80 changes: 80 additions & 0 deletions e2e-tests/tests/translation-version-name-appears-in-title.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import {test, expect} from '@playwright/test';
import {goToPageWithLang, changeLanguageOfText} from "../utils";
import {LANGUAGES, SOURCE_LANGUAGES} from '../globals'

[
// Hebrew Interface and Hebrew Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'Hebrew', sourceLanguageToggle: SOURCE_LANGUAGES.HE,
translations: 'תרגומים', select: 'בחירה', currentlySelected: 'נוכחי'},

// Hebrew Interface and Bilingual Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'Bilingual', sourceLanguageToggle: SOURCE_LANGUAGES.BI,
translations: 'תרגומים', select: 'בחירה', currentlySelected: 'נוכחי'},

// Hebrew Interface and English Source
{interfaceLanguage: 'Hebrew', interfaceLanguageToggle: LANGUAGES.HE,
sourceLanguage: 'English', sourceLanguageToggle: SOURCE_LANGUAGES.EN,
translations: 'תרגומים', select: 'בחירה', currentlySelected: 'נוכחי'},

// English Interface and English Source
{interfaceLanguage: 'English', interfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'English', sourceLanguageToggle: SOURCE_LANGUAGES.EN,
translations: 'Translations', select: 'Select', currentlySelected: 'Currently Selected'},

// English Interface and English Source
{interfaceLanguage: 'English', interfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'Bilingual', sourceLanguageToggle: SOURCE_LANGUAGES.BI,
translations: 'Translations', select: 'Select', currentlySelected: 'Currently Selected'},

// English Interface and Hebrew Source
{interfaceLanguage: 'English', interfaceLanguageToggle: LANGUAGES.EN,
sourceLanguage: 'Hebrew', sourceLanguageToggle: SOURCE_LANGUAGES.HE,
translations: 'Translations', select: 'Select', currentlySelected: 'Currently Selected'}

].forEach(({interfaceLanguage, interfaceLanguageToggle, sourceLanguage, sourceLanguageToggle, translations, currentlySelected, select}) => {
test(`${interfaceLanguage} - translation name appears in title for ${sourceLanguage} source text`, async ({ context }) => {
// Navigate to Bereshit in specified Interface Language
const page = await goToPageWithLang(context,'/Genesis.1', `${interfaceLanguageToggle}`)

// Change the Source Language of the text
await changeLanguageOfText(page, sourceLanguageToggle)

// Retain the translation name locator
const translationNameInTitle = page.locator('span.readerTextVersion')

// Navigate to the Translations sidebar by clicking on the text title
//Clicks on בראשית א׳ / Genesis I
await page.locator('h1').click()

// Click on Translations
await page.getByRole('link', {name: `${translations}`}).click()

// Wait for Translations side-bar to load by waiting for 'Translations' header
await page.waitForSelector('h3')

// Check if the default translation in the title matches the selected translation
// NOTE: We are skipping checking for the default translation here, due to the Hebrew text being default Masoretic
if(sourceLanguage !== 'Hebrew'){
const defaultTranslation = await translationNameInTitle.textContent()
await expect(page.locator('div.version-with-preview-title-line', {hasText: defaultTranslation!}).getByRole('link')).toHaveText(`${currentlySelected}`)
}

// TODO: 4th translation, handling Hebrew Interface translations in Hebrew. For example: 'חומש רש״י, רבי שרגא זילברשטיין' should appear in the translation title as written.
const translationNames = ['The Schocken Bible, Everett Fox, 1995 ©', '«Да» project']

// Utilizing the traditional for-loop as there are async issues with foreach
for(let i = 0; i < translationNames.length; i++){

// "Select" another translation.
await page.locator('div.version-with-preview-title-line', {hasText: translationNames[i]}).getByText(`${select}`).click()

// Validate selected translation is reflected in title
await expect(translationNameInTitle).toHaveText(translationNames[i])

// Validate selected translation says 'Currently Selected'
await expect(page.locator('div.version-with-preview-title-line', {hasText: translationNames[i]}).getByRole('link')).toHaveText(`${currentlySelected}`)
}
})
});
39 changes: 32 additions & 7 deletions e2e-tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {DEFAULT_LANGUAGE, LANGUAGES, testUser} from './globals'
import {DEFAULT_LANGUAGE, LANGUAGES, SOURCE_LANGUAGES, testUser} from './globals'
import {BrowserContext} from 'playwright-core';
import type { Page } from 'playwright-core';

Expand All @@ -23,13 +23,16 @@ export const changeLanguage = async (page: Page, language: string) => {
}

export const goToPageWithLang = async (context: BrowserContext, url: string, language=DEFAULT_LANGUAGE) => {
if (!langCookies.length) {
const page: Page = await context.newPage();
await page.goto('');
await changeLanguage(page, language);
langCookies = await context.cookies();
}
// If a cookie already has contents, clear it so that the language cookie can be reset
if (langCookies.length) {
await context.clearCookies()
}
const page: Page = await context.newPage();
await page.goto('');
await changeLanguage(page, language);
langCookies = await context.cookies();
await context.addCookies(langCookies);

// this is a hack to get the cookie to work
const newPage: Page = await context.newPage();
await newPage.goto(url);
Expand Down Expand Up @@ -65,4 +68,26 @@ export const goToPageWithUser = async (context: BrowserContext, url: string, use
export const getPathAndParams = (url: string) => {
const urlObj = new URL(url);
return urlObj.pathname + urlObj.search;
}

export const changeLanguageOfText = async (page: Page, sourceLanguage: RegExp) => {
// Clicking on the Source Language toggle
await page.getByAltText('Toggle Reader Menu Display Settings').click()

// Selecting Source Language
await page.locator('div').filter({ hasText: sourceLanguage }).click()
}

export const getCountryByIp = async (page: Page) => {
const data = await page.evaluate(() => {
return fetch('https://ipapi.co/json/')
.then(response => response.json())
.then(data => data)
})
return data.country;
}

export const isIsraelIp = async (page: Page) => {
const country = await getCountryByIp(page);
return country === "IL";
}
Loading
Loading