This file contains hidden or 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
| package com.secookbook.examples.chapter01; | |
| import org.openqa.selenium.firefox.FirefoxDriver; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.WebElement; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.support.ui.ExpectedCondition; | |
| import org.openqa.selenium.support.ui.WebDriverWait; | |
| import org.junit.*; |
This file contains hidden or 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
| import {browser, element, by, ExpectedConditions as EC} from 'protractor/globals' | |
| describe('google', function () { | |
| beforeEach(function () { | |
| browser.get('/'); | |
| }); | |
| it('should show correct title after search', function () { | |
| expect(browser.getTitle()).toEqual('Google', 'The page title should be equal "Google" after open'); | |
| let searchField = element(by.name('q')); |
This file contains hidden or 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
| public class SearchPage extends PageObject { | |
| @FindBy(id = "searchString") | |
| WebElement searchField; | |
| @FindBy(css = "button[value='Search']") | |
| WebElement searchButton; | |
| @FindBy(id = "main-box-categories") | |
| WebElement categoriesList; |
This file contains hidden or 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
| class SearchPage extends PageObject { | |
| searchField = $('#searchString'); | |
| searchButton = $("button[value='Search']"); | |
| categoriesList = $('#main-box-categories'); | |
| searchFor(searchTerms: string) { | |
| this.searchField.sendKeys(searchTerms); | |
| this.searchButton.click(); | |
| } | |
This file contains hidden or 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
| it('Should delete one note', function() { | |
| browser.get(URL) | |
| //заметь что мы вызываем count() сразу. Так мы запомним количество правильно | |
| let countBefore = element.all(by.css('todo-list .small-12')).count() | |
| element($("input[type='checkbox']").click()) | |
| //важно поспать после клика чтобы элемент успел пропасть | |
| browser.sleep(2000) | |
| //Запоминаем количество после клика | |
| let countAfter = element.all(by.css('todo-list .small-12')).count() |
This file contains hidden or 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
| #Мои коментарии | |
| по итогам исследования твоего решения (http://stackoverflow.com/questions/30874167/multiple-browsers-and-the-page-object-pattern): | |
| добавил глобальные переменные | |
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
| global.BD1 = browser; | |
| BD1.BD1 = true; | |
| global.BD2 = browser.forkNewDriverInstance(); | |
| BD2.BD2 = true; |
This file contains hidden or 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
| #Мои коментарии | |
| 2. далее вопрос по использованию в классе (в моем случае Логин форм.) | |
| куда подставлять переменную this._browser (вставил в оба блока, но непосредственно логин происходит в signin. первый набор - для проверки наличия элементов). | |
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
| let BDwindow = require('../pageObjects/BigDipper.js').BDwindow | |
| class LoginForm extends BDwindow { |
This file contains hidden or 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
| 3. и собственно как потом полученное правильно использовать в тесте, если он звучит так (я там предположил использование, но явно оно неправильно - проверял ) - подозреваю, что тест написан не правильно: | |
| ============================================================================================================================ | |
| ============================================================================================================================ | |
| let LoginForm = require('../pageObjects/LoginForm.js').LoginForm | |
| let DashBoardPage = require('../pageObjects/DashBoardPage.js').DashBoardPage | |
| let data = require('../testdata/users.json') |
This file contains hidden or 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
| let someCollection = [0, 2, 3] | |
| //NATIVE MAP AND FILTER | |
| let newColletion = someCollection.map((elem, index)=>{ | |
| console.log(`INDEX: ${index}, value: ${elem}`) | |
| return elem + 2 | |
| }) | |
| console.log(newColletion) | |
This file contains hidden or 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
| FROM node:7 | |
| COPY . /e2e | |
| WORKDIR /e2e | |
| RUN npm install | |
| CMD npm test |