froth-webdriverio-framework 2.0.27 → 2.0.29

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,3 +1,4 @@
1
+
1
2
  // This file contains the common methods that are used in the test scripts
2
3
  let scrollToEnd = null;
3
4
  let clickIfVisible = null;
@@ -16,6 +17,9 @@ let randomint = null;
16
17
  let randomalphanum = null;
17
18
  let randomdecimal = null;
18
19
  let randomregex = null;
20
+ let storetext=null;
21
+ let storevalue=null;
22
+ let storeattributevalue=null;
19
23
 
20
24
  if (process.env.LOCATION == 'local') {
21
25
 
@@ -36,6 +40,10 @@ if (process.env.LOCATION == 'local') {
36
40
  randomalphanum = require('./random').RNDALPHANUM;
37
41
  randomdecimal = require('./random').RNDDECIMAL;
38
42
  randomregex = require('./random').RNDREGEX;
43
+ storetext = require('./storeToBuffer').STORETEXT;
44
+ storevalue = require('./storeToBuffer').STOREVALUE;
45
+ storeattributevalue = require('./storeToBuffer').STOREATTRIBUTEVALUE;
46
+
39
47
  } else {
40
48
  scrollToEnd = require('froth-webdriverio-framework/commonMethods/scrollToEnd');
41
49
  clickIfVisible = require('froth-webdriverio-framework/commonMethods/clickIfVisible');
@@ -54,6 +62,9 @@ if (process.env.LOCATION == 'local') {
54
62
  randomalphanum = require('froth-webdriverio-framework/commonMethods/random').RNDALPHANUM;
55
63
  randomdecimal = require('froth-webdriverio-framework/commonMethods/random').RNDDECIMAL;
56
64
  randomregex = require('froth-webdriverio-framework/commonMethods/random').RNDREGEX;
65
+ storetext = require('froth-webdriverio-framework/commonMethods/storeToBuffer').STORETEXT;
66
+ storevalue = require('froth-webdriverio-framework/commonMethods/storeToBuffer').STOREVALUE;
67
+ storeattributevalue = require('froth-webdriverio-framework/commonMethods/storeToBuffer').STOREATTRIBUTEVALUE;
57
68
 
58
69
  }
59
70
  //export the variabels
@@ -74,5 +85,9 @@ module.exports = {
74
85
  randomint,
75
86
  randomalphanum,
76
87
  randomdecimal,
77
- randomregex
88
+ randomregex,
89
+ storetext,
90
+ storevalue,
91
+ storeattributevalue
92
+
78
93
  };
@@ -9,14 +9,16 @@ async function assertText(driver, elementSelector, expectedText) {
9
9
  // Get the actual text from the element
10
10
  // const element = await driver.$(elementSelector);
11
11
  // console.log("actual text is:" + element)
12
- const element = await driver.$(elementSelector)
13
- // const actualText = await element.getText();
14
- await expect(element).toHaveText(expectedText)
12
+ let element = await $(elementSelector)
13
+ const actualText = await element.getText();
14
+ console.log("actual text is:" + status)
15
15
 
16
- //console.log("actual text is:" + actualText)
16
+ let status = await expect(element).toHaveText(expectedText)
17
+
18
+ console.log("actual status text is:" + status)
17
19
 
18
20
  // Compare the actual text with the expected text
19
- if (actualText == expectedText) {
21
+ if (status) {
20
22
  let annotationMessage = `Assertion pass. Actual text: ${actualText}, Expected text: ${expectedText}.`;
21
23
  console.log(`Assertion pass. Actual text: ${actualText}, Expected text: ${expectedText}.`);
22
24
  // await driver.execute(`browserstack_executor: {"action": "annotate", "arguments": {"data":"${annotationMessage}","level": "info"}}`);
@@ -12,6 +12,14 @@ async function RNDINT() {
12
12
  return Math.floor(Math.random() * 100000); // You can choose any large multiplier for bigger ranges
13
13
  }
14
14
 
15
+ async function RNDNUMBER(length) {
16
+ if (length <= 0) return null; // Handle invalid length
17
+
18
+ const min = Math.pow(10, length - 1); // Minimum value for the given length
19
+ const max = Math.pow(10, length) - 1; // Maximum value for the given length
20
+
21
+ return Math.floor(Math.random() * (max - min + 1)) + min; // Generate the random number
22
+ }
15
23
  async function RANDOMTEXT(length) {
16
24
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
17
25
  let result = '';
@@ -0,0 +1,45 @@
1
+ async function STORETEXT(element, buffername) {
2
+
3
+ try {
4
+ let ele = await $(element);
5
+ // Get the actual text from the specified attribute
6
+ const actualText = await ele.getText();
7
+ console.log('Text stored in buffer:', actualText);
8
+ BUFFER.setItem(buffername, actualText);
9
+
10
+ } catch (error) {
11
+ console.log('Excption occured during storing the text into buffer', `${error.message}`);
12
+ console.error(error.message);
13
+ }
14
+ }
15
+
16
+ async function STOREVALUE(element, buffername) {
17
+
18
+ try {
19
+ let ele = await $(element);
20
+ // Get the actual text from the specified attribute
21
+ const actualText = await ele.getValue();
22
+ console.log('Value stored in buffer:', actualText);
23
+ BUFFER.setItem(buffername, actualText);
24
+
25
+ } catch (error) {
26
+ console.log('Excption occured during storing the value into buffer', `${error.message}`);
27
+ console.error(error.message);
28
+ }
29
+ }
30
+
31
+ async function STOREATTRIBUTEVALUE(element, attribute, buffername) {
32
+
33
+ try {
34
+ let ele = await $(element);
35
+ // Get the actual text from the specified attribute
36
+ const actualText = await ele.getAttribute(attribute);
37
+ console.log('Attr value stored in buffer:', actualText);
38
+ BUFFER.setItem(buffername, actualText);
39
+
40
+ } catch (error) {
41
+ console.log('Excption occured during storing the attribute value into buffer', `${error.message}`);
42
+ console.error(error.message);
43
+ }
44
+ }
45
+ module.exports = { STORETEXT, STOREVALUE, STOREATTRIBUTEVALUE };
@@ -0,0 +1,70 @@
1
+
2
+
3
+ const config = {
4
+
5
+ // ====================
6
+ // Capabilities
7
+ // ====================
8
+ capabilities: [{
9
+ maxInstances: 5,
10
+ browserName: 'chrome',
11
+ acceptInsecureCerts: true,
12
+ }],
13
+
14
+ // ====================
15
+ // Test Configurations
16
+ // ====================
17
+ logLevel: 'info', // Set the log level
18
+ bail: 0, // Set to 1 to stop the test suite after the first test failure
19
+ baseUrl: '', // Specify the base URL of your application
20
+ waitforTimeout: 60000, // Set the timeout for all waitFor* commands
21
+ connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
22
+ connectionRetryCount: 3, // Set the number of times to retry the entire spec file
23
+
24
+ // ====================
25
+ // Framework
26
+ // ====================
27
+ framework: 'mocha', // Use the Mocha framework
28
+ reporters: ['spec'], // Use the spec reporter
29
+ // reporterOptions: {
30
+ // allure: {
31
+ // outputDir: 'allure-results',
32
+ // disableWebdriverStepsReporting: true,
33
+ // disableWebdriverScreenshotsReporting: false,
34
+ // }
35
+ //},
36
+ // ====================
37
+ // Hooks
38
+ // ====================
39
+ before: function (capabilities, specs) {
40
+ // Code to run before the first test
41
+ const currentDate = new Date();
42
+ const timestamp = currentDate.toISOString().replace(/[:.]/g, '');
43
+ browser.saveScreenshot('./screenshot_' + timestamp + '.png');
44
+
45
+ },
46
+ after: function (capabilities, specs) {
47
+ // Code to run to take screenshots
48
+ const currentDate = new Date();
49
+ const timestamp = currentDate.toISOString().replace(/[:.]/g, '');
50
+ browser.saveScreenshot('./screenshot_' + timestamp + '.png');
51
+
52
+
53
+ },
54
+
55
+ // ====================
56
+ // BrowserStack Options
57
+ // ====================
58
+ browserstackOpts: {
59
+ // BrowserStack-specific options
60
+ },
61
+
62
+ // ====================
63
+ // Mocha Options
64
+ // ====================
65
+ mochaOpts: {
66
+ ui: 'bdd', // Set the test interface to BDD
67
+ timeout: 60000, // Set the timeout for test cases in milliseconds
68
+ },
69
+ };
70
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.27",
3
+ "version": "2.0.29",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",