Skip to content
Snippets Groups Projects
Commit e42484ae authored by srosse's avatar srosse
Browse files

no-jira: rewrite add resource for selenium tests

parent 524c0925
No related branches found
No related tags found
No related merge requests found
...@@ -598,6 +598,8 @@ public class UserTest extends Deployments { ...@@ -598,6 +598,8 @@ public class UserTest extends Deployments {
//we are in administration //we are in administration
browser.navigate().back(); browser.navigate().back();
//we are in user management //we are in user management
By userManagementCreateBy = By.cssSelector("ul.o_tools a.o_sel_useradmin_create");
OOGraphene.waitElement(userManagementCreateBy, browser);
browser.navigate().back(); browser.navigate().back();
//we are in "My courses", check //we are in "My courses", check
OOGraphene.waitElement(NavigationPage.myCoursesAssertBy, browser); OOGraphene.waitElement(NavigationPage.myCoursesAssertBy, browser);
......
...@@ -321,7 +321,7 @@ public class CourseEditorPageFragment { ...@@ -321,7 +321,7 @@ public class CourseEditorPageFragment {
* @return Itself * @return Itself
*/ */
public CourseEditorPageFragment selectTabLearnContent() { public CourseEditorPageFragment selectTabLearnContent() {
OOGraphene.selectTab("o_node_config", (b) -> { OOGraphene.selectTab("o_node_config", b -> {
for(By chooseRepoEntriesButton: chooseRepoEntriesButtonList) { for(By chooseRepoEntriesButton: chooseRepoEntriesButtonList) {
List<WebElement> chooseRepoEntry = b.findElements(chooseRepoEntriesButton); List<WebElement> chooseRepoEntry = b.findElements(chooseRepoEntriesButton);
if(!chooseRepoEntry.isEmpty()) { if(!chooseRepoEntry.isEmpty()) {
...@@ -470,24 +470,31 @@ public class CourseEditorPageFragment { ...@@ -470,24 +470,31 @@ public class CourseEditorPageFragment {
private CourseEditorPageFragment createResource(By chooseButton, String resourceTitle, String resourceType) { private CourseEditorPageFragment createResource(By chooseButton, String resourceTitle, String resourceType) {
browser.findElement(chooseButton).click(); browser.findElement(chooseButton).click();
OOGraphene.waitBusy(browser); OOGraphene.waitBusy(browser);
OOGraphene.waitModalDialog(browser);
//popup //popup
WebElement popup = browser.findElement(By.className("o_sel_search_referenceable_entries")); By myResourcesBy = By.cssSelector(".modal-body .o_sel_search_referenceable_entries a.o_sel_repo_popup_my_resources");
popup.findElement(By.cssSelector("a.o_sel_repo_popup_my_resources")).click(); OOGraphene.waitElement(myResourcesBy, browser);
browser.findElement(myResourcesBy).click();
OOGraphene.waitBusy(browser); OOGraphene.waitBusy(browser);
By mySelectedResourcesBy = By.cssSelector(".modal-body .o_sel_search_referenceable_entries a.btn-primary.o_sel_repo_popup_my_resources");
OOGraphene.waitElement(mySelectedResourcesBy, browser);
//click create //click create
List<WebElement> createEls = popup.findElements(By.className("o_sel_repo_popup_create_resource")); By createResourceBy = By.cssSelector(".o_sel_search_referenceable_entries .o_sel_repo_popup_create_resource");
List<WebElement> createEls = browser.findElements(createResourceBy);
if(createEls.isEmpty()) { if(createEls.isEmpty()) {
//open drop down //open drop down
popup.findElement(By.className("o_sel_repo_popup_create_resources")).click(); By createResourcesBy = By.cssSelector("button.o_sel_repo_popup_create_resources");
browser.findElement(createResourcesBy).click();
//choose the right type //choose the right type
By selectType = By.xpath("//ul[contains(@class,'o_sel_repo_popup_create_resources')]//a[contains(@onclick,'" + resourceType + "')]"); By selectType = By.xpath("//ul[contains(@class,'o_sel_repo_popup_create_resources')]//a[contains(@onclick,'" + resourceType + "')]");
popup.findElement(selectType).click(); OOGraphene.waitElement(selectType, browser);
OOGraphene.waitBusy(browser); browser.findElement(selectType).click();
} else { } else {
popup.findElement(By.className("o_sel_repo_popup_create_resource")).click(); browser.findElement(createResourceBy).click();
OOGraphene.waitBusy(browser);
} }
OOGraphene.waitBusy(browser);
//fill the create form //fill the create form
return fillCreateForm(resourceTitle); return fillCreateForm(resourceTitle);
...@@ -496,6 +503,7 @@ public class CourseEditorPageFragment { ...@@ -496,6 +503,7 @@ public class CourseEditorPageFragment {
private CourseEditorPageFragment fillCreateForm(String displayName) { private CourseEditorPageFragment fillCreateForm(String displayName) {
OOGraphene.waitModalDialog(browser); OOGraphene.waitModalDialog(browser);
By inputBy = By.cssSelector("div.modal.o_sel_author_create_popup div.o_sel_author_displayname input"); By inputBy = By.cssSelector("div.modal.o_sel_author_create_popup div.o_sel_author_displayname input");
OOGraphene.waitElement(inputBy, browser);
browser.findElement(inputBy).sendKeys(displayName); browser.findElement(inputBy).sendKeys(displayName);
By submitBy = By.cssSelector("div.modal.o_sel_author_create_popup .o_sel_author_create_submit"); By submitBy = By.cssSelector("div.modal.o_sel_author_create_popup .o_sel_author_create_submit");
browser.findElement(submitBy).click(); browser.findElement(submitBy).click();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment