-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathWordPressHelper.js
More file actions
53 lines (51 loc) · 2.04 KB
/
WordPressHelper.js
File metadata and controls
53 lines (51 loc) · 2.04 KB
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
/* globals YoastACFAnalysisConfig */
module.exports = {
url: function() {
return this.api.launchUrl + '/wp/wp-login.php';
},
elements: {
user: '#user_login',
password: '#user_pass',
submitButton: '#wp-submit'
},
commands: [
{
login: function(){
this.navigate();
return this.fillLogin().submit();
},
fillLogin: function(){
this.waitForElementVisible('@user', 5000);
this.setValue('@user', []);
this.setValue('@user', [this.api.globals.user]);
this.api.pause(100);
this.waitForElementVisible('@password', 5000);
return this.setValue('@password', this.api.globals.password);
},
submit: function() {
this.waitForElementVisible('@submitButton', 5000);
//this.api.saveScreenshot('screenshots/login-' + (new Date()).getTime() + '.png');
this.click('@submitButton');
return this.waitForElementVisible('#adminmenu #menu-dashboard .current', 15000);
},
newPost: function(cpt){
if(cpt !== undefined){
cpt = '?post_type=' + cpt;
}
cpt = cpt || '';
this.api.url( this.api.launchUrl + '/wp/wp-admin/post-new.php' + cpt );
this.waitForElementVisible('body.post-new-php', 15000);
return this.api.execute(function() {
YoastACFAnalysisConfig.refreshRate=10;
}, [] );
},
openMediaLibraryTab: function(){
this.api.useXpath();
var mediaLibraryTabSelector = "//div[contains(@class, 'media-modal')]//a[contains(@class, 'media-menu-item') and text()='Media Library']";
this.waitForElementVisible(mediaLibraryTabSelector, 10000);
this.click(mediaLibraryTabSelector);
this.api.useCss();
}
}
]
};