本文整理汇总了TypeScript中protractor.By.className方法的典型用法代码示例。如果您正苦于以下问题:TypeScript By.className方法的具体用法?TypeScript By.className怎么用?TypeScript By.className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.By
的用法示例。
在下文中一共展示了By.className方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('can save edits to a tribe correctly', async function () {
await browser.get(hostName + '/test-login?username=' + userEmail + '&password="pw"');
await browser.wait(async () => `${hostName}/tribes/` === await browser.getCurrentUrl(), 1000);
const tribeElements = element.all(By.className('tribe-card'));
tribeElements.first().element(By.className("tribe-card-header")).click();
expect(browser.getCurrentUrl()).toEqual(hostName + '/' + tribe.id + '/edit/');
expect(element(By.id('tribe-name')).getAttribute('value')).toEqual(tribe.name);
const expectedNewName = 'Different name';
element(By.id('tribe-name')).clear();
element(By.id('tribe-name')).sendKeys(expectedNewName);
element(By.id('call-sign-checkbox')).click();
element(By.id('badge-checkbox')).click();
const expectedDefaultBadgeName = 'New Default Badge Name';
updateTextBox(By.id('default-badge-name'), expectedDefaultBadgeName);
const expectedAltBadgeName = 'New Alt Badge Name';
updateTextBox(By.id('alt-badge-name'), expectedAltBadgeName);
const differentBadgesOption = element(By.css('#pairing-rule option[label="Prefer Different Badges (Beta)"]'));
differentBadgesOption.click();
element(By.id('save-tribe-button')).click();
await browser.wait(async () => `${hostName}/tribes/` === await browser.getCurrentUrl(), 1000);
await browser.setLocation('/' + tribe.id + '/edit/');
await browser.wait(() => element(By.id('tribe-name')).isPresent(), 2000);
expect(element(By.id('tribe-name')).getAttribute('value')).toEqual(expectedNewName);
expect(element(By.id('call-sign-checkbox')).getAttribute('checked')).toEqual('true');
expect(element(By.id('badge-checkbox')).getAttribute('checked')).toEqual('true');
expect(element(By.id('default-badge-name')).getAttribute('value')).toEqual(expectedDefaultBadgeName);
expect(element(By.id('alt-badge-name')).getAttribute('value')).toEqual(expectedAltBadgeName);
expect(checkedOption.getAttribute('label')).toBe('Prefer Different Badges (Beta)');
});
示例2: describe
describe('The welcome page', function () {
const pageBody = element(By.tagName('body'));
const enterButton = element(By.className("enter-button"));
const googleButton = element(By.className("google-login"));
const microsoftButton = element(By.className("ms-login"));
async function waitToArriveAt(expectedHost: string) {
await browser.wait(async () => {
try {
const url = await browser.getCurrentUrl();
return url.startsWith(expectedHost);
} catch (e) {
console.log(e);
return false
}
}, 5000);
browser.getCurrentUrl().then(function (url) {
expect(url.startsWith(expectedHost)).toBe(true, `url was ${url}`);
});
}
it('has an enter button redirects to google login', async function () {
browser.get(hostName + '/welcome');
pageBody.allowAnimations(false);
enterButton.click();
googleButton.click();
browser.waitForAngularEnabled(false);
let expectedHost = 'https://accounts.google.com';
await waitToArriveAt(expectedHost);
});
it('has an enter button redirects to ms login', async function () {
browser.get(hostName + '/welcome');
pageBody.allowAnimations(false);
enterButton.click();
microsoftButton.click();
browser.waitForAngularEnabled(false);
let expectedHostThatAllowsMultiTenantAuth = 'https://login.microsoftonline.com';
await waitToArriveAt(expectedHostThatAllowsMultiTenantAuth);
});
afterEach(function () {
browser.waitForAngularEnabled(true);
});
e2eHelp.deleteAnyBrowserLogging();
});
示例3: it
it('sanitizes innerHTML', () => {
let interpolated = element(By.className('e2e-inner-html-interpolated'));
expect(interpolated.getText())
.toContain('Template <script>alert("0wned")</script> <b>Syntax</b>');
let bound = element(By.className('e2e-inner-html-bound'));
expect(bound.getText()).toContain('Template alert("0wned") Syntax');
let bold = element(By.css('.e2e-inner-html-bound b'));
expect(bold.getText()).toContain('Syntax');
});
示例4: function
await pairElements.each(async function (elementFinder) {
const callSign = elementFinder.element(By.className('call-sign'));
expect(await callSign.isDisplayed()).toBe(true);
const callSignText = await callSign.getText();
expect(callSignText.split(' ').length).toBe(2);
});
示例5: it
it('will let you edit an existing player', function () {
browser.setLocation(`/${tribe.id}/pairAssignments/current/`);
element.all(By.repeater('player in players'))
.first().element(By.className("player-card-header"))
.click();
expect(browser.getCurrentUrl()).toEqual(`${hostName}/${tribe.id}/player/${player1._id}/`);
});
示例6: describe
describe('The statistics page', function () {
const tribe = {
id: 'delete_me',
name: 'Funkytown'
};
const players = [
{_id: monk.id(), tribe: tribe.id},
{_id: monk.id(), tribe: tribe.id},
{_id: monk.id(), tribe: tribe.id},
{_id: monk.id(), tribe: tribe.id},
{_id: monk.id(), tribe: tribe.id},
{_id: monk.id(), tribe: tribe.id},
];
const tribeCardHeaderElement = element(By.className("tribe-card-header"));
beforeAll(function (done) {
browser.get(hostName + '/test-login?username=' + e2eHelp.userEmail + '&password="pw"');
tribeCollection.remove({id: tribe.id})
.then(() => tribeCollection.insert(tribe))
.then(() => playerCollection.remove({tribe: tribe.id}))
.then(() => playerCollection.insert(players))
.then(() => e2eHelp.authorizeUserForTribes([tribe.id]))
.then(done, done.fail);
});
beforeAll(function () {
browser.setLocation('/' + tribe.id + '/statistics/');
});
it('has a route which works', function () {
const statisticsElement = element(By.css('statistics'));
expect(statisticsElement.isPresent()).toBe(true);
});
it('has a tribe card with matching tribe', function () {
expect(tribeCardHeaderElement.getText()).toBe('Funkytown');
});
it('has the number of spins until full rotation', function () {
const rotationNumberElement = element(By.css('.rotation-number'));
expect(rotationNumberElement.getText()).toBe('5');
});
it('has the pair reports', function () {
const pairReports = element.all(By.css('[ng-repeat="report in self.statistics.pairReports"]'));
expect(pairReports.count()).toBe(15);
});
});