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

@MobileTest iOS not honoring locale and language settings #53

Closed
renelux opened this issue Nov 14, 2014 · 28 comments
Closed

@MobileTest iOS not honoring locale and language settings #53

renelux opened this issue Nov 14, 2014 · 28 comments

Comments

@renelux
Copy link
Contributor

renelux commented Nov 14, 2014

Please see the example below if I run this test case the simulator is still being launched with language=en and locale=en_US.

package com.symbio.test;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import com.paypal.selion.annotations.MobileTest;
import com.paypal.selion.platform.grid.Grid;
import com.paypal.selion.reports.runtime.MobileReporter;

public class IOS_Multi_Locale {

    @MobileTest(appName = "InternationalMountains", language="fr", locale="fr_FR")
    @Test
    public void testMethod() throws InterruptedException {
        MobileReporter.log("My Screenshot 1", true);
        List cells = Grid.iOSDriver().findElements(By.className("UIATableCell"));
        Assert.assertEquals(9, cells.size());

        // get the 1st mountain
        WebElement first = (WebElement) cells.get(0);
        first.click();
        Thread.sleep(10 * 1000);

        // take a screenshot using the normal selenium api.
        MobileReporter.log("My Screenshot 2", true);

        // access the content
        By selector = By.xpath("//UIAStaticText[contains(@name,'climbed')]");
        WebElement text = Grid.iOSDriver().findElement(selector);
        System.out.println(text.getAttribute("name"));
    }

}
@azaytsev
Copy link
Contributor

@renelux - I just ran your test on my machine and it's definitely setting the locale and language to French. In fact, it fails because of the following line in your test, since the text is now in French.
By selector = By.xpath("//UIAStaticText[contains(@name,'climbed')]");

internationmountains_scr1
internationmountains_scr2 png

@renelux
Copy link
Contributor Author

renelux commented Nov 17, 2014

@azaytsev I am still running in to the same issue. Can you please tell me what Xcode you are using? And what simulator. I am on the latest version for both and I am not sure if it is supported correctly.

Is there a way to set the simulator that I want to use?

@azaytsev
Copy link
Contributor

@renelux, I was able to test with both XCode 6.0.1 / IOS 8.0 simulator and XCode 5.1.1 / iOS version 7.1

The answer to your second questions is yes, you can specify which simulator to use with capabilities (in IOSDriver) but i don't believe SeLion exposes that function at the moment.

For example:

IOSCapabilities cap = IOSCapabilities.iphone("InternationalMountains", "1.1");
cap.setCapability(IOSCapabilities.SIMULATOR, true);
cap.setCapability("simulatorVersion", "7.1");
cap.setCapability("sdkVersion", "7.1");`

@renelux
Copy link
Contributor Author

renelux commented Nov 18, 2014

I am running Xcode 6.1 and the default Simulator runs iOS 8.1.

I will see if I can added the functionality to SeLion to specify the simulator and SDK version.

@krmahadevan
Copy link

Rene
You don't need to be adding that. We already have a mechanism in SeLion using which you can add up your own custom capabilities.

For more information please take a look at the javadoc for
ConfigProperty.SELENIUM_CUSTOM_CAPABILITIES_PROVIDER

  • Cheers
    Krishnan.

Sent from a mobile.
So if you noticed any typos you know whom to blame 😊

-------- Original message --------
From: René Lux notifications@github.com
Date:11/18/2014 07:12 (GMT+05:30)
To: paypal/SeLion SeLion@noreply.github.com
Cc:
Subject: Re: [SeLion] @mobiletest iOS not honoring locale and language settings (#53)

I am running Xcode 6.1 and the default Simulator runs iOS 8.1.

I will see if I can added the functionality to SeLion to specify the simulator and SDK version.


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-63409426.

@mach6
Copy link
Contributor

mach6 commented Nov 18, 2014

@krmahadevan the down-side of using a custom capabilities provider here is the customization will apply to all tests for iOS which may not be the desired outcome.

@krmahadevan
Copy link

Doug
The effect can be nullified by isolating such tests into a separate suite file and then use it to run them.

If that doesn't work the only other option I see is to either enhance the @mobiletest annotation and add an attribute using which one can pass in a custom capability provider ( I don't want to add attributes directly to the annotation ) or we could just define a new annotation itself @CapabilityProvider and then use this.

I would prefer the new annotation approach and extend this to @webtest as well.

  • Cheers
    Krishnan.

Sent from a mobile.
So if you noticed any typos you know whom to blame 😊

-------- Original message --------
From: Doug Simmons notifications@github.com
Date:11/19/2014 01:39 (GMT+05:30)
To: paypal/SeLion SeLion@noreply.github.com
Cc: "Mahadevan, Krishnan" krmahadevan@paypal.com
Subject: Re: [SeLion] @mobiletest iOS not honoring locale and language settings (#53)

@krmahadevanhttps://github.com/krmahadevan the down-side of using a customer capabilities provider here is the customization will apply to all tests for iOS which may not be the desired outcome.


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-63536134.

@azaytsev
Copy link
Contributor

@renelux I'm working on enhancing @mobiletest annotation to support additional attributes to allow the enduser to specify the sdk version as well as device variation (iphone5, iphone6, etc), however, I've discovered a bug in ios-driver which needs to be fixed before this can be accomplished. I'm working on issuing an ios-driver pull request to address it. Will keep you posted as when this is ready to go.

@renelux
Copy link
Contributor Author

renelux commented Nov 20, 2014

@azaytsev thanks. I tried to implement the CustomCapabilities provider but it didn't solve my issue. I will wait for your update to see if I have more luck.

@krmahadevan
Copy link

@azaytsev
I am not sure if its a good idea to start enhancing the @MobileTest annotation with attributes that are either specific to the iOS platform or the Android Platform. Instead I was hoping that we would merely add an annotation say @CustomizeCapabilities which would accept a fully qualified class name of a custom capability provider and SeLion would internally use the similar mechanism that TestNG currently uses for data provider class names and then work with it.

@renelux

When you say you tried to implement CustomCapabilities Provider and it didn't work, what do you mean ? What exactly did you try ? Can you please help elaborate ?

@mach6
Copy link
Contributor

mach6 commented Nov 20, 2014

@krmahadevan I don't see anything wrong with changing the acceptable values for @MobileTest String device() such that it can receive iphone (existing support), ipad (existing support), android (existing support), android{x} (existing support), iphone{x} (new), and ipad{x} (new).

@renelux
Copy link
Contributor Author

renelux commented Nov 20, 2014

@krmahadevan I created a CustomCapabilities provider that extends the DefaultCapabilitiesBuilder. To the Capabilities I add the following parameters

capabilities.setCapability("simulatorVersion", "7.1");
capabilities.setCapability("sdkVersion", "7.1");`

In the console I see that these capabilities have been add. But the simulator that starts is still iOS 8.1 so it seems that the value is ignored.

I am thinking to downgrade Xcode and the iOS SDK to see if that helps.

@krmahadevan
Copy link

That's interesting. So the capabilities part works. Just that the remote server responsible for spawning the simulator is not honoring the capabilities so to speak.

This may require a bit more investigation to see where does the problem lie.

In the meantime can you please check on the following ?

  1. Spawn a local grid.
  2. Spawn a ios node and hook it on to the local grid.
  3. Try running the same test against the local grid ( runLocally=false) and share the results ? You may need to tinker selion to temporarily remove an edit check which prevents remote executions for iOS [ I don't quite remember if it's still there or has been removed ]
  • Cheers
    Krishnan.

Sent from a mobile.
So if you noticed any typos you know whom to blame 😊

-------- Original message --------
From: René Lux notifications@github.com
Date:11/20/2014 15:30 (GMT+05:30)
To: paypal/SeLion SeLion@noreply.github.com
Cc: "Mahadevan, Krishnan" krmahadevan@paypal.com
Subject: Re: [SeLion] @mobiletest iOS not honoring locale and language settings (#53)

@krmahadevanhttps://github.com/krmahadevan I created a CustomCapabilities provider that extends the DefaultCapabilitiesBuilder. To the Capabilities I add the following parameters

capabilities.setCapability("simulatorVersion", "7.1");
capabilities.setCapability("sdkVersion", "7.1");`

In the console I see that these capabilities have been add. But the simulator that starts is still iOS 8.1 so it seems that the value is ignored.

I am thinking to downgrade Xcode and the iOS SDK to see if that helps.


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-63785514.

@krmahadevan
Copy link

Doug
Nothing wrong in adding attributes to the @mobiletest annotation as long as they are common to both ios and android. My only concern is that we shouldn't be adding attributes to this annotation that are ios or Android specific. If there is a need for such a requirement then I think we should think of handing it in a different manner ( for e.g via a new custom annotation that can be used in conjunction with both MobileTest and WebTest annotation )

  • Cheers
    Krishnan.

Sent from a mobile.
So if you noticed any typos you know whom to blame 😊

-------- Original message --------
From: Doug Simmons notifications@github.com
Date:11/20/2014 11:20 (GMT+05:30)
To: paypal/SeLion SeLion@noreply.github.com
Cc: "Mahadevan, Krishnan" krmahadevan@paypal.com
Subject: Re: [SeLion] @mobiletest iOS not honoring locale and language settings (#53)

@krmahadevanhttps://github.com/krmahadevan I don't see anything wrong with changing the acceptable values for @mobiletest String device() such that it can receive iphone (existing support), ipad (existing support), android (existing support), android{x} (existing support), iphone{x} (new), and ipad{x} (new).


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-63764358.

@mach6
Copy link
Contributor

mach6 commented Nov 20, 2014

@renelux its because of the bug in ios driver that Alex mentioned above

@azaytsev
Copy link
Contributor

@renelux issued a pull request in ios-driver for the bug fix. ios-driver/ios-driver#327
If you want you can try checking out my ios-driver branch building it locally and seeing if that fixes your issue. (https://github.com/azaytsev/ios-driver/tree/azaytsev_classcast_exception_fix)

I'm also working on adding iphone{x} capability to SeLion which will allow you to specify the sdk version you want to run with.

@renelux
Copy link
Contributor Author

renelux commented Nov 21, 2014

@azaytsev it seems that your bug is solving the issue. Or atleast I now get a different kind of error.

Unable to get UUID for device iPhone Retina (4-inch) with SDK 7.1

I guess this is because I don't have the proper SDK installed yet. Any pointers on how I can install a older SDK besides the latest version? If I remove the SDK version from my CustomCapability it will just start the iOS 8.1 simulator.

Edit: Already found a document that is helpful with installing older Xcode versions. http://docs.appcelerator.com/titanium/3.0/#!/guide/Installing_the_iOS_SDK-section-29004875_InstallingtheiOSSDK-Xcode incase other users ever need it.

@azaytsev
Copy link
Contributor

@renelux You are close. I am still working on adding functionality to SeLion to allow users to specify device variation via annotation. In the meanwhile you should be able to fix it by adding another capability.

capabilities.setCapability(IOSCapabilities.VARIATION, DeviceVariation.iPhone5s);

There is also a way to run multiple version on XCode on one machine and be able to switch between them (I currently have this setup). I'll publish the instructions on how to do it some time next week when I come back from PTO.

@kumaravel-jayakumar
Copy link
Contributor

@renelux
As azaytsev mentioned you can install multiple versions on Xcode in the same machine and use either one to run the simulator. I am giving an approach I follow.
I have installed Xcode 5.1.1 into the folder '/Applications/Xcode5.1.1' so my Xcode.app sits under '/Applications/Xcode5.1.1/Xcode.app', but I still have Xcode 6 installed under '/Applications/Xcode.app' don't disturb this. In your terminal fire the command 'xcode-select -p' which gives you the currently installed Xcode version mine says '/Applications/Xcode.app/Contents/Developer/', so its Xcode 6. To switch to Xcode 5.1.1 (you need sudo access) fire the command 'sudo sudo xcode-select -s /Applications/Xcode5.1.1/Xcode.app/Contents/Developer/'. This will switch to Xcode 5.1.1 and iOS simulators 7.1.

@renelux
Copy link
Contributor Author

renelux commented Nov 21, 2014

@kumaravel-jayakumar thanks, I already found a article that suggests the same thing. I am currently downloading version Xcode 5.1.1 and Xcode 6.0.1 as it seems that @azaytsev got it working. I will update this thread once it works.

@kumaravel-jayakumar
Copy link
Contributor

@azaytsev
I have got a similar error 'Unable to get UUID for device iPhone Retina (4-inch) with SDK 7.1'. This happens if you have downloaded iOS 7 simulator in Xcode 6. I used to fix this issue by requesting for iPhone 5s, if you do this it will not show up this error. This error is because ios-driver sets iPhone Retina (4-inch) as its default device while choosing SDK version 7.1. iOS 7 simulator in Xcode 6 does not have the device iPhone Retina (4 inch).

@renelux
Copy link
Contributor Author

renelux commented Nov 21, 2014

@azaytsev I got it working on Xcode 5.1.1 and SDK 7.1 but with Xcode 6.0.1 and SDK 8.0 the InternationalMountains app crashes.

Is the version linked on the ios-driver website compatible with iOS 8?

@kumaravel-jayakumar
Copy link
Contributor

@renelux
Where did you get your InternationalMountains application?

@mach6
Copy link
Contributor

mach6 commented Nov 24, 2014

@renelux fyi - ios-driver/ios-driver#327 is merged

@azaytsev
Copy link
Contributor

azaytsev commented Dec 1, 2014

@renelux - Take a look at my branch here(https://github.com/azaytsev/SeLion/tree/azaytsev-ios-mobiletest-enhancements). It's still a work in progress but I've added capabilities that allow you to specify the sdk version and/or device variation via annotations.

Take a look at NativeAppDemo.java class for some code samples. This should resolve you issue of being able to launch an app in different version of sdk/phone variation without actually having to install multiple versions os XCode.

@azaytsev
Copy link
Contributor

azaytsev commented Dec 5, 2014

@renelux is this still an issue or can this ticket be closed?

@mach6
Copy link
Contributor

mach6 commented Dec 10, 2014

I'll close this when we merge the new code to SeLion for specifying SDK version. :)

@mach6
Copy link
Contributor

mach6 commented Jan 8, 2015

new code merged to develop branch. closing this.

@mach6 mach6 closed this as completed Jan 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants