Skip to content

Instantly share code, notes, and snippets.

Created February 5, 2015 13:58
Show Gist options
  • Save anonymous/422c08d8fdd0c77baa83 to your computer and use it in GitHub Desktop.
Save anonymous/422c08d8fdd0c77baa83 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Feb 5, 2015.
    29 changes: 29 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    Auth = require '../auth/auth.po.coffee'
    Project = require '../utils/project.po.coffee'
    Detail = require '../tabs/detail.po.coffee'
    ProtectedArea = require '../forms/protectedAreaCreating.po.coffee'

    ddescribe 'Protected area', ->
    auth = null
    project = null
    ptor = protractor.getInstance()
    detail = null
    protectedArea = null

    beforeEach ->
    auth = new Auth
    project = new Project
    detail = new Detail
    protectedArea = new ProtectedArea
    auth.get()
    auth.login().then =>
    project.createNewProject("testomato.com").then =>
    ptor.sleep(1000)
    afterEach ->
    auth.logout().then ->
    console.log "KONEC testu Protected area"

    it 'should be created and visible on project detail', ->
    console.log "\nSTART testu Protected area should be created and visible on project detail"
    detail.getCreateProtectedButton().click().then =>
    protectedArea.fillForm()
    68 changes: 68 additions & 0 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    class Protected

    constructor: ->
    @urlInput = element(By.css("#loginFormUrl"))
    @urlSubmit = element By.css 'input[value="Submit"]'
    @loginFormSelectLocator = By.css '#select-form-2'
    @loginFormSelect = element By.css '#select-form-2'
    @areaNameInput = element By.id 'newAreaName'
    @emailInput = element By.css 'input[name="email"]'
    @emailInputLocator = By.css 'input[name="email"]'
    @pwdInput = element By.css 'input[name="password"]'
    @saveCredentialsButton = element By.css 'button[ng-click="saveCredentials()"]'
    @loginName = "[email protected]"
    @pwd = "pwd123pwd"
    @areaNameText = "Test Area"
    @manageAreaButton = element By.css 'button[title="Manage"]' # password protected area Test Area"]'

    getUrlInput: =>
    @urlInput

    getUrlSubmit: =>
    @urlSubmit

    getLoginFormSelect: =>
    @loginFormSelect

    getLoginFormSelectLocator: =>
    @loginFormSelectLocator

    getAreaNameInput: =>
    @areaNameInput

    getEmailInput: =>
    @emailInput

    getEmailInputLocator: =>
    @emailInputLocator

    getPwdInput: =>
    @pwdInput

    getSaveCredentialsButton: =>
    @saveCredentialsButton

    getManageAreaButton: =>
    @manageAreaButton

    fillForm: =>
    @getUrlInput().clear()
    @getUrlInput().sendKeys "/"
    @getUrlSubmit().click().then =>
    browser.driver.wait( =>
    browser.driver.isElementPresent(@getLoginFormSelectLocator())
    , 5000, 'Waited for created protected area is shown.')
    @getLoginFormSelect().click().then =>
    browser.driver.wait( =>
    browser.driver.isElementPresent(@getEmailInputLocator())
    , 5000, 'Waited for username input is shown.')
    @getAreaNameInput().clear()
    @getAreaNameInput().sendKeys @areaNameText
    @getEmailInput().clear()
    @getEmailInput().sendKeys @loginName
    @getPwdInput().clear()
    @getPwdInput().sendKeys @pwd
    @getSaveCredentialsButton().click()


    module.exports = Protected