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