This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #519 from zanata/assertj-versiongroup-tests
Update version group tests to assertj, add Feature annotation
- Loading branch information
Showing
5 changed files
with
185 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 0 additions & 159 deletions
159
functional-test/src/test/java/org/zanata/feature/versionGroup/VersionGroupFullTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
functional-test/src/test/java/org/zanata/feature/versionGroup/VersionGroupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/* | ||
* Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.feature.versionGroup; | ||
|
||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.zanata.feature.Feature; | ||
import org.zanata.feature.testharness.ZanataTestCase; | ||
import org.zanata.feature.testharness.TestPlan.BasicAcceptanceTest; | ||
import org.zanata.feature.testharness.TestPlan.DetailedTest; | ||
import org.zanata.page.dashboard.DashboardBasePage; | ||
import org.zanata.page.groups.CreateVersionGroupPage; | ||
import org.zanata.page.groups.VersionGroupPage; | ||
import org.zanata.page.groups.VersionGroupsPage; | ||
import org.zanata.util.SampleProjectRule; | ||
import org.zanata.workflow.LoginWorkFlow; | ||
import static org.zanata.util.FunctionalTestHelper.assumeTrue; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Damian Jansen <a | ||
* href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
@Category(DetailedTest.class) | ||
public class VersionGroupTest extends ZanataTestCase { | ||
|
||
@Rule | ||
public SampleProjectRule sampleProjectRule = new SampleProjectRule(); | ||
private DashboardBasePage dashboardPage; | ||
|
||
@Before | ||
public void before() { | ||
dashboardPage = new LoginWorkFlow().signIn("admin", "admin"); | ||
} | ||
|
||
@Feature(summary = "The administrator can create a basic group", | ||
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 170109) | ||
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) | ||
@Category(BasicAcceptanceTest.class) | ||
public void createABasicGroup() throws Exception { | ||
String groupID = "basic-group"; | ||
String groupName = "A Basic Group"; | ||
VersionGroupsPage versionGroupsPage = dashboardPage | ||
.goToGroups() | ||
.createNewGroup() | ||
.inputGroupId(groupID) | ||
.inputGroupName(groupName) | ||
.inputGroupDescription("A basic group can be saved") | ||
.saveGroup(); | ||
assertThat(versionGroupsPage.getGroupNames()) | ||
.contains(groupName) | ||
.as("The version group was created"); | ||
VersionGroupPage groupView = versionGroupsPage.goToGroup(groupName); | ||
assertThat(groupView.getTitle()) | ||
.isEqualTo("Groups - ".concat(groupName)) | ||
.as("The group is displayed"); | ||
} | ||
|
||
@Feature(summary = "The administrator must fill in the required fields " + | ||
"to create a group", | ||
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 170109) | ||
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) | ||
public void requiredFields() throws Exception { | ||
String errorMsg = "value is required"; | ||
String groupID = "verifyRequiredFieldsGroupID"; | ||
String groupName = "verifyRequiredFieldsGroupName"; | ||
|
||
CreateVersionGroupPage groupPage = dashboardPage | ||
.goToGroups() | ||
.createNewGroup() | ||
.saveGroupFailure(); | ||
|
||
assertThat(groupPage.getFieldValidationErrors()) | ||
.contains(errorMsg, errorMsg) | ||
.as("The two errors are value is required"); | ||
|
||
groupPage = groupPage.clearFields() | ||
.inputGroupName(groupName) | ||
.saveGroupFailure(); | ||
|
||
assertThat(groupPage.getFieldValidationErrors()) | ||
.contains(errorMsg) | ||
.as("The value required error shown"); | ||
|
||
groupPage = groupPage.clearFields() | ||
.inputGroupId(groupID) | ||
.saveGroupFailure(); | ||
|
||
assertThat(groupPage.getFieldValidationErrors()) | ||
.contains(errorMsg) | ||
.as("The value required error shown"); | ||
} | ||
|
||
@Feature(summary = "The administrator must enter valid data into the " + | ||
"required fields to create a group", | ||
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 170109) | ||
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) | ||
public void groupDescriptionFieldSize() throws Exception { | ||
String groupID = "verifyDescriptionFieldSizeID"; | ||
String groupName = "verifyDescriptionFieldSizeName"; | ||
String groupDescription ="This text is to test that the description " + | ||
"field takes no more than exactly 100 characters - actually."; | ||
|
||
assumeTrue("Description length is greater than 100 characters", | ||
groupDescription.length() == 101); | ||
|
||
CreateVersionGroupPage groupPage = dashboardPage | ||
.goToGroups() | ||
.createNewGroup() | ||
.inputGroupId(groupID) | ||
.inputGroupName(groupName) | ||
.inputGroupDescription(groupDescription) | ||
.saveGroupFailure(); | ||
|
||
assertThat(groupPage.getFieldValidationErrors()) | ||
.contains(CreateVersionGroupPage.LENGTH_ERROR) | ||
.as("Invalid length error is shown"); | ||
|
||
groupDescription = groupDescription.substring(0, 100); | ||
VersionGroupsPage verGroupsPage = groupPage | ||
.clearFields() | ||
.inputGroupId("verifyDescriptionFieldSizeID") | ||
.inputGroupName(groupName) | ||
.inputGroupDescription(groupDescription) | ||
.saveGroup(); | ||
|
||
assertThat(verGroupsPage.getGroupNames()) | ||
.contains(groupName) | ||
.as("A group description of 100 chars is valid"); | ||
} | ||
|
||
@Feature(summary = "The administrator can add a project version to " + | ||
"a newly created group", | ||
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 170109) | ||
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) | ||
public void addANewProjectVersionToAnEmptyGroup() throws Exception { | ||
String groupID = "add-version-to-empty-group"; | ||
String groupName = "AddVersionToEmptyGroup"; | ||
VersionGroupPage versionGroupPage = dashboardPage | ||
.goToGroups() | ||
.createNewGroup() | ||
.inputGroupId(groupID) | ||
.inputGroupName(groupName) | ||
.saveGroup() | ||
.goToGroup(groupName) | ||
.clickProjectsTab() | ||
.clickAddProjectVersionsButton() | ||
.enterProjectVersion("about-fedora") | ||
.selectProjectVersion("about-fedora master") | ||
.clickProjectsTab(); | ||
|
||
assertThat(versionGroupPage.getProjectVersionsInGroup()) | ||
.contains("about fedora\nmaster") | ||
.as("The version group shows in the list"); | ||
} | ||
} |