How to use the selenium-webdriver/testing.it function in selenium-webdriver

To help you get started, we’ve selected a few selenium-webdriver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apinf / platform / .test / manageapibackend.js View on Github external
driver.findElement(By.css('#addApiBacklogItemForm button')).click()
            .then(function() {
                driver.sleep(1000);
            });
        // Verify
        var infoElement = driver.findElement(By.css('#addApiBacklogItemForm select + span'));
        infoElement.getText().then(function(text) {
            assert.equal('Priority is required', text);
        });
        // Close modal form
        driver.findElement(By.css('[aria-labelledby="apiBacklogFormModalLabel"] button')).click()
            .then(function() {
                driver.sleep(1000);
            });
    });
    test.it('10.9 should cancel delete api', function() {
        // Navigate to Settings tab
        driver.findElement(By.id('api-settings-tab')).click()
            .then(function() {
                driver.sleep(1000);
            });
        // Click on Delete button
        driver.findElement(By.id('delete-api')).click()
            .then(function() {
                driver.sleep(1000);
            });
        // Cancel deletion
        driver.findElement(By.xpath('//*[text()="Cancel"]')).click()
            .then(function() {
                driver.sleep(1000);
            });
    });
github Automattic / wp-e2e-tests / specs / wp-post-nux-spec.js View on Github external
this.customizerPage.setTagline( newTagline );
					return this.customizerPage.previewTagline().then( ( taglineShown ) => {
						assert.equal( taglineShown.toUpperCase(), newTagline.toUpperCase(), 'The customizer preview tagline shown does not reflect the tagline input' );
					} );
				} );

				test.it( 'Direct Manipulation: clicking the icon on title jumps to site title field', function() {
					this.customizerPage.clickSiteTitleIconInPreview();
					return assert( this.customizerPage.waitForTitleFieldDisplayed(), 'The title field is not displayed' );
				} );

				test.it( 'Close site identity', function() {
					return this.customizerPage.closeOpenSection();
				} );

				test.it( 'Can update and see the site\'s colors', function() {
					this.customizerPage.expandColorsAndBackgrounds();
					this.customizerPage.chooseBackgroundColor();
					return this.customizerPage.previewShowsCustomBackgroundColor().then( ( displayed ) => {
						assert( displayed, 'The customizer preview is not showing the custom background color' );
					} );
				} );

				test.it( 'Close custom colors', function() {
					return this.customizerPage.closeOpenSection();
				} );

				test.describe( 'Customize Heading Font', function() {
					let headingFontName = '';

					test.it( 'Expand fonts', function() {
						return this.customizerPage.expandFonts();
github akahuku / wasavi / src / wd-tests / ex.js View on Github external
yield wasavi.send('1G:%s/[a-f]/\\U&/gc\n', 'nna');
		assert.eq('#1-1', '3 substitutions on 3 lines.', wasavi.getLastMessage());
		assert.value('#1-2',
			'first\n' +
			'seConD\n' +
			'thirD');
		assert.pos('#1-3', 2, 0);

		yield wasavi.send('u');
		assert.value('#2-1',
			'first\n' +
			'second\n' +
			'third');
	});

	it('subst queried last', function* () {
		yield wasavi.send(
			'i' +
			'first\n' +
			'second\n' +
			'third' +
			'\u001b');

		yield wasavi.send('1G:%s/[a-f]/\\U&/gc\n', 'yyl');
		assert.eq('#1-1', '3 substitutions on 3 lines.', wasavi.getLastMessage());
		assert.value('#1-2',
			'First\n' +
			'sECond\n' +
			'third');
		assert.pos('#1-3', 1, 0);

		yield wasavi.send('u');
github akahuku / wasavi / src / wd-tests / ex.js View on Github external
//
		yield wasavi.send(':abbreviate\n');
		assert.eq('#1-1', 'No abbreviations are defined.', wasavi.getLastMessage());

		//
		yield wasavi.send(':abbreviat test\n');
		assert.eq('#2-1', 'No abbreviations are defined.', wasavi.getLastMessage());

		//
		yield wasavi.send(':abbrevia foo? bar\n');
		assert.eq('#3-1',
			'abbreviate: The keyword of abbreviation must end with a word character.', 
			wasavi.getLastMessage());
	});

	it('abbreviate regstering', function* () {
		yield wasavi.send(':abbreviate [clear]\n');

		//
		yield wasavi.send(':abbrevi foo bar\n');
		assert.t('#4-1', wasavi.getLastMessage() == '');
		yield wasavi.send(':abbre\n');
		assert.eq('#4-2', [
			'*** abbreviations ***',
			'        LHS    RHS',
			'        ---    ---',
			'        foo    bar'
		].join('\n'), wasavi.getLastMessage());

		//
		yield wasavi.send(':abbr bar BAZ\n');
		yield wasavi.send(':abb  baz B A Z\n');
github Automattic / wp-e2e-tests / specs-jetpack-calypso / wp-jetpack-post-editor-spec.js View on Github external
test.describe( 'Preview and Publish a Public Post', function() {
			const blogPostTitle = dataHelper.randomPhrase();
			const blogPostQuote = 'There is no way to happiness – happiness is the way.\nThich Nhat Hanh';
			const newCategoryName = 'Category ' + new Date().getTime().toString();
			const newTagName = 'Tag ' + new Date().getTime().toString();
			const publicizeMessage = dataHelper.randomPhrase();
			const publicizeTwitterAccount = config.has( 'publicizeTwitterAccount' ) ? config.get( 'publicizeTwitterAccount' ) : '';

			test.it( 'Can log in as a Jetpack user', function() {
				let loginFlow = new LoginFlow( driver, 'jetpackUser' + host );
				return loginFlow.loginAndStartNewPost();
			} );

			test.describe( 'Create, Preview and Post', function() {
				test.it( 'Can enter post title, content and image', function() {
					let editorPage = new EditorPage( driver );
					editorPage.enterTitle( blogPostTitle );
					editorPage.enterContent( blogPostQuote + '\n' );
					editorPage.enterPostImage( fileDetails );
					editorPage.waitUntilImageInserted( fileDetails );
					editorPage.errorDisplayed().then( ( errorShown ) => {
						assert.equal( errorShown, false, 'There is an error shown on the editor page!' );
					} );
				} );
github akahuku / wasavi / src / wd-tests / ex.js View on Github external
it('nested map', function* () {
		yield wasavi.send(':map [clear]\n');
		yield wasavi.send(':map Q G\n');
		yield wasavi.send(':map q Q\n');
		yield wasavi.send('i1\n2\n3\n4\n5\u001b');

		yield wasavi.send('ggq');
		assert.pos('#1-1', 4, 0);

		yield wasavi.send(':map [noremap] q Q\n');
		yield wasavi.send('ggq');
		assert.pos('#2-1', 0, 0);
	});

	it('edit map unique', function* () {
		yield wasavi.send(':map! [clear]\n');
		yield wasavi.send(':map! Q quick\u0016\u0016 brown\u0016\u0016 fox\n');

		yield wasavi.send('iQ!\u001b');
		assert.value('#1-1', 'quick brown fox!');
	});

	it('map alt', function* () {
		yield wasavi.send(':map [clear]\n');
		yield wasavi.send(':map  G\n');
		yield wasavi.send('i1\n2\n3\n4\n5\u001bgg', Key.chord(Key.ALT, 's'));
		assert.pos('#1-1', 4, 0);
	});

	it('mark2', function* () {
		yield wasavi.send('i1\n2\n3\u001b');
github apinf / platform / .test / registrationtests.js View on Github external
driver.findElement(By.id('at-field-password')).sendKeys('password');
        driver.findElement(By.id('at-btn')).click();
        var helpTextElement = driver.findElement(By.xpath('//*[@id="at-pwd-form"]/fieldset/div[2]/span'));
        helpTextElement.getText().then(function(text) {
           assert.equal(text, 'Required Field');
        });
    });
    test.it('1.6 should show unknown validation error with special character email field', function() {
        CommonUtils.signUp(driver);
        CommonUtils.fillSignUpForm(driver, 'testName', 'abc@testName.com"###"', 'password');
        var errorElement = driver.findElement(By.xpath('/html/body/div[2]/div/div[1]/div/div/div/div[4]/p'));
        errorElement.getText().then(function(text) {
           assert.equal(text, 'Address must be a valid e-mail address');
        });
    });
    test.it('1.7 should show profile user name invalid with special character username field', function() {
        CommonUtils.signUp(driver);
        CommonUtils.fillSignUpForm(driver, 'testName&&&', 'abc@testName.com', 'password');
        var errorElement = driver.findElement(By.xpath('/html/body/div[2]/div/div[1]/div/div/div/div[4]/p'));
        errorElement.getText().then(function(text) {
           assert.equal(text, 'Username failed regular expression validation');
        });
    });
});
github akahuku / wasavi / src / wd-tests / ex.js View on Github external
it('delete zero source', function* () {
		yield wasavi.send('i1\n2\n3\n4\n5\u001b');

		yield wasavi.send(':0,2delete\n');
		assert.value('#1-1', '3\n4\n5');
		assert.pos('#1-2', 0, 0);
		assert.eq('#1-3', '1\n2\n', wasavi.getRegister('"'));

		yield wasavi.send('u');
		assert.value('#2-1', '1\n2\n3\n4\n5');

		yield wasavi.send('\u0012');
		assert.value('#3-1', '3\n4\n5');
	});

	it('delete tail', function* () {
		yield wasavi.send('i1\n2\n3\n4\n5\u001b');

		yield wasavi.send(':4,5delet a\n');
		assert.value('#1-1', '1\n2\n3');
		assert.pos('#1-2', 2, 0);
		assert.eq('#1-3', '4\n5\n', wasavi.getRegister('a'));

		yield wasavi.send('u');
		assert.value('#2-1', '1\n2\n3\n4\n5');

		yield wasavi.send('\u0012');
		assert.value('#3-1', '1\n2\n3');
	});

	it('delete by count', function* () {
		yield wasavi.send('i1\n2\n3\n4\n5\u001b');
github Automattic / wp-e2e-tests / specs / wp-post-nux-spec.js View on Github external
} );

							test.it( 'Can see the new menu listed as primary', function() {
								this.customizerPage.menuDisplayedAsPrimary( newMenuName ).then( ( displayed ) => {
									if ( displayed === false ) {
										slackNotifier.warn( 'Could not see the new menu set in the customizer - trying again now' );
										this.customizerPage.addNewMenuAndSetAsPrimary( newMenuName );
									}
								} );

								return this.customizerPage.menuDisplayedAsPrimary( newMenuName ).then( ( displayed ) => {
									return assert( displayed, `The menu '${ newMenuName }' was not displayed as the primary menu` );
								} );
							} );

							test.it( 'Close menus', function() {
								return this.customizerPage.closeOpenPanel();
							} );

							test.describe( 'Add a new widget', function() {
								const widgetTitle = dataHelper.getWidgetTitle();
								const widgetContent = dataHelper.getWidgetContent();

								test.it( 'Expand widgets', function() {
									return this.customizerPage.expandWidgets();
								} );

								test.it( 'Can add a new sidebar widget as a text widget', function() {
									this.customizerPage.addNewSidebarTextWidget( widgetTitle, widgetContent );
									return this.customizerPage.closeOpenSection();
								} );
github akahuku / wasavi / src / wd-tests / op-shift.js View on Github external
function* _testShiftFirstNonWhiteCharOfLine (a) {
		yield wasavi.send(':set sw=8 noai\n');

		yield wasavi.send('i\tfoobar\u001b');
		yield wasavi.send(`>${a}`);

		assert.eq('#1-1', '\t\tfoobar', wasavi.getValue());
		assert.pos('#1-2', 0, 2);

		yield wasavi.send(`^>${a}`);
		assert.eq('#2-1', '\t\t\tfoobar', wasavi.getValue());
		assert.pos('#2-2', 0, 3);
	}

	it('first non white char of line', function* () {
		promise.consume(_testShiftFirstNonWhiteCharOfLine, null, '^');
	});

	it('home', function* () {
		promise.consume(_testShiftFirstNonWhiteCharOfLine, null, Key.HOME);
	});

	it('top of line', function* () {
		yield wasavi.send(':set sw=8 noai\n');
		yield wasavi.send('i\tfoobar\u001b');
		yield wasavi.send('>0');

		assert.eq('#1-1', '\t\tfoobar', wasavi.getValue());
		assert.pos('#1-2', 0, 2);
	});