How to use the selenium-webdriver/testing.describe 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 Automattic / wp-e2e-tests / specs-ios / wp-ios-post-editor.js View on Github external
test.describe( 'Public Posts:', function() {
		test.before( 'Restart app', function() {
			return driverManager.resetApp();
		} );

		test.describe( 'Publish a Public Post', function() {
			const blogPostTitle = dataHelper.randomPhrase();
			const blogPostQuote = 'The foolish man seeks happiness in the distance. The wise grows it under his feet.\n— James Oppenheim';
			const blogTag = 'tag-' + new Date().getTime();

			test.it( 'Can log in and open post editor', function() {
				let loginFlow = new LoginFlow( driver );
				return loginFlow.loginAndStartNewPost();
			} );

			test.it( 'Can fill out title', function() {
				this.editorPage = new EditorPage( driver );
				return this.editorPage.enterTitle( blogPostTitle );
			} );

			test.xit( 'Can fill out body', function() { // Temporarily not adding a body to the post pending further troubleshooting
				return this.editorPage.enterContent( blogPostQuote );
github usdot-its-jpo-data-portal / datahub-ui / test / firefoxTests.js View on Github external
}

// Use webdriverjs to create a Selenium Client
var browserIdx = 0;
beforeEach(function () {
    this.timeout(30000);
    browser = new webdriver.Builder().usingServer().withCapabilities({ 'browserName': 'firefox' }).build()
    browser.manage().window().maximize();
    return browser.get(urlTest);
});

afterEach(function () {
    return browser.quit();
});

test.describe("Firefox Test Suite", function () {
    this.timeout(mochaTimeout);
    test.describe("Page Load Components", function () {
        test.it("Title Loaded", function () {
            browser.wait(until.elementLocated(webdriver.By.className('searchHeaderText')));

            browser.findElement(webdriver.By.className('searchHeaderText')).getText().then(function (text) {
                expect(text).to.deep.equal("EXPLORE OUR DATA - Beta Version");
            });
        });
        test.it("Contact Email Loaded", function () {
            browser.wait(until.elementLocated(webdriver.By.id('contactEmail')));

            browser.findElement(webdriver.By.id('contactEmail')).getText().then(function (text) {
                expect(text).to.deep.equal("data.itsjpo@dot.gov");
            });
        });
github woocommerce / woocommerce / tests / e2e-tests / checkout-page.js View on Github external
baseUrl: config.get( 'url' ),
	username: config.get( 'users.admin.username' ),
	password: config.get( 'users.admin.password' )
};

const assertOrderItem = ( orderReview, itemName, attrs ) => {
	assert.eventually.ok(
		orderReview.hasItem( itemName, attrs ),
		`Could not find order item "${ itemName }" with qty ${ attrs.qty } and total ${ attrs.total }`
	);
};

let manager;
let driver;

test.describe( 'Checkout Page', function() {
	// open browser
	test.before( function() {
		this.timeout( config.get( 'startBrowserTimeoutMs' ) );

		manager = new WebDriverManager( 'chrome', { baseUrl: config.get( 'url' ) } );
		driver = manager.getDriver();

		helper.clearCookiesAndDeleteLocalStorage( driver );

		const storeOwner = new StoreOwnerFlow( driver, storeOwnerFlowArgs );

		// General settings for this test.
		storeOwner.setGeneralSettings( {
			baseLocation: [ 'United States', 'United States (US) — California' ],
			sellingLocation: 'Sell to all countries',
			enableTaxes: true,
github Automattic / wp-e2e-tests / specs-jetpack-calypso / wp-jetpack-post-editor-spec.js View on Github external
this.editorPage.titleShown().then( ( titleShown ) => {
						assert.equal( titleShown, originalBlogPostTitle, 'The blog post title shown was unexpected' );
					} );
				} );

				test.it( 'Can set the new title and save it', function() {
					this.editorPage.enterTitle( updatedBlogPostTitle );
					this.editorPage.errorDisplayed().then( ( errorShown ) => {
						assert.equal( errorShown, false, 'There is an error shown on the editor page!' );
					} );
					this.postEditorToolbarComponent = new PostEditorToolbarComponent( driver );
					this.postEditorToolbarComponent.ensureSaved();
					this.postEditorToolbarComponent.publishAndViewContent( { reloadPageTwice: true } );
				} );

				test.describe( 'Can view the post with the new title', function() {
					test.it( 'Can view the post', function() {
						return this.viewPostPage = new ViewPostPage( driver );
					} );

					test.it( 'Can see correct post title', function() {
						this.viewPostPage.postTitle().then( function( postTitle ) {
							assert.equal( postTitle.toLowerCase(), updatedBlogPostTitle.toLowerCase(), 'The published blog post title is not correct' );
						} );
					} );
				} );
			} );
		} );
github Automattic / wp-e2e-tests / specs-jetpack-calypso / wp-jetpack-post-editor-spec.js View on Github external
} );
							} );
						} );
					} );
				} );
			} );
		} );

		test.after( function() {
			if ( fileDetails ) {
				mediaHelper.deleteFile( fileDetails ).then( function() {} );
			}
		} );
	} );

	test.describe( 'Private Posts: @parallel', function() {
		test.before( function() {
			driverManager.clearCookiesAndDeleteLocalStorage( driver );
		} );

		test.describe( 'Publish a Private Post', function() {
			const blogPostTitle = dataHelper.randomPhrase();
			const blogPostQuote = 'If you’re not prepared to be wrong; you’ll never come up with anything original.\n— Sir Ken Robinson\n';

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

			test.it( 'Can start a new post and enter post title and content', function() {
				this.editorPage = new EditorPage( driver );
				this.editorPage.enterTitle( blogPostTitle );
github Automattic / wp-e2e-tests / specs-jetpack-calypso / wp-jetpack-post-editor-spec.js View on Github external
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!' );
					} );
				} );

				test.describe( 'Categories and Tags', function() {
					test.it( 'Expand Categories and Tags', function() {
						let postEditorSidebarComponent = new PostEditorSidebarComponent( driver );
						postEditorSidebarComponent.expandCategoriesAndTags();
					} );

					test.it( 'Can add a new category', function() {
						let postEditorSidebarComponent = new PostEditorSidebarComponent( driver );
						let postEditorToolbarComponent = new PostEditorToolbarComponent( driver );
						postEditorSidebarComponent.addNewCategory( newCategoryName );
						postEditorSidebarComponent.getCategoriesAndTags().then( function( subtitle ) {
							assert( ! subtitle.match( /Uncategorized/ ), 'Post still marked Uncategorized after adding new category BEFORE SAVE' );
						} );
						postEditorToolbarComponent.ensureSaved();
						postEditorSidebarComponent.getCategoriesAndTags().then( function( subtitle ) {
							assert( ! subtitle.match( /Uncategorized/ ), 'Post still marked Uncategorized after adding new category AFTER SAVE' );
						} );
github Automattic / wp-e2e-tests / specs-ios / wp-ios-log-in-out-spec.js View on Github external
} );

			test.it( 'Can logout from profile page', function() {
				profilePage.disconnectFromWPCom();
			} );

			test.it( 'Can see login page after logging out', function() {
				let loginPage = new LoginPage( driver );
				loginPage.displayed().then( function( displayed ) {
					assert.equal( displayed, true, 'The login page is not displayed after logging out' );
				} );
			} );
		} );
	} );

	test.describe( 'Logging In and Out (.org):', function() {
		test.before( 'Restart app', function() {
			return driverManager.resetApp();
		} );

		test.describe( 'Can Log In', function() {
			test.it( 'Can log in', function() {
				const selfHostedURL = config.get( 'selfHostedURL' );

				let loginFlow = new LoginFlow( driver, 'selfHostedUser', { selfHostedURL: selfHostedURL } );
				loginFlow.login().then( function() {
					assert.equal( 1, 1, 'yes' );
				} );
			} );

			test.it( 'Can see logged in view after logging in', function() {
				let mainPage = new MainPage( driver );
github Automattic / wp-e2e-tests / specs-jetpack-calypso / wp-jetpack-post-editor-spec.js View on Github external
test.describe( 'Can view the post with the new title', function() {
					test.it( 'Can view the post', function() {
						return this.viewPostPage = new ViewPostPage( driver );
					} );

					test.it( 'Can see correct post title', function() {
						this.viewPostPage.postTitle().then( function( postTitle ) {
							assert.equal( postTitle.toLowerCase(), updatedBlogPostTitle.toLowerCase(), 'The published blog post title is not correct' );
						} );
					} );
				} );
			} );
		} );
	} );

	test.describe( 'Insert a contact form: @parallel', function() {
		this.bailSuite( true );

		test.it( 'Delete Cookies and Local Storage', function() {
			driverManager.clearCookiesAndDeleteLocalStorage( driver );
		} );

		test.describe( 'Publish a New Post', function() {
			const originalBlogPostTitle = 'Contact Us: ' + dataHelper.randomPhrase();

			test.it( 'Can log in', function() {
				this.loginFlow = new LoginFlow( driver, 'jetpackUser' );
				return this.loginFlow.loginAndStartNewPost();
			} );

			test.it( 'Can insert the contact form', function() {
				this.editorPage = new EditorPage( driver );
github Automattic / wp-e2e-tests / specs / wp-post-nux-spec.js View on Github external
headingFontName = font.toLowerCase().replace( /\s/g, '' );
						} );
					} );

					test.it( 'Can see the site\'s heading font in preview', function() {
						assert( headingFontName !== '', 'The heading font was not retrieved from the customizer' );
						return this.customizerPage.previewUsesFont( headingFontName ).then( ( fontUsed ) => {
							assert( fontUsed, `The font '${headingFontName}' does not appear to be used in the customizer preview` );
						} );
					} );

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

					test.describe( 'Customize Base Font', function() {
						let baseFontName = '';

						test.it( 'Expand fonts', function() {
							return this.customizerPage.expandFonts();
						} );

						test.it( 'Can set the site\'s base font', function() {
							return this.customizerPage.chooseFirstBaseFont().then( ( font ) => {
								baseFontName = font.toLowerCase().replace( /\s/g, '' );
							} );
						} );

						test.it( 'Can see the site\'s heading font in preview', function() {
							assert( baseFontName !== '', 'The heading font was not retrieved from the customizer' );
							return this.customizerPage.previewUsesFont( baseFontName ).then( ( fontUsed ) => {
								assert( fontUsed, `The font '${baseFontName}' does not appear to be used in the customizer preview` );