Search in sources :

Example 1 with ProjectActivityPage

use of pageobjects.ProjectActivityPage in project sonarqube by SonarSource.

the class QualityGateUiTest method display_alerts_correctly_in_history_page.

/**
   * SONAR-3326
   */
@Test
public void display_alerts_correctly_in_history_page() {
    QualityGateClient qgClient = qgClient();
    QualityGate qGate = qgClient.create("AlertsForHistory");
    qgClient.setDefault(qGate.id());
    String firstAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -2));
    String secondAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -1));
    // with this configuration, project should have an Orange alert
    QualityGateCondition lowThresholds = qgClient.createCondition(NewCondition.create(qGate.id()).metricKey("lines").operator("GT").warningThreshold("5").errorThreshold("50"));
    scanSampleWithDate(firstAnalysisDate);
    // with this configuration, project should have a Green alert
    qgClient.updateCondition(UpdateCondition.create(lowThresholds.id()).metricKey("lines").operator("GT").warningThreshold("5000").errorThreshold("5000"));
    scanSampleWithDate(secondAnalysisDate);
    ProjectActivityPage page = Navigation.get(orchestrator).openProjectActivity("sample");
    page.assertFirstAnalysisOfTheDayHasText(secondAnalysisDate, "Green (was Orange)").assertFirstAnalysisOfTheDayHasText(firstAnalysisDate, "Orange");
    qgClient.unsetDefault();
    qgClient.destroy(qGate.id());
}
Also used : QualityGateClient(org.sonar.wsclient.qualitygate.QualityGateClient) ProjectActivityPage(pageobjects.ProjectActivityPage) QualityGateCondition(org.sonar.wsclient.qualitygate.QualityGateCondition) Date(java.util.Date) QualityGate(org.sonar.wsclient.qualitygate.QualityGate) Test(org.junit.Test)

Example 2 with ProjectActivityPage

use of pageobjects.ProjectActivityPage in project sonarqube by SonarSource.

the class ProjectActivityPageTest method should_list_snapshots.

@Test
public void should_list_snapshots() {
    analyzeProject("shared/xoo-history-v1", "2014-10-19");
    analyzeProject("shared/xoo-history-v2", "2014-11-13");
    ProjectActivityPage page = openPage();
    page.getAnalyses().shouldHaveSize(2);
    List<ProjectAnalysisItem> analyses = page.getAnalysesAsItems();
    analyses.get(0).shouldHaveEventWithText("1.0-SNAPSHOT").shouldNotHaveDeleteButton();
    analyses.get(1).shouldHaveEventWithText("0.9-SNAPSHOT").shouldHaveDeleteButton();
}
Also used : ProjectAnalysisItem(pageobjects.ProjectAnalysisItem) ProjectActivityPage(pageobjects.ProjectActivityPage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ProjectActivityPage (pageobjects.ProjectActivityPage)2 Date (java.util.Date)1 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)1 QualityGateClient (org.sonar.wsclient.qualitygate.QualityGateClient)1 QualityGateCondition (org.sonar.wsclient.qualitygate.QualityGateCondition)1 ProjectAnalysisItem (pageobjects.ProjectAnalysisItem)1