@cuppet/core 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
1
  const { setWorldConstructor, setDefaultTimeout } = require('@cucumber/cucumber');
2
+ const config = require('config');
3
+ const commonFields = require('./commonComponents/commonFields');
4
+ const strings = require('./multilingualStrings/multilingualStrings');
2
5
 
3
6
  setDefaultTimeout(120 * 1000);
4
7
 
@@ -6,10 +9,17 @@ setDefaultTimeout(120 * 1000);
6
9
  class World {
7
10
  constructor({ attach }) {
8
11
  this.attach = attach;
12
+ this.commonFields = commonFields;
13
+ this.enableMlSupport();
9
14
  }
10
15
 
11
- fixSonar() {
12
- console.log('Sample function to fix empty class.');
16
+ enableMlSupport() {
17
+ const lang = config.has('language') ? config.get('language') : null;
18
+ if (lang) {
19
+ this.mlStrings = strings.multilingualStrings(lang) ?? {};
20
+ } else {
21
+ this.mlStrings = {};
22
+ }
13
23
  }
14
24
  }
15
25
  setWorldConstructor(World);
@@ -0,0 +1,17 @@
1
+ Feature: Open DEMO QA (as base site) and use the elements section
2
+
3
+ Scenario: Go to demo qa page and open the elements section
4
+ Given I go to "/"
5
+ And I should see "Elements" in "Cards" region
6
+ Then I click on the text "Elements" in the "Cards" region
7
+ And I wait for the text "Please select an item from left" to appear within "5" seconds
8
+ Then I click on the element "TextBox"
9
+ And I wait for "0.5" seconds
10
+ And I fill in "#userName" with "Example Name"
11
+ And I fill in "#userEmail" with "example@example.com"
12
+ And I fill in "#currentAddress" with "Example text in text area"
13
+ Then I click on the element "#submit"
14
+ And I wait for element with "#output" selector to appear within "2" seconds
15
+ And I should see the element with selector "#name"
16
+ And I should see the element with selector "#email"
17
+ And I should see the element with selector "p#currentAddress"
package/index.js CHANGED
@@ -1,43 +1,43 @@
1
- // Core Cuppet Framework Components
2
- // This package provides the core testing framework functionality
3
-
4
- // Export main function modules
5
- const elementInteraction = require('./src/elementInteraction');
6
- const dataStorage = require('./src/dataStorage');
7
- const mainFunctions = require('./src/mainFunctions');
8
- const helperFunctions = require('./src/helperFunctions');
9
- const apiFunctions = require('./src/apiFunctions');
10
- const appiumTesting = require('./src/appiumTesting');
11
- const accessibilityTesting = require('./src/accessibilityTesting');
12
- const lighthouse = require('./src/lighthouse');
13
- const visualRegression = require('./src/visualRegression');
14
-
15
- // Export managers
16
- const BrowserManager = require('./features/app/browserManager');
17
- const AppiumManager = require('./features/app/appiumManager');
18
-
19
- // Export step definitions
20
- const stepDefinitions = require('./stepDefinitions');
21
-
22
- module.exports = {
23
- // Core functions
24
- elementInteraction,
25
- dataStorage,
26
- mainFunctions,
27
- helperFunctions,
28
- apiFunctions,
29
- appiumTesting,
30
- accessibilityTesting,
31
- lighthouse,
32
- visualRegression,
33
-
34
- // Managers
35
- BrowserManager,
36
- AppiumManager,
37
-
38
- // Step definitions
39
- stepDefinitions,
40
-
41
- // Version info
42
- version: require('./package.json').version
43
- };
1
+ // Core Cuppet Framework Components
2
+ // This package provides the core testing framework functionality
3
+
4
+ // Export main function modules
5
+ const elementInteraction = require('./src/elementInteraction');
6
+ const dataStorage = require('./src/dataStorage');
7
+ const mainFunctions = require('./src/mainFunctions');
8
+ const helperFunctions = require('./src/helperFunctions');
9
+ const apiFunctions = require('./src/apiFunctions');
10
+ const appiumTesting = require('./src/appiumTesting');
11
+ const accessibilityTesting = require('./src/accessibilityTesting');
12
+ const lighthouse = require('./src/lighthouse');
13
+ const visualRegression = require('./src/visualRegression');
14
+
15
+ // Export managers
16
+ const BrowserManager = require('./features/app/browserManager');
17
+ const AppiumManager = require('./features/app/appiumManager');
18
+
19
+ // Export step definitions
20
+ const stepDefinitions = require('./stepDefinitions');
21
+
22
+ module.exports = {
23
+ // Core functions
24
+ elementInteraction,
25
+ dataStorage,
26
+ mainFunctions,
27
+ helperFunctions,
28
+ apiFunctions,
29
+ appiumTesting,
30
+ accessibilityTesting,
31
+ lighthouse,
32
+ visualRegression,
33
+
34
+ // Managers
35
+ BrowserManager,
36
+ AppiumManager,
37
+
38
+ // Step definitions
39
+ stepDefinitions,
40
+
41
+ // Version info
42
+ version: require('./package.json').version,
43
+ };
package/package.json CHANGED
@@ -1,57 +1,72 @@
1
- {
2
- "name": "@cuppet/core",
3
- "version": "1.0.0",
4
- "description": "Core testing framework components for Cuppet - BDD framework based on Cucumber and Puppeteer",
5
- "main": "index.js",
6
- "files": [
7
- "src/",
8
- "features/",
9
- "index.js",
10
- "stepDefinitions.js"
11
- ],
12
- "keywords": [
13
- "testing",
14
- "bdd",
15
- "cucumber",
16
- "puppeteer",
17
- "appium",
18
- "automation",
19
- "e2e"
20
- ],
21
- "author": "Miroslav Rusev",
22
- "license": "ISC",
23
- "peerDependencies": {
24
- "@cucumber/cucumber": "^11.0.0",
25
- "puppeteer": "^24.0.1",
26
- "config": "^3.3.9"
27
- },
28
- "dependencies": {
29
- "@supercharge/strings": "^2.0.0",
30
- "axios": "^1.8.2",
31
- "backstopjs": "^6.3.23",
32
- "chai": "^4.3.7",
33
- "lighthouse": "^12.1.0",
34
- "mime": "^3.0.0",
35
- "moment": "^2.30.1",
36
- "pa11y": "^8.0.0",
37
- "pa11y-reporter-html": "^2.0.0",
38
- "xml2js": "^0.6.2"
39
- },
40
- "devDependencies": {
41
- "@wdio/globals": "^9.14.0",
42
- "appium": "^2.18.0",
43
- "appium-uiautomator2-driver": "^4.2.3",
44
- "webdriverio": "9.12.7"
45
- },
46
- "scripts": {
47
- "test": "echo \"Error: no test specified\" && exit 1"
48
- },
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/MiroslavRusev/cuppet-core.git"
52
- },
53
- "bugs": {
54
- "url": "https://github.com/MiroslavRusev/cuppet-core/issues"
55
- },
56
- "homepage": "https://github.com/MiroslavRusev/cuppet-core#readme"
57
- }
1
+ {
2
+ "name": "@cuppet/core",
3
+ "version": "1.0.2",
4
+ "description": "Core testing framework components for Cuppet - BDD framework based on Cucumber and Puppeteer",
5
+ "main": "index.js",
6
+ "files": [
7
+ "src/",
8
+ "features/",
9
+ "index.js",
10
+ "stepDefinitions.js"
11
+ ],
12
+ "keywords": [
13
+ "testing",
14
+ "bdd",
15
+ "cucumber",
16
+ "puppeteer",
17
+ "appium",
18
+ "automation",
19
+ "e2e"
20
+ ],
21
+ "author": "Miroslav Rusev",
22
+ "license": "ISC",
23
+ "peerDependencies": {
24
+ "@cucumber/cucumber": "^11.0.0",
25
+ "config": "^3.3.9",
26
+ "puppeteer": "^24.0.1"
27
+ },
28
+ "dependencies": {
29
+ "@supercharge/strings": "^2.0.0",
30
+ "axios": "^1.8.2",
31
+ "backstopjs": "^6.3.23",
32
+ "chai": "^4.3.7",
33
+ "lighthouse": "^12.1.0",
34
+ "mime": "^3.0.0",
35
+ "moment": "^2.30.1",
36
+ "pa11y": "^8.0.0",
37
+ "pa11y-reporter-html": "^2.0.0",
38
+ "xml2js": "^0.6.2"
39
+ },
40
+ "devDependencies": {
41
+ "@cucumber/cucumber": "^11.0.0",
42
+ "@semantic-release/changelog": "^6.0.3",
43
+ "@semantic-release/git": "^10.0.1",
44
+ "@semantic-release/github": "^11.0.3",
45
+ "@semantic-release/npm": "^12.0.1",
46
+ "@wdio/globals": "^9.14.0",
47
+ "appium": "^2.18.0",
48
+ "appium-uiautomator2-driver": "^4.2.3",
49
+ "config": "^3.3.9",
50
+ "eslint": "^9.29.0",
51
+ "eslint-config-prettier": "^10.1.5",
52
+ "eslint-plugin-prettier": "^5.5.1",
53
+ "prettier": "^3.6.1",
54
+ "puppeteer": "^24.0.1",
55
+ "semantic-release": "^24.2.5",
56
+ "webdriverio": "9.12.7"
57
+ },
58
+ "scripts": {
59
+ "test": "cucumber-js features/tests",
60
+ "postinstall": "sh postinstall.sh",
61
+ "lint": "eslint .",
62
+ "format": "prettier --write ."
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git+https://github.com/MiroslavRusev/cuppet-core.git"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/MiroslavRusev/cuppet-core/issues"
70
+ },
71
+ "homepage": "https://github.com/MiroslavRusev/cuppet-core#readme"
72
+ }
@@ -1,44 +1,44 @@
1
- /**
2
- * @module accessibilityTesting
3
- * @typedef {import('puppeteer').Page} Page
4
- * @typedef {import('puppeteer').Browser} Browser
5
- */
6
- const config = require('config');
7
- const storage = require('./dataStorage');
8
- const helper = require('./helperFunctions');
9
- const pa11y = require('pa11y');
10
- const htmlReporter = require('pa11y-reporter-html');
11
-
12
- module.exports = {
13
- /**
14
- * Method to validate if certain path meets the criteria from the config.
15
- * Please use the config json files to set options.
16
- * You can find more info at - https://github.com/pa11y/pa11y#configuration
17
- * @param {Browser} browser - puppeteer browser object
18
- * @param {Page} page - puppeteer page object
19
- * @param scenarioName - the current scenario name
20
- * @param path - the path of the page which accessibility will be tested
21
- * @throws Error
22
- * @returns {Promise<void>}
23
- */
24
- validatePageAccessibility: async function (browser, page, scenarioName, path) {
25
- const pa11yConfig = config.get('pa11yConfig');
26
- const configOptions = {
27
- ...pa11yConfig,
28
- browser: browser,
29
- page: page,
30
- };
31
- if (!path.startsWith('http')) {
32
- throw new Error('Only absolute paths are allowed!');
33
- }
34
-
35
- const results = await pa11y(path, configOptions);
36
- const fileName = await helper.prepareFileNameFromUrl(path);
37
- // make the URL ready for filepath usage
38
- if (results.issues) {
39
- const html = await htmlReporter.results(results);
40
- await storage.createHtmlReport('Pa11y-' + scenarioName.slice(0, -1) + fileName, html);
41
- throw new Error(`${path} page has accessibility issues. HTML report has been generated!`);
42
- }
43
- },
44
- };
1
+ /**
2
+ * @module accessibilityTesting
3
+ * @typedef {import('puppeteer').Page} Page
4
+ * @typedef {import('puppeteer').Browser} Browser
5
+ */
6
+ const config = require('config');
7
+ const storage = require('./dataStorage');
8
+ const helper = require('./helperFunctions');
9
+ const pa11y = require('pa11y');
10
+ const htmlReporter = require('pa11y-reporter-html');
11
+
12
+ module.exports = {
13
+ /**
14
+ * Method to validate if certain path meets the criteria from the config.
15
+ * Please use the config json files to set options.
16
+ * You can find more info at - https://github.com/pa11y/pa11y#configuration
17
+ * @param {Browser} browser - puppeteer browser object
18
+ * @param {Page} page - puppeteer page object
19
+ * @param scenarioName - the current scenario name
20
+ * @param path - the path of the page which accessibility will be tested
21
+ * @throws Error
22
+ * @returns {Promise<void>}
23
+ */
24
+ validatePageAccessibility: async function (browser, page, scenarioName, path) {
25
+ const pa11yConfig = config.get('pa11yConfig');
26
+ const configOptions = {
27
+ ...pa11yConfig,
28
+ browser: browser,
29
+ page: page,
30
+ };
31
+ if (!path.startsWith('http')) {
32
+ throw new Error('Only absolute paths are allowed!');
33
+ }
34
+
35
+ const results = await pa11y(path, configOptions);
36
+ const fileName = await helper.prepareFileNameFromUrl(path);
37
+ // make the URL ready for filepath usage
38
+ if (results.issues) {
39
+ const html = await htmlReporter.results(results);
40
+ await storage.createHtmlReport('Pa11y-' + scenarioName.slice(0, -1) + fileName, html);
41
+ throw new Error(`${path} page has accessibility issues. HTML report has been generated!`);
42
+ }
43
+ },
44
+ };