0.11.0 • Published 4 years ago

wc-e2e-page-objects v0.11.0

Weekly downloads
110
License
GPL-2.0
Repository
github
Last release
4 years ago

wc-e2e-page-objects

npm version build status dependency status

WooCommerce Page Objects to be used on end-to-end tests with Selenium WebDriver.

Install

npm install wc-page-objects

Docs

Usage

Example:

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import test from 'selenium-webdriver/testing';
import { WebDriverManager, WebDriverHelper as helper } from 'wp-e2e-webdriver';
import { ShopPage, CartPage } from 'wc-e2e-page-objects';

chai.use( chaiAsPromised );
const assert = chai.assert;

let manager;
let driver;

test.describe( 'Cart page', function() {
	test.before( 'open browser', function() {
		manager = new WebDriverManager( 'chrome', { baseUrl: 'http://local.wordpress.dev' } );
		driver = manager.getDriver();
		helper.clearCookiesAndDeleteLocalStorage( driver );
	} );

	test.it( 'should displays no item in the cart', () => {
		const cartPage = new CartPage( driver, { url: manager.getPageUrl( '/cart' ) } );
		assert.eventually.equal( cartPage.hasNoItem(), true );
	} );

	test.it( 'should adds the product to the cart when "Add to cart" is clicked', () => {
		const shopPage = new ShopPage( driver, { url: manager.getPageUrl( '/shop' ) } );
		assert.eventually.equal( shopPage.addProductToCart( 'Flying Ninja' ), true );
		assert.eventually.equal( shopPage.addProductToCart( 'Happy Ninja' ), true );

		const cartPage = new CartPage( driver, { url: manager.getPageUrl( '/cart' ) } );
		assert.eventually.equal( cartPage.hasItem( 'Flying Ninja' ), true );
		assert.eventually.equal( cartPage.hasItem( 'Happy Ninja' ), true );
	} );

	test.after( 'quit browser', () => {
		manager.quitBrowser();
	} );
} );
0.11.0

4 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago