Browse Source

[Chore] Fix flaky e2e test (#16246)

* fix flaky e2e test
dev
xiangzihao 4 months ago committed by GitHub
parent
commit
23d6437d3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 48
      .github/workflows/e2e.yml
  2. 13
      dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java

48
.github/workflows/e2e.yml

@ -128,6 +128,10 @@ jobs:
class: org.apache.dolphinscheduler.e2e.cases.tasks.ShellTaskE2ETest class: org.apache.dolphinscheduler.e2e.cases.tasks.ShellTaskE2ETest
- name: PythonTaskE2ETest - name: PythonTaskE2ETest
class: org.apache.dolphinscheduler.e2e.cases.tasks.PythonTaskE2ETest class: org.apache.dolphinscheduler.e2e.cases.tasks.PythonTaskE2ETest
- name: SqlServerDataSource
class: org.apache.dolphinscheduler.e2e.cases.SqlServerDataSourceE2ETest
- name: HiveDataSource
class: org.apache.dolphinscheduler.e2e.cases.HiveDataSourceE2ETest
env: env:
RECORDING_PATH: /tmp/recording-${{ matrix.case.name }} RECORDING_PATH: /tmp/recording-${{ matrix.case.name }}
steps: steps:
@ -169,50 +173,6 @@ jobs:
name: recording-${{ matrix.case.name }} name: recording-${{ matrix.case.name }}
path: ${{ env.RECORDING_PATH }} path: ${{ env.RECORDING_PATH }}
retention-days: 1 retention-days: 1
e2e-optional:
name: ${{ matrix.case.name }}
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
case:
- name: SqlServerDataSource
class: org.apache.dolphinscheduler.e2e.cases.SqlServerDataSourceE2ETest
- name: HiveDataSource
class: org.apache.dolphinscheduler.e2e.cases.HiveDataSourceE2ETest
env:
RECORDING_PATH: /tmp/recording-${{ matrix.case.name }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-e2e
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@v4
name: Download Docker Images
with:
name: standalone-image
path: /tmp
- name: Load Docker Images
run: |
docker load -i /tmp/standalone-image.tar
- name: Run Test
run: |
./mvnw -B -f dolphinscheduler-e2e/pom.xml -am \
-DfailIfNoTests=false \
-Dtest=${{ matrix.case.class }} test
- uses: actions/upload-artifact@v4
if: always()
name: Upload Recording
with:
name: recording-${{ matrix.case.name }}
path: ${{ env.RECORDING_PATH }}
retention-days: 1
result: result:
name: E2E name: E2E
runs-on: ubuntu-latest runs-on: ubuntu-latest

13
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/datasource/DataSourcePage.java

@ -52,9 +52,7 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem
}) })
private WebElement buttonConfirm; private WebElement buttonConfirm;
@FindBys({ @FindBy(className = "dialog-source-modal")
@FindBy(className = "dialog-source-modal"),
})
private WebElement dataSourceModal; private WebElement dataSourceModal;
private final CreateDataSourceForm createDataSourceForm; private final CreateDataSourceForm createDataSourceForm;
@ -70,10 +68,11 @@ public class DataSourcePage extends NavBarPage implements NavBarPage.NavBarItem
String jdbcParams) { String jdbcParams) {
buttonCreateDataSource().click(); buttonCreateDataSource().click();
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.visibilityOfElementLocated( WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.visibilityOf(dataSourceModal));
new By.ByClassName("dialog-source-modal"))); WebElement dataSourceTypeButton = By.className(dataSourceType.toUpperCase() + "-box").findElement(driver);
WebDriverWaitFactory.createWebDriverWait(driver)
dataSourceModal().findElement(By.className(dataSourceType.toUpperCase() + "-box")).click(); .until(ExpectedConditions.elementToBeClickable(dataSourceTypeButton));
dataSourceTypeButton.click();
WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.textToBePresentInElement( WebDriverWaitFactory.createWebDriverWait(driver).until(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase())); driver.findElement(By.className("dialog-create-data-source")), dataSourceType.toUpperCase()));

Loading…
Cancel
Save