本文整理汇总了TypeScript中protractor.by.cssContainingText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript by.cssContainingText方法的具体用法?TypeScript by.cssContainingText怎么用?TypeScript by.cssContainingText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.by
的用法示例。
在下文中一共展示了by.cssContainingText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should create 3 users and sign-out from session', () => {
const USERS: UserAuth[] = new AuthUsersService().users;
const textService: TextService = new TextService();
browser.get('/#/auth/sign-in');
expect(browser.getCurrentUrl()).toMatch(/\/#\/auth\/sign-in$/);
element(by.css('input[type=text]')).sendKeys(USERS[1].email);
element.all(by.css('input[type=password]')).get(0).sendKeys(USERS[1].password);
// element.all(by.css('input[type=password]')).get(1).sendKeys('teacher1');
element(by.css('.btn')).click();
expect(browser.getCurrentUrl()).toMatch(/\/#\/profile$/);
element(by.cssContainingText('.btn.btn-default', 'Заполнить профиль')).click();
element.all(by.css('input[type=radio]')).get(1).click();
element.all(by.css('input[type=text]')).get(0).sendKeys(textService.generateText(5, {
onlyText: true, lowerCase: true
}));
element.all(by.css('input[type=text]')).get(1).sendKeys(textService.generateText(5, {
onlyText: true, lowerCase: true
}));
element.all(by.css('input[type=text]')).get(2).sendKeys(textService.generateText(5, {
onlyText: true, lowerCase: true
}));
element.all(by.css('input[type=text]')).get(3).sendKeys(textService.generateText(10, {
lowerCase: true
}));
element.all(by.css('input[type=text]')).get(4).sendKeys('3');
element(by.cssContainingText('.btn.btn-success.btn-sm', 'Сохранить')).click();
// element(by.cssContainingText('.navbar-profile button', 'Выход')).click();
expect(browser.getCurrentUrl()).toMatch(/\/#\/group-list$/);
browser.pause();
});
示例2: it
it('should be able to compare use of ngIf with changing css visibility', function () {
let setConditionButtonEle = element.all(by.css('button')).get(0);
let ngIfButtonEle = element(by.cssContainingText('button', 'if | !if'));
let ngIfParentEle = ngIfButtonEle.element(by.xpath('..'));
let ngIfSiblingEle = ngIfParentEle.element(by.css('heavy-loader'));
let cssButtonEle = element(by.cssContainingText('button', 'show | hide'));
let cssSiblingEle = cssButtonEle.element(by.xpath('..')).element(by.css('heavy-loader'));
let setConditionText: string;
setConditionButtonEle.getText().then(function(text: string) {
setConditionText = text;
expect(ngIfButtonEle.isPresent()).toBe(true, 'should be able to find ngIfButton');
expect(cssButtonEle.isPresent()).toBe(true, 'should be able to find cssButton');
expect(ngIfParentEle.isPresent()).toBe(true, 'should be able to find ngIfButton parent');
expect(ngIfSiblingEle.isPresent()).toBe(true, 'should be able to find ngIfButton sibling');
expect(cssSiblingEle.isPresent()).toBe(true, 'should be able to find cssButton sibling');
return ngIfButtonEle.click();
}).then(function() {
expect(ngIfSiblingEle.isPresent()).toBe(false, 'now should NOT be able to find ngIfButton sibling');
expect(setConditionButtonEle.getText()).not.toEqual(setConditionText);
return cssButtonEle.click();
}).then(function() {
expect(cssSiblingEle.isPresent()).toBe(true, 'now should still be able to find cssButton sibling');
expect(cssSiblingEle.isDisplayed()).toBe(false, 'now cssButton sibling should NOT be visible');
return ngIfButtonEle.click();
}).then(function() {
expect(setConditionButtonEle.getText()).toEqual(setConditionText);
});
});
示例3: it
it('should toggle *ngIf="hero" with a button', function () {
const toggleHeroButton = element.all(by.cssContainingText('button', 'Toggle hero')).get(0);
const paragraph = element.all(by.cssContainingText('p', 'I turned the corner'));
expect(paragraph.get(0).getText()).toContain('I waved');
toggleHeroButton.click().then(() => {
expect(paragraph.get(0).getText()).not.toContain('I waved');
});
});
示例4: it
it('should run a 9-player individual', () => {
// expect to be logged-in from previous test -> to improve
browser.get('/');
element(by.css('button')).click();
element(by.css('input[name="name"]')).sendKeys('Test Individual');
element(by.cssContainingText('select[name="movement"]>option', 'Individual for 9 players')).click();
element(by.cssContainingText('select[name="scoring"]>option', 'IMP')).click();
element(by.css('input[name="dealsPerRound"]')).clear();
element(by.css('input[name="dealsPerRound"]')).sendKeys('1');
// fill in players
element(by.linkText('Players')).click();
for (let i = 1; i <= 9; i++)
element(by.css(`form div:nth-of-type(${i}) input`)).sendKeys(`Player ${i}`);
element(by.linkText('Infos')).click();
element(by.buttonText('Create')).click();
// apparently the new angular 2 HttpModule's Observable aren't waited by protractor, so :
browser.wait(ExpectedConditions.elementToBeClickable(element(by.buttonText('Start'))), 12000);
element(by.buttonText('Start')).click();
// polling for scores is done outside angular, so we can keep synchronization
// but after that, without synchronization, we should wait for the buttons...
element(by.linkText('Play')).click();
for (let round = 0; round < 27; round++) {
const north1 = Math.floor(round / 9) * 3 + (Math.floor(round / 3) + 1) % 3 + 1;
element(by.css(`select[name="currentPlayer"]>option:nth-of-type(${north1})`)).click();
randomScore();
const north2 = (north1 + 2) % 9 + 1;
element(by.css(`select[name="currentPlayer"]>option:nth-of-type(${north2})`)).click();
randomScore();
if (round < 26) {
// wait for Next Round button
browser.wait(ExpectedConditions.elementToBeClickable(element(by.buttonText('Next Round'))), 12000);
element(by.buttonText('Next Round')).click();
// then wait for next round to actually begin
const roundSummary = element(by.cssContainingText('h4', 'Round'));
browser.wait(ExpectedConditions.textToBePresentInElement(roundSummary, 'Round ' + (round + 2)), 12000);
}
}
browser.wait(ExpectedConditions.presenceOf(element(by.buttonText('Close'))), 12000);
element(by.buttonText('Close')).click();
expect(element(by.linkText('Play'))).toBeTruthy();
expect(element(by.linkText('Players'))).toBeTruthy();
element(by.linkText('Players')).click();
element(by.linkText('Player 1')).click();
element(by.linkText('4')).click(); // Player 1 skips deals 1-3
element(by.linkText('Previous')).click();
});
示例5: it
it('shows selected hero details', async () => {
await element(by.cssContainingText('li', targetHero.name)).click();
let page = getPageElts();
let hero = await heroFromDetail(page.heroDetail);
expect(hero.id).toEqual(targetHero.id);
expect(hero.name).toEqual(targetHero.name);
});
示例6: expect
.then(t=>{
expect(t).toEqual('Responsável');
element(by.cssContainingText('option', 'en')).click();
return element(by.css('.gtaskheading.gresource')).getText()
})
示例7: it
it('should support "spy counter"', function () {
let updateCounterButtonEle = element(by.cssContainingText('counter-parent button', 'Update'));
let resetCounterButtonEle = element(by.cssContainingText('counter-parent button', 'Reset'));
let textEle = element(by.css('counter-parent my-counter > div'));
let logEles = element.all(by.css('counter-parent h4 ~ div'));
expect(textEle.getText()).toContain('Counter = 0');
expect(logEles.count()).toBe(2, 'should start with two log entries');
updateCounterButtonEle.click().then(function() {
expect(textEle.getText()).toContain('Counter = 1');
expect(logEles.count()).toBe(3, 'should now have 3 log entries');
return resetCounterButtonEle.click();
}).then(function() {
expect(textEle.getText()).toContain('Counter = 0');
expect(logEles.count()).toBe(7, 'should now have 7 log entries - 3 prev + 1 reset + 2 destroy + 1 init');
});
});
示例8: it
it('should add an alias field when the Add Alias button is clicked', async () => {
await addAliasButton.click();
const aliasInputs = profileEditor.all(by.cssContainingText('label', 'Alias'));
expect(await aliasInputs.count()).toBe(2);
});