Skip to content

Commit

Permalink
initial commit with collaboration
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Yanko authored and Vlad Yanko committed Dec 30, 2019
0 parents commit 6832b22
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dependencies
node_modules

ConvertedJSFiles
package-lock.json
18 changes: 18 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Config } from 'protractor';
export let config: Config = {
seleniumAddress: "http://127.0.0.1:4444/wd/hub",
capabilities: {
'browserName': 'chrome'
},
framework: 'jasmine',
specs: ['./specs/*.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 90000
},
// onPrepare: () => {
// let globals = require('protractor');
// let browser = globals.browser;
// browser.manage().window().maximize();
// browser.manage().timeouts().implicitlyWait(5000);
// }
}
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "protractor_tests",
"version": "1.0.0",
"description": "Asdasd",
"main": "conf.js",
"dependencies": {
"@types/jasmine": "^3.5.0",
"@types/node": "^13.1.1",
"jasminewd2": "^2.2.0",
"protractor": "^5.4.2",
"typescript": "^3.6.4"
},
"devDependencies": {},
"scripts": {
"pretest": "npm run tsc",
"test": "protractor ConvertedJSFiles/config.js",
"tsc": "tsc"
},
"author": "",
"license": "ISC"
}
7 changes: 7 additions & 0 deletions page_objects/HomePage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default class HomePage {

getHomePage(browser:any) {
browser.waitForAngularEnabled(false)
browser.get('https://workflowy.com/')
}
}
34 changes: 34 additions & 0 deletions page_objects/Item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ExpectedConditions } from 'protractor'

export default class Item {

private bulletInputClass:string = '._4q4shy'
private bulletInputText:string = 'something'
private addChildButtonClass:string = '.addChildButton'
private starButton:string = '.starButton'

addItem(browser:any, cssMethod:any) {
let bulletInput = cssMethod(this.bulletInputClass)
let addChildButton = cssMethod(this.addChildButtonClass)

let EC = ExpectedConditions
let condition1 = EC.visibilityOf(addChildButton)
let condition2 = EC.visibilityOf(bulletInput)

browser.wait(condition1, 2000)
addChildButton.click()
.then(() =>
browser.wait(condition2, 3000),
bulletInput.sendKeys(this.bulletInputText))
}

expectNewItem(cssMethod:any) {
let bulletInput = cssMethod(this.bulletInputClass)

expect<any>(bulletInput.getText()).toEqual(this.bulletInputText)
}

starNode(cssMethod:any) {
cssMethod(this.starButton).click()
}
}
20 changes: 20 additions & 0 deletions page_objects/Login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ExpectedConditions, by } from 'protractor'

export default class Login {

private loginButton1:string = '._1tjtxrr'
private loginButton2:string = '._iu6sog'

login(browser:any, cssMethod:any, element:any) {
cssMethod(this.loginButton1).click()
element(by.name('email')).sendKeys('[email protected]')
cssMethod(this.loginButton2).click()

let codeInput = element(by.name('code'))
let EC = ExpectedConditions
let condition = EC.visibilityOf(codeInput)
browser.wait(condition, 6000)
codeInput.sendKeys('111111')
cssMethod(this.loginButton2).click()
}
}
29 changes: 29 additions & 0 deletions specs/collaboration_spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { browser, element, $ } from 'protractor'

import HomePage from "../page_objects/HomePage"
import Login from "../page_objects/Login"
import Item from "../page_objects/Item"

describe('collaboration test on workflowy', function() {

var homePage = new HomePage()
var login = new Login()
var item = new Item()

var browser2 = browser.forkNewDriverInstance()
var element2 = browser2.element
var $2 = browser2.$

it('should open 2 browser windows and check calloboration', function() {
homePage.getHomePage(browser)
homePage.getHomePage(browser2)

login.login(browser, $, element)
login.login(browser2, $2, element2)

item.addItem(browser, $)

browser2.sleep(12000)
item.expectNewItem($2)
})
})
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"lib": ["es6"],
"strict": true,
"baseUrl": "./node_modules",
"module": "commonjs",
"target": "es6",
"outDir" : "ConvertedJSFiles",
"types" : ["jasmine", "node"]
},
"exclude": [
"node_modules/*"
]
}

0 comments on commit 6832b22

Please sign in to comment.