GithubHelp home page GithubHelp logo

isabella232 / mobileautomationsampleproject Goto Github PK

View Code? Open in Web Editor NEW

This project forked from badoo/mobileautomationsampleproject

0.0 0.0 0.0 16 KB

A sample project to demonstrate best practices for a mobile automation using Cucumber framework

License: MIT License

Ruby 88.67% Gherkin 11.33%

mobileautomationsampleproject's Introduction

Sample Project

The sample project demonstrates the best practices to reuse on mobile automation project on Ruby with Cucumber framework.

You can find each practice by keywords like: 'Good Practice' or 'Bad Practice'. For example:

Bad Practice #1

# INFO: Bad Practice
# Example #1 - verification logic is moved to the Page
And(/^(.+) should have missed Video call message from "(.+)"$/) do |user, chat_companion_name|
  persona_with(role: user) do
    Pages::ChatPage.new.await.verify_missed_video_call(name: chat_companion_name)
  end
end

vs

Good Practice #1

# INFO: Good Practice
# Example #1 - verification logic is moved to the step
And(/^(.+) should have missed Video call message from "(.+)"$/) do |user, chat_companion_name|
  persona_with(role: user) do
    chat_page = Pages::ChatPage.new.await

    # Check #1: Verify missed Video call message text
    expected = ExpectedData.missed_video_call(name: chat_companion_name)
    actual   = chat_page.video_call_message_text
    Assertions.assert_equal(expected, actual, "Missed video call message is incorrect")

    # Check #2: Verify missed Video call button
    expected = ExpectedData::CALL_BACK_BUTTON
    actual   = chat_page.call_back_button_text
    Assertions.assert_equal(expected, actual, "Call back button text is incorrect")
  end
end

Best Practices: Quick References

1.1. Keep verification logic in steps:

  • verification logic in steps - steps/chat_steps.rb:53
  • keep page methods simple - your_app/component/chat/conversation/message/video_message.rb:10

1.2. Create components:

  • video message chat component - your_app/component/chat/conversation/message/video_message.rb:11

1.3. Create generic steps

  • generic page await - steps/generic_steps.rb:21
  • generic go back action - steps/generic_steps.rb:29

1.4. Verify all possible states:

  • loader should not appear - steps/chat_steps.rb:35

1.5. Create ensured preconditions

  • ensure location service is off - your_app/page/system_settings_page.rb:20
  • ensure all chat messages received - steps/chat_steps.rb:23

1.6. Create reusable and stable steps:

  • create simple steps to reuse it in many cases - steps/chat_steps.rb:84
  • create complex steps and ensure state transition inside - steps/chat_steps.rb:119

1.7. Verify optional elements:

  • verify optional titles and buttons - your_app/page/abstract_alert_page.rb:10

Environment Requisites

1.1. Install RVM:

curl -sSL https://get.rvm.io | bash -s stable

to start using RVM you need to run source ~/.rvm/scripts/rvm

1.2. Install Ruby:

rvm install ruby-2.6.3

1.3. Install Bundler Gem to manage Gem dependencies:

gem install bundler

1.4. Install Gem dependencies from Gemfile:

bundle install

Usage

For running tests cases, please use command:

bundle exec cucumber -p sample_project

mobileautomationsampleproject's People

Contributors

rajdeepv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.