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


TypeScript By.id方法代码示例

本文整理汇总了TypeScript中protractor.By.id方法的典型用法代码示例。如果您正苦于以下问题:TypeScript By.id方法的具体用法?TypeScript By.id怎么用?TypeScript By.id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在protractor.By的用法示例。


在下文中一共展示了By.id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('should get error on leaving when name is changed.', async function () {
        await browser.setLocation(`/${tribe.id}/player/${player1._id}`);
        expect(browser.getCurrentUrl()).toBe(`${hostName}/${tribe.id}/player/${player1._id}/`);
        element(By.id('player-name')).clear();
        element(By.id('player-name')).sendKeys('completely different name');
        element(By.css(`.tribe-card img`)).click();
        await browser.wait(() => browser.switchTo().alert().then(() => true, () => false), 5000);

        const alertDialog = await browser.switchTo().alert();
        expect(alertDialog.getText())
            .toEqual('You have unsaved data. Would you like to save before you leave?');
        alertDialog.dismiss();
    });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:13,代码来源:edit-player.e2e.ts

示例2: it

	it('should login', function() {

		//Find page element
		var userNameField = p.browser.element(p.By.name('username'));
		var userPassField = p.browser.element(p.By.name('password'));
		var userLoginBtn = p.browser.element(p.By.id('login-button'));

		//Fill input keys
		userNameField.sendKeys('amishkin')
		userPassField.sendKeys('temp')

		//Ensure fields contain what is entered
		expect(userNameField.getAttribute('value')).to.eventually.equal('amishkin');
		expect(userPassField.getAttribute('value')).to.eventually.equal('temp');

		//Click to sign in
		userLoginBtn.click().then(function() {
			p.browser.waitForAngular();
			expect(p.browser.getCurrentUrl()).to.eventually.equal('http://localhost:3000/home');
		});
	});
开发者ID:ValueChart,项目名称:WebValueCharts,代码行数:21,代码来源:login.test.ts

示例3: it

        it('spinning with two players disabled will only yield one pair and then saving persists the pair', function () {
            const playerElements = element.all(By.repeater('selectable in prepare.selectablePlayers'));
            expect(playerElements.count()).toEqual(5);

            playerElements.get(0).element(By.css('.player-icon')).click();
            playerElements.get(2).element(By.css('.player-icon')).click();
            playerElements.get(3).element(By.css('.player-icon')).click();

            spinButton.click();

            const pairs = element.all(By.repeater('pair in pairAssignments.pairAssignments.pairs'));
            expect(pairs.count()).toEqual(1);
            const players = element.all(By.repeater('player in players'));
            expect(players.count()).toEqual(3);

            const saveButton = element(By.id('save-button'));
            saveButton.click();

            browser.wait(async () => false === await saveButton.isDisplayed(), 2000);

            expect(pairs.count()).toEqual(1);
            expect(players.count()).toEqual(3);
        });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:23,代码来源:prepare-to-spin.e2e.ts

示例4: describe

describe('The edit tribe page', function () {

    const checkedOption = element(By.css('#pairing-rule option:checked'));
    const tribeIdElement = element(By.id('tribe-id'));

    const deleteButton = element(By.className('delete-tribe-button'));

    describe('for an existing tribe', function () {
        const tribe = {
            id: 'delete_me',
            name: 'Change Me'
        };

        beforeAll(function (done) {
            tribeCollection.drop()
                .then(() => tribeCollection.insert(tribe))
                .then(() => authorizeAllTribes())
                .then(done, done.fail);
        });

        afterAll(function (done) {
            tribeCollection.remove({id: tribe.id}, false)
                .then(done, done.fail);
        });

        e2eHelp.afterEachAssertLogsAreEmpty();

        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)');
        });

        it('the tribe can be deleted', 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();

            await expect(browser.getCurrentUrl()).toEqual(hostName + '/' + tribe.id + '/edit/');

            await expect(deleteButton.isDisplayed()).toBe(true);
            await expect(deleteButton.isEnabled()).toBe(true);

            deleteButton.click();

            await browser.wait(async () => `${hostName}/tribes/` === await browser.getCurrentUrl(), 1000);

            await expect(tribeElements.count()).toBe(0);
        });
    });

    describe('on the new tribe page', function () {

        beforeAll(function () {
            browser.setLocation('/new-tribe/');
        });

        it('the id field shows and does not disappear when text is added', function () {
            tribeIdElement.sendKeys('oopsie');
            expect(tribeIdElement.isDisplayed()).toBe(true);
        });

        it('will default the pairing rule to Longest Time', function () {
            expect(checkedOption.getAttribute('label')).toBe('Prefer Longest Time');
        });
    });

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

示例5: it

 it('will let you prepare new pairs', function () {
     browser.setLocation('/' + tribe.id + '/pairAssignments/current/');
     element(By.id('new-pairs-button')).click();
     expect(browser.getCurrentUrl()).toEqual(`${hostName}/${tribe.id}/prepare/`);
 });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:5,代码来源:pair-assignments.e2e.ts

示例6: function

 getNewTribeButton: function () {
     return element(By.id('new-tribe-button'));
 }
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:3,代码来源:tribes.e2e.ts

示例7: element

 await browser.wait(() => element(By.id('history-view')).isPresent(), 2000)
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:1,代码来源:history.e2e.ts


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