/onty-webmail-seleniumTest-dotnet

Automated Selenium test suite for the Simple Webmail System

Primary LanguageC#

Onty.SeleniumTest.Webmail

Automated Selenium test suite for the Simple Webmail System

These tests were written in C# using Selenuium 3 API. They currently support FireFox, IE, Chrome, and PhantomJS.

Running the suite

Pre-requisites

  1. Microsoft Windows 7 or higher (I run on 64-bit; suite has not been tested on 32-bit so may have issues)
  2. Microsoft Visual Studio 2015 or higher (Community version is sufficient)
  3. Microsoft .NET 4.62 Developer Pack (download here; you will need to restart the machine afterwards)
  4. A supported web browser. Suite currently supports:
    1. Mozilla FireFox (version 48 is strongly suggested because higher versions of FireFox cause a crash at the end of each test.)
    2. Microsoft Internet Explorer (I use version 11 on 64-bit Windows 7 machine; if you use anything else your mileage may vary. Also please make sure you follow the required setup instructions in Setup section below.) (Read here for a detailed discussion on why you should use 32-bit IE WebDriver instead of 64-bit.)
    3. Google Chrome
    4. PhantomJS - a "headless" browser

Setup

  1. Download the entire suite, and open in Visual Studio
  2. In Solution Explorer tool window, right-click the solution ("Onty.SeleniumTest.Webmail" root entry) and click Restore NuGet Packages. This will download all required components and place them in appropriate locations to enable the test to run.
  3. Browser configuration:
    1. All browsers: edit the app.config file, and change WebDriverType to: firefox to run tests using Firefox, or ie for Internet Explorer, or chrome for Chrome, or phantomjs for PhantomJS
    2. FireFox: Edit the app.config file and change the PathFirefox entry to the actual path where FireFox is on your machine.
    3. MSIE: Please please please make sure you follow the setup instructions

Actually running

  1. Build the solution.
  2. Open Test Expolrer tool window in Visual Studio, and click Run All

Notes:

  1. Occasionally, a message that a FireFox plugin has crashed may be displayed. This does not seem to affect the test results. Just click "close" after the test finisies running. I don't know how to make the message not appear. If anyone knows how to fix it, please tell me. Thanks.
  2. The WebDriver executables sometimes stay running in memory after the test completes. This is a deficiency of WebDriver. The test calls driver.Quit() whether test passes or fails, but every now and again you may find leftover processes.

Implemented tests

  1. Unauthenticated user
    1. Login page
  2. Login
    1. Valid login
    2. Invalid login
  3. Account pages
    1. View user list, and view info for currently logged in user
    2. Password page
    3. Logout
    4. Create a new account
  4. Mailbox
    1. Mailbox page
    2. Create custom folder
    3. Send a message and verify it was sent; also logs in as recipient and verifies that message was received
  5. General tests
    1. Check presense of all expected menu items in left-hand-side menu (this test really belongs to another category, but not sure where yet)

To do

The following tests still need to be written

  1. Changing the Password
    1. Actually change the password, logout, and try to login using new password
    2. Try changing to blank password (negative test)
    3. Try entering mismatching passwords when changing password (negative test)
  2. Negative tests for creating a new account
    1. Try to create a new account with duplicate username (negative test)
    2. Try to create a new account with duplicate email, same as an already existing account (negative test)

General to-do items

  1. Get suite to run on other browsers
    1. Safari
  2. Get suite to run with cloud testing solutions
    1. BrowserStack
    2. SauceLabs
  3. Currently every time a new page is retrieved, the function CommonPageElements.WaitForPageToLoad() is called. The latter is currently implemented as a simple Thread.Sleep() which works, but is a bad idea in the long-term. There need to be a better way to determine if a page has loaded. For example, there could be some hidden element at the end of the page presense of which can be used to determine if page has fully loaded. If you are reading this, and know a good way to do so, please contact me and educate me.