Vinee
Vinee

Reputation: 402

Calabash Error - superclass mismatch for class AuthenticationPage

I am new to Ruby/Calabash and managed to set a dedicated calabash automation framework for ios with a page object model pattern and its running successfully.

I want to extend the same framework for android too. I created a dedicated folder for ios and android inside features folder and thought of having their respective page objects inside those folder.

But when I ran calabash-android, calabash finds a similar page class exists in ios folder and started throwing the error message. I want to follow same naming convention for ios and android pages without having this name-clash. Is it possible?

    superclass mismatch for class AuthenticationPage (TypeError) 
    /Users/MACUSER/Documents/Automation/features/ios/pages/authentication_page. rb:5:in `<top (required)>'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:180:in `load_file'
  /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `each'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:184:in `load_step_definitions'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:42:in `run!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top  (required)>'
 /usr/bin/cucumber:23:in `load'
 /usr/bin/cucumber:23:in `<main>'

Upvotes: 1

Views: 423

Answers (3)

Mesut GUNES
Mesut GUNES

Reputation: 7401

Xamarin is saying you should give the profile and the config in the command --profile ios --config=config/cucumber.yml. See this:

test-cloud submit prebuilt/Moda-cal.ipa  93dbwrmwrb0d65099640f23 --devices 99dwdhw846 --series "ip7" --locale "en_US" --app-name "Moda" --user [email protected] --profile ios --config=config/cucumber.yml

test-cloud submit prebuilt/Moda.apk  93dbwrmwrb06sfu440f23 --devices 9933nb846 --series "nex" --locale "en_US" --app-name "Moda" --user [email protected] --profile android --config=config/cucumber.yml

Upvotes: 0

ludenus
ludenus

Reputation: 1341

had similar problem, solved by adding exclude option "--exclude ios" to android profile in config/cucumber.yml file (and "--exclude android" for ios respectively)

---
android: PLATFORM=android  --exclude ios -r features/support -r features/android -r features/step_definitions -r features/android/pages


ios: PLATFORM=ios APP_BUNDLE_PATH=path_to_your.app --exclude android -r features/support -r features/ios/support -r features/ios/helpers -r features/step_definitions -r features/ios/pages

seems to be cucumber bug, because according to cucumber docs -r switch should prevent loading all files except those specified explicitly

-r, --require LIBRARY|DIR        Require files before executing the features. If this
                                 option is not specified, all *.rb files that are
                                 siblings or below the features will be loaded auto-
                                 matically. Automatic loading is disabled when this
                                 option is specified, and all loading becomes explicit.
                                 Files under directories named "support" are always
                                 loaded first.

...

-e, --exclude PATTERN            Don't run feature files or require ruby files matching PATTERN

Upvotes: 0

Lasse
Lasse

Reputation: 1163

Based on your description of the issue, it is not clear what the problem is. I think it would help if you added more details about your folder structures and files.

But as you have not mentioned profiles as all I am suspecting that you are not using an .yml file.

When you execute your tests you should define what profile you are running and have one for iOS and one for Android. For each profile you will define what folders to include.

Like this

android: PLATFORM=android RESET_BETWEEN_SCENARIOS=1 -r features/support -r features/android/support -r features/android/helpers -r features/step_definitions -r features/android/pages/

And then when you execute the tests you define for what profile

calabash-android run path_to.apk -p android features/login.feature

If you have not already you should look at either Xamarin cross-platform tutorial or on the Github page for same

Upvotes: 1

Related Questions