GithubHelp home page GithubHelp logo

lirazshay / pageobjectsdemo Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 16 KB

Demonstration of how to build robust PageObject classes that follows OOP concepts

License: MIT License

C# 100.00%
pageobject-pattern pageobjectmodel pageobject pageobjects page-object-model page-object selenium selenium-webdriver csharp object-oriented-programming

pageobjectsdemo's Introduction

PageObjectsDemo

Demonstration of how to build robust PageObject classes that follow OOP concepts

Slides for my session about Selenium Design Patterns are here:
https://www.slideshare.net/LirazShay/selenium-design-patterns-104347453

The solution contains 2 projects

  1. MailBox without Selenlium implementation
  2. TodoMVC tests - woring example (with Selenium implementation) on the http://todomvc.com/examples/angularjs/#/

For example:

       [Test]
       public void CheckIfMessageWithSubjectIsUnread()
       {
           bool isUnread = Inbox.IsMessageWithSubjectIsUnread("I like cheese");
       }
VS
       [Test]
       public void CheckIfMessageWithSubjectIsUnread()
       {
           bool isUnread = Inbox
               .Messages
               .First(a => a.Subject == "I like cheese")
               .IsUnread();
       }   
   And  
    public class PrimitiveInboxPageObject
   {
       public PrimitiveInboxPageObject(IWebDriver driver)
       {
           
       }

       public bool IsMessageWithSubjectIsUnread(string subject)
       {
           throw new NotImplementedException();
       }

       public bool IsMessageFromSenderIsUnread(string sender)
       {
           throw new NotImplementedException();
       }

       public bool IsMessageWithSubjectHasFlag(string subject)
       {
           throw new NotImplementedException();
       }

       public bool IsMessageFromSenderHasFlag(string sender)
       {
           throw new NotImplementedException();
       }

       public string GetSubjectOfMessageWithSender(string sender)
       {
           throw new NotImplementedException();
       }

       public string GetSenderOfMessageWithSubject(string subject)
       {
           throw new NotImplementedException();
       }

       public MessagePage OpenMessageBySubject(string subject)
       {
           throw new NotImplementedException();
       }

       public void OpenMessageBySender(string sender)
       {
           throw new NotImplementedException();
       }

   
VS    

   public class OOPInboxPageObject
   {
       public OOPInboxPageObject(IWebDriver driver)
       {
           
       }

       public IList<MessageRow> Messages { get; set; }
   }
   
   public class MessageRow
   {
       public bool IsUnread()
       {
           throw new System.NotImplementedException();
       }

       public string Subject { get; set; }
       public string Sender { get; set; }
       public DateTime Date { get; set; }
       public int Size { get; set; }

       public bool IsFlagged()
       {
           throw new System.NotImplementedException();
       }

       public MessagePage Open()
       {
           throw new System.NotImplementedException();
       }
   }
   
   ```       

pageobjectsdemo's People

Contributors

lirazshay avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

csnikhilpatel

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.