-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsteps_file.js
79 lines (68 loc) · 2.8 KB
/
steps_file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// in this file you can append custom step methods to 'I' object
var Factory = require('rosie');
var faker = require('faker');
const path = require('path');
const slugify = require('slugify');
const fs = require('fs');
var read_data;
var pluginslug;
var mypath = '/Users/wedevs/Desktop/Automation/appsero_automation/core-tests/e2e/pro_plugin/test.txt';
//var pname = require('./core-tests/e2e/pro_plugin/initial_test');
module.exports = function() {
return actor({
getfakepass() {
return data = {
oldpass: faker.internet.password(),
nwpass: faker.internet.password(),
old2pass: nwpass,
}
},
Selectplugin: function() {
this.amOnPage('/plugins');
read_data = fs.readFileSync(mypath, 'utf8');
pluginslug = slugify(read_data, {
replacement: '-',
lower: true,
});
this.amOnPage(`/plugins/${pluginslug}/get-started`);
},
checkError: function() {
this.dontSee('Unknown error occurred.');
this.dontSee('Warning');
this.dontSee('Fatal error');
this.dontSee('Notice:');
},
metadataCreate: function() {
this.fillField('Name', faker.name.firstName());
},
metadataPlugin: function() {
let name_data = faker.name.title();
this.fillField('Plugin Name', name_data);
return name_data;
},
metadataVersion: function() {
this.fillField('Plugin Version', faker.random.float({ min: 1.0, max: 2.0 }));
},
metadataPHP: function() {
this.click('//*[@id="php"]/div/div');
this.fillField('//*[@id="php"]/div/div', faker.random.arrayElement(["7.1", "7.2", "7.3", "7.4"]));
},
metadataWordpress: function() {
this.click('//*[@id="requires"]/div/div');
this.fillField('//*[@id="requires"]/div/div', faker.random.arrayElement(["5.1", "5.2", "5.3", "5.4", "5.5", "5.6"]));
},
metadataTested: function() {
this.click('//*[@id="tested"]/div/div');
this.fillField('//*[@id="tested"]/div/div', faker.random.arrayElement(["5.1", "5.2", "5.3", "5.4", "5.5", "5.6"]));
},
valid_email: function() {
this.clearField('//*[@id="app"]//div/span/input');
this.fillField('//*[@id="app"]//div/span/input', faker.internet.email());
},
slug_return: function() {
return faker.random.arrayElement(["Woo funnel", "Astra wp", "Ocean wp", "Avada", "X theme", "Studio press", "Jupiter den"])
},
// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.
});
}