當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。