1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.wysiwyg.test.po

File UploadImagePane.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
7
4
1
90
33
4
0.57
1.75
4
1

Classes

Class Line # Actions
UploadImagePane 32 7 0% 4 11
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.wysiwyg.test.po;
21   
22    import org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.openqa.selenium.support.FindBy;
25   
26    /**
27    * Models the image upload wizard step that is accessible when inserting or editing an image with the WYSIWYG editor.
28    *
29    * @version $Id: 6308a0976bf019f54d359245aaaf659f44fc45f9 $
30    * @since 3.2M3
31    */
 
32    public class UploadImagePane extends WizardStepElement
33    {
34    /**
35    * The file input used to specify the path to the image to upload.
36    */
37    @FindBy(name = "filepath")
38    private WebElement fileInput;
39   
40    /**
41    * The button that moves the wizard to the image configuration step.
42    */
43    @FindBy(xpath = "//button[. = 'Image Settings']")
44    private WebElement imageSettingsButton;
45   
46    /**
47    * The insert image button (which skips the image configuration step).
48    */
49    @FindBy(xpath = "//button[. = 'Insert Image']")
50    private WebElement insertImageButton;
51   
 
52  0 toggle @Override
53    public UploadImagePane waitToLoad()
54    {
55  0 super.waitToLoad();
56  0 getDriver().waitUntilElementIsVisible(By.className("xUploadPanel"));
57  0 return this;
58    }
59   
60    /**
61    * Fills the URL with the specified image path.
62    *
63    * @param imagePath the path to the image to upload in URL form
64    */
 
65  0 toggle public void setImageToUpload(String imagePath)
66    {
67  0 fileInput.sendKeys(imagePath);
68    }
69   
70    /**
71    * Clicks on the "Image Settings" button, waits for the image to be uploaded and then for the image configuration
72    * pane to be loaded.
73    *
74    * @return the pane used to configure the uploaded image before inserting it into the content
75    */
 
76  0 toggle public ImageConfigPane configureImage()
77    {
78  0 imageSettingsButton.click();
79  0 return new ImageConfigPane().waitToLoad();
80    }
81   
82    /**
83    * Clicks on the "Insert Image" button, waits for the image to be uploaded and then for the image wizard to close.
84    */
 
85  0 toggle public void insertImage()
86    {
87  0 insertImageButton.click();
88    // TODO: Wait for the wizard to close.
89    }
90    }