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

Fix device language getter #211

Merged
merged 4 commits into from Apr 28, 2020
Merged

Fix device language getter #211

merged 4 commits into from Apr 28, 2020

Conversation

hueitan
Copy link
Member

@hueitan hueitan commented Apr 20, 2020

A hotfix to fix the getter function in the previous pr #208

Phab Ticket : https://phabricator.wikimedia.org/T249710#6072863

@jpita
Copy link
Contributor

jpita commented Apr 21, 2020

can someone put the steps to replicate the issue so I can try it?

@jpita
Copy link
Contributor

jpita commented Apr 21, 2020

on this branch, by deleting the property language-app and leaving language-device as en , I still see the issue.
I'm not sure of:

  • how the variables are set on the device
  • how to replicate the issue on the device
  • whenever I change language-device to anything else other than en, it falls back to en (I guess this is because the browser language is en

@hueitan
Copy link
Member Author

hueitan commented Apr 21, 2020

on this branch, by deleting the property language-app and leaving language-device as en , I still see the issue.

Please ignore this, there isn't a way for a user to do this. The app always has both languages set in local storage.

  • how to replicate the issue on the device

Open the chrome browser, clear all the localStorage, refresh the app and I see error in console.

You need to find a browser that returns the language without -, for example en instead of en-US, then you will see the issue

  • whenever I change language-device to anything else other than en, it falls back to en (I guess this is because the browser language is en

This is expected if your device defaults to English language, so the browser returns english.

Copy link
Collaborator

@stephanebisson stephanebisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes it for me on the device.

@jpita
Copy link
Contributor

jpita commented Apr 22, 2020

I'm not entirely sure why/how but I still get the issue when I was trying some stuff with the cypress tests
image
the test flow is:
1-go to cat article directly with url (setting the has-onboard-before varible)
2-change the language of the article to portuguese (not the browser/device/app language)
3-go to sections and select suggested articles

I tried manually both on the browser and device and can't replicate the issue, this just means that somehow the language is still not being set, although the user might not run into the same scenario

@hueitan
Copy link
Member Author

hueitan commented Apr 22, 2020

did you refresh the browser after the second step?

@jpita
Copy link
Contributor

jpita commented Apr 22, 2020

did you refresh the browser after the second step?

updated the steps, there was information missing

@jpita
Copy link
Contributor

jpita commented Apr 23, 2020

@hueitan https://937-212663631-gh.circle-artifacts.com/0/screenshots/experiences.js/Article%20view%20--%20check%20footer.png
if you want to see it, on your machine do
npx cypress open
and run only the experience.js file.

})

it('check footer', () => {
articlePage.selectOptionFromActionsMenu('sections')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just check on cypress, when you have a new it() scope, it clears all the local storage item.

Therefore, the following script is needed at the beginning of the scope

cy.setLocalStorage('has-onboard-before', true)
cy.visit('http://127.0.0.1:8080/#/article/en/Cat')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpita does this work for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the has-onboard-before variable has nothing to do with the language.
shall we ignore this and merge the code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per the meeting discussion, please ignore this and merge the code without experience.js.

@jpita jpita merged commit 03948f4 into master Apr 28, 2020
@jpita jpita deleted the Hotfix-for-device-language branch April 28, 2020 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants