-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vlad Yanko
authored and
Vlad Yanko
committed
Dec 30, 2019
0 parents
commit 6832b22
Showing
8 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# dependencies | ||
node_modules | ||
|
||
ConvertedJSFiles | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/*" | ||
] | ||
} |