当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript By.className方法代码示例

本文整理汇总了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)');
        });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:35,代码来源:edit-tribe.e2e.ts

示例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();
});
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:58,代码来源:welcome.e2e.ts

示例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');
 });
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:9,代码来源:app.e2e-spec.ts

示例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);
                });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:7,代码来源:pair-assignments.e2e.ts

示例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}/`);
    });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:8,代码来源:pair-assignments.e2e.ts

示例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);
    });

});
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:53,代码来源:statistics.e2e.ts


注:本文中的protractor.By.className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。