Skip to content

Commit

Permalink
Merge branch 'main' into RSE-1010
Browse files Browse the repository at this point in the history
  • Loading branch information
DarwisNarvaezDev committed Feb 9, 2024
2 parents 316e318 + f6a7bf7 commit 2cf5dcb
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 64 deletions.
55 changes: 5 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,68 +505,22 @@ jobs:
command: << parameters.command >>


# Run Testdeck job on machine executor.
testdeck:
<<: *job-defaults
executor:
name: machine-builder
docker_layer_caching: true
resource_class: << parameters.resource_class >>

parameters:
resource_class:
type: string
default: medium
workdir:
description: Working directory
type: string
default: .
command:
description: Command that will execute the docker tests
type: string

steps:

- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- install-testdeck-dependencies
- attach_workspace:
at: ~/workspace
- run-build-step:
step-name: Pull Rundeck Image
command: rundeck_pull_image
- run-build-step:
step-name: Test
command: |
cd << parameters.workdir >>
./bin/deck bootstrap
<< parameters.command >>
- run-build-step:
step-name: Print Logs
when: always
command: |
cd << parameters.workdir >>
./bin/deck cluster logs
- store_artifacts:
path: << parameters.workdir >>/test_out/images
destination: images
- store_test_results:
path: << parameters.workdir >>/test_out

test-gradle-functional:
<<: *job-defaults
executor:
name: machine-builder
docker_layer_caching: true
resource_class: medium
resource_class: << parameters.resource_class >>
parameters:
test-image:
description: Test image tag
default: "rundeck/testdeck"
type: string
gradle-task:
type: string
resource_class:
type: string
default: medium
steps:
- checkout
- install-build-dependencies
Expand Down Expand Up @@ -733,6 +687,7 @@ workflows:
- test-gradle-functional:
name: New Selenium Test
gradle-task: seleniumCoreTest
resource_class: large
<<: *require-build
<<: *slack-defaults
- test-gradle-functional:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ abstract class BasePage {
BasePage(final SeleniumContext context) {
this.context = context
this.context.driver.manage().window().setSize(new Dimension(1200, 1050))
this.context.driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10))
}

abstract String getLoadPath()
/**
* Go to the page and validate
*/
void go() {
if (loadPath) {
if (loadPath && !loadPath.empty) {
implicitlyWait 2000
driver.get(context.client.baseUrl + loadPath)
validatePage()
}
}

void go(String loadPath) {
if (loadPath && !loadPath.empty) {
implicitlyWait 2000
driver.get(context.client.baseUrl + loadPath)
validatePage()
Expand Down Expand Up @@ -65,7 +74,7 @@ abstract class BasePage {
}

void waitForElementToBeClickable(By locator) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(60))
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30))
wait.until {
WebDriver d ->
def elementLocator = d.findElement(locator)
Expand All @@ -74,17 +83,17 @@ abstract class BasePage {
}

void waitForElementToBeClickable(WebElement locator) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(60))
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30))
wait.until { ExpectedConditions.elementToBeClickable(locator) }
}

void waitForTextToBePresentInElement(WebElement locator, String text) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(60))
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30))
wait.until { ExpectedConditions.textToBePresentInElement(locator, text) }
}

boolean waitForElementAttributeToChange(WebElement locator, String attribute, String valueCompare) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(60))
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30))
wait.until {
WebDriver d ->
def elementLocator = locator.getAttribute(attribute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class JobCreatePage extends BasePage {
By ansibleBinariesPathBy = By.name("pluginConfig.ansible-binaries-dir-path")
By autocompleteSuggestionsBy = By.cssSelector("div[class='autocomplete-suggestions']")
By wfUndoButtonBy = By.xpath("//*[@id='wfundoredo']/div/span[1]")
By wfUndoButtonLinkBy = By.xpath("//*[@class='btn btn-xs btn-default act_undo flash_undo']")
By wfRedoButtonBy = By.xpath("//*[@id='wfundoredo']/div/span[2]")
By wfRedoButtonLinkBy = By.xpath("//*[@class='btn btn-xs btn-default act_redo flash_undo']")
By wfRevertAllButtonBy = By.xpath("//*[@id='wfundoredo']/div/span[3]")
By revertWfConfirmBy = By.xpath('//*[starts-with(@id,"popover")]/div[2]/span[2]')
By listWorkFlowItemBy = By.xpath("//*[starts-with(@id,'wfitem_')]")
Expand Down Expand Up @@ -371,10 +373,18 @@ class JobCreatePage extends BasePage {
el wfUndoButtonBy
}

WebElement getWfUndoButtonLink() {
el wfUndoButtonLinkBy
}

WebElement getWfRedoButton() {
el wfRedoButtonBy
}

WebElement getWfRedoButtonLink() {
el wfRedoButtonLinkBy
}

WebElement getWfRevertAllButton() {
el wfRevertAllButtonBy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test && sleep 45"
commandPage.runButton.click()
commandPage.waitForElementAttributeToChange commandPage.runningExecutionStateButton, 'data-execstate', 'RUNNING'
Expand All @@ -45,6 +46,7 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test && sleep 45"
commandPage.runButton.click()
commandPage.runningButtonLink().click()
Expand All @@ -64,7 +66,8 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name + "'"
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name.toString() + "'"
commandPage.runButton.click()
def href = commandPage.runningButtonLink().getAttribute("href")
commandPage.driver.get href
Expand All @@ -86,7 +89,8 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name + "'"
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name.toString() + "'"
commandPage.runButton.click()
def href = commandPage.runningButtonLink().getAttribute("href")
commandPage.driver.get href + "#output"
Expand All @@ -108,7 +112,8 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name + "'"
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name.toString() + "'"
commandPage.runButton.click()
def href = commandPage.runningButtonLink().getAttribute("href")
commandPage.driver.get href + "#output"
Expand All @@ -132,7 +137,8 @@ class CommandSpec extends SeleniumBase {
commandPage.filterNodeButton.click()
commandPage.waitForElementToBeClickable commandPage.commandTextField
commandPage.commandTextField.click()
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name + "'"
commandPage.waitForElementAttributeToChange commandPage.commandTextField, 'disabled', null
commandPage.commandTextField.sendKeys "echo running test '" + this.class.name.toString() + "'"
commandPage.runButton.click()
def href = commandPage.runningButtonLink().getAttribute("href")
commandPage.driver.get href
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ class JobsSpec extends SeleniumBase {
jobCreatePage.executeScript "arguments[0].scrollIntoView(true);", jobCreatePage.saveOptionButton
jobCreatePage.saveOptionButton.click()
jobCreatePage.waitFotOptLi 1
jobCreatePage.waitForElementAttributeToChange jobCreatePage.optionUndoButton, 'disabled', null
jobCreatePage.optionUndoButton.click()
expect:
jobCreatePage.waitForOptionsToBe 1, 0
Expand Down Expand Up @@ -284,6 +285,7 @@ class JobsSpec extends SeleniumBase {
jobCreatePage.saveOptionButton.click()
jobCreatePage.waitFotOptLi 1
jobCreatePage.executeScript "window.location.hash = '#optundoredo'"
jobCreatePage.waitForElementAttributeToChange jobCreatePage.optionUndoButton, 'disabled', null
jobCreatePage.optionUndoButton
jobCreatePage.optionRevertAllButton.click()
jobCreatePage.optionConfirmRevertAllButton.click()
Expand Down Expand Up @@ -316,8 +318,10 @@ class JobsSpec extends SeleniumBase {
jobCreatePage.saveOptionButton.click()
jobCreatePage.waitFotOptLi 1
jobCreatePage.executeScript "window.location.hash = '#optundoredo'"
jobCreatePage.waitForElementAttributeToChange jobCreatePage.optionUndoButton, 'disabled', null
jobCreatePage.optionUndoButton.click()
jobCreatePage.waitForElementToBeClickable jobCreatePage.optionRedoButton
sleep 1000
jobCreatePage.optionRedoButton.click()
expect:
!(jobCreatePage.optionLis 0 isEmpty())
Expand Down Expand Up @@ -367,9 +371,10 @@ class JobsSpec extends SeleniumBase {
jobCreatePage.fillBasicJob 'a job with workflow undo-redo test'
jobCreatePage.addSimpleCommandStepButton.click()
jobCreatePage.addSimpleCommandStep 'echo selenium test 2', 1
jobCreatePage.wfUndoButton.click()
jobCreatePage.waitForElementToBeClickable jobCreatePage.wfRedoButton
jobCreatePage.wfRedoButton.click()
jobCreatePage.waitForElementToBeClickable jobCreatePage.wfUndoButtonLink
jobCreatePage.wfUndoButtonLink.click()
jobCreatePage.waitForElementToBeClickable jobCreatePage.wfRedoButtonLink
jobCreatePage.wfRedoButtonLink.click()
jobCreatePage.waitForNumberOfElementsToBe jobCreatePage.listWorkFlowItemBy, 2
expect:
jobCreatePage.workFlowList.size() == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class NodesSpec extends SeleniumBase {
def nodeSourcePage = page NodeSourcePage
when:
loginPage.login(TEST_USER, TEST_PASS)
nodeSourcePage.loadPath += "/project/${SELENIUM_BASIC_PROJECT}/nodes/sources"
nodeSourcePage.go()
nodeSourcePage.loadPath = "/project/${SELENIUM_BASIC_PROJECT}/nodes/sources"
nodeSourcePage.go("/project/${SELENIUM_BASIC_PROJECT}/nodes/sources")
then:
nodeSourcePage.waitForElementVisible nodeSourcePage.newNodeSourceButton
nodeSourcePage.newNodeSourceButton != null
Expand Down

0 comments on commit 2cf5dcb

Please sign in to comment.