npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

keyword_driven

v1.0.10

Published

TestCafé Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing.

Downloads

21

Readme

Keyword-Driven Framework using TestCafé (beta)

This is the Keyword-Driven framework plugin for TestCafé.

npm badge

TestCafé Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing.

report-sample

To install this TestCafé Keyword-Driven Framework

  • run the command npm i keyword_driven.

Usage

  • add to the testcafe command-line the following options:
testcafe chrome ./path-to-tests/*(.js)

To execute the solution

   - Ensure that Node.js and npm are installed on your computer and run the following command:.
  • install testcafe (version >=1.4.1):

    • npm i -g testcafe
  • install xlsx (version >= 0.15.1):

    • npm i xlsx
  • Create a keyword-driven.js file at the project root:

import {
	Selector
} from 'testcafe';
import XPath from './ComponentHelper/xpath-selector';

fixture `Getting Started`
	.page `https://devexpress.github.io/testcafe/documentation/getting-started/`;

var XLSX = require('xlsx')
var workbook = XLSX.readFile('./path-to-read/*(.xlsx)');
var sheet_name_list = workbook.SheetNames;
var xlData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet_name_list[0]]);

test('Keyword-Driven', async t => {
	await t.maximizeWindow()
	for (let i = 0; i < xlData.length; i++) {
		let element = xlData[i]
		switch (element.Keyword) {
			case "navigateTo": //t.navigateTo( url )
				await t[element.Keyword](element.Parameter)
				break;
			case "click": //t.click( selector [, options] )
				await t[element.Keyword](XPath(element.LocatorValue))
				break;
			case "typeText": //t.typeText( selector, text [, options] )
				await t[element.Keyword](XPath(element.LocatorValue), element.Parameter)
				break;
			case "select": //.click(Selector('a').withText('Glemt passord?'))
				element.Keyword = "click"
				const interfaceSelect = XPath(element.LocatorValue);
				await t[element.Keyword](interfaceSelect)
				await t[element.Keyword](interfaceSelect.find('option').withText(element.Parameter))
				break;
			default:
				return;
		}
		await t.setTestSpeed(0.1)
	}
});
  • Create the following script in the xpath-selector.js file for handling XPath:
import {
	Selector
} from 'testcafe';


const elementByXPath = Selector(xpath => {
	const iterator = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null)
	const items = [];

	let item = iterator.iterateNext();

	while (item) {
		items.push(item);
		item = iterator.iterateNext();
	}

	return items;
});

export default function (xpath) {
	return Selector(elementByXPath(xpath));
}
  • run the command testcafe chrome keyword-driven.js

Error rendering

  • this execution will report for each file reported in the stack trace.
C:\ProcessDrive\TestCafe\Trails\Keyword_Driven>testcafe chrome Keyword-Driven.js
 Running tests in:
 - Chrome 76.0.3809 / Windows 10.0.0

 Getting Started
 × Keyword-Driven

   1) The element that matches the specified selector is not visible.

      Browser: Chrome 76.0.3809 / Windows 10.0.0

         21 |            switch (element.Keyword) {
         22 |                case "navigateTo":
         23 |                    await t[element.Keyword](element.Parameter)
         24 |                    break;
         25 |                case "click":
       > 26 |                    await t[element.Keyword](XPath(element.LocatorValue))
         27 |                    break;
         28 |                case "typeText":
         29 |                    await t[element.Keyword](XPath(element.LocatorValue), element.Parameter)
         30 |                    break;
         31 |                case "select":
                                element.Keyword ="click"
                                const interfaceSelect = XPath(element.LocatorValue);
                                await t [element.Keyword](interfaceSelect)
                                await t [element.Keyword](interfaceSelect.find('option').withText(element.Parameter))

         at <anonymous> (C:\ProcessDrive\TestCafe\Trails\Keyword_Driven\Keyword-Driven.js:26:27)



 1/1 failed (1m 33s)

Screenshot rendering

  • this reporter embeds all screenshots as base 64 images, making the generated json file completely autonomous.

Video rendering

  • this video embeds all actions as .mp4, making the generated .mp4 file completely autonomous.

Logger rendering

  • this logger embeds all information about the execution as a html report, making the generated html file completely autonomous with suite of logs, Screenshots, .mp4.

Mail rendering

  • this making the emailable logger file completely autonomous.

Utility

  • testCafe enables to execute the keyword-Driven solution.
  • xlsx enables to read the excel file with data dynamically from the ./path-to-read/*(.xlsx).
  • xpath-selector.js enables to access the xpath(LocatorValue).
  • log4js used to log messages for a specific test.For more details please refer.

Contributors