com.onevizion.uitest.api.helper.entity.EntityClientFile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ui-test-api Show documentation
Show all versions of ui-test-api Show documentation
An API for easily write tests for OneVizion platform
The newest version!
package com.onevizion.uitest.api.helper.entity;
import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.onevizion.uitest.api.AbstractSeleniumCore;
import com.onevizion.uitest.api.SeleniumSettings;
import com.onevizion.uitest.api.helper.AssertElement;
import com.onevizion.uitest.api.helper.Grid;
import com.onevizion.uitest.api.helper.Js;
import com.onevizion.uitest.api.helper.Window;
import com.onevizion.uitest.api.helper.form.Form;
import com.onevizion.uitest.api.helper.grid.Grid2;
import com.onevizion.uitest.api.helper.html.input.file.HtmlInputFile;
import com.onevizion.uitest.api.vo.entity.ClientFile;
@Component
public class EntityClientFile {
@Autowired
private Window window;
@Autowired
private Js js;
@Autowired
private AssertElement assertElement;
@Autowired
private Grid grid;
@Autowired
private Form form;
@Autowired
private Grid2 grid2;
@Autowired
private SeleniumSettings seleniumSettings;
@Autowired
private HtmlInputFile htmlInputFile;
public void add(ClientFile clientFile) {
form.openAddWithoutTabs();
new Select(seleniumSettings.getWebDriver().findElement(By.name("clientFileGroupId"))).selectByVisibleText(clientFile.getFileGroup());
htmlInputFile.uploadOnAdminClientFile(clientFile.getFileName());
window.closeModal(By.id(AbstractSeleniumCore.BUTTON_OK_ID_BASE));
grid2.waitLoad();
}
public void edit(ClientFile clientFile) {
form.openEditWithoutTabs();
assertElement.assertSelect("clientFileGroupId", clientFile.getFileGroup());
htmlInputFile.uploadOnAdminClientFile(clientFile.getFileName());
window.closeModal(By.id(AbstractSeleniumCore.BUTTON_OK_ID_BASE));
grid2.waitLoad();
}
public void testOnForm(ClientFile clientFile) {
form.openEditWithoutTabs();
assertElement.assertSelect("clientFileGroupId", clientFile.getFileGroup());
assertElement.assertText("txtFileUploader", clientFile.getFileName());
window.closeModal(By.id(AbstractSeleniumCore.BUTTON_CANCEL_ID_BASE));
}
public void testInGrid(Long gridId, int rowIndex, ClientFile clientFile) {
Map gridVals = new HashMap<>();
gridVals.put(js.getColumnIndexByLabel(gridId, "File Group"), clientFile.getFileGroup());
gridVals.put(js.getColumnIndexByLabel(gridId, "File Name"), clientFile.getFileName());
//TODO Size (Kb)
//TODO Preview
grid.checkGridRowByRowIndexAndColIndex(gridId, rowIndex, gridVals);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy