Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into wildfly10
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Mar 3, 2016
2 parents abb2151 + 99147d5 commit 93bda0c
Show file tree
Hide file tree
Showing 84 changed files with 1,398 additions and 737 deletions.
29 changes: 28 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
## 3.9

<h5>Infrastructure Changes</h5>
* [ZNTA-530](https://zanata.atlassian.net/browse/ZNTA-530) - Replace Seam 2 with CDI
* In WildFly or EAP `standalone.xml`, please make sure the Weld
extension is present in the `extensions` section like this:

<extensions>
...
<extension module="org.jboss.as.weld" />
...
</extensions>


* Secondly, please ensure the Weld subsystem is present in the
`profiles` section, eg like this:

<profiles>
...
<subsystem xmlns="urn:jboss:domain:weld:1.0" />
...
</profiles>


<h5>Bug fixes</h5>
* [ZNTA-804](https://zanata.atlassian.net/browse/ZNTA-804) - Coordinators' email addresses should be BCC in Contact Coordinator
* [ZNTA-693](https://zanata.atlassian.net/browse/ZNTA-693) - Handle ClientAbortException exception and reduce severity.
* [ZNTA-742](https://zanata.atlassian.net/browse/ZNTA-742) - Get a list of contributors for a Project version via the API
* [ZNTA-744](https://zanata.atlassian.net/browse/ZNTA-744) - Add review data to the contribution statistics API
* [ZNTA-879](https://zanata.atlassian.net/browse/ZNTA-879) - Allow admin to configure the visibility of user email
* [ZNTA-412](https://zanata.atlassian.net/browse/ZNTA-412) - Profile link to project maintainers, language members, and version group maintainers
* [ZNTA-905](https://zanata.atlassian.net/browse/ZNTA-905) - Remove 0% matching translation memory entry
* [ZNTA-928](https://zanata.atlassian.net/browse/ZNTA-928) - Readonly project doesn't have "lock" icon in UI
* [ZNTA-793](https://zanata.atlassian.net/browse/ZNTA-793) - Remove unused method in TranslationMemoryAction

<h5>Infrastructure Changes</h5>
* Zanata now requires JBoss EAP 6.4.6.GA or later (recommended), or WildFly version 10.x.

-----------------------

## 3.8
## 3.8.2
* [ZNTA-854](https://zanata.atlassian.net/browse/ZNTA-854) - Fast scrolling(infinite scroll) in glossary table not loading data

Expand Down
3 changes: 2 additions & 1 deletion docs/user-guide/account/account-sign-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

You can create an account on Zanata using an OpenID login (such as Google or Fedora), or by creating a password specific to Zanata. You can set or change your password and add OpenID accounts to your Zanata account at any time.

*Note: If you want to translate a JBoss-related project, use the translate.jboss.org site, which requires a jboss.org account. You can create a jboss.org account at the [jboss.org registration page](https://community.jboss.org/register.jspa). The following instructions are for general open source projects on [translate.zanata.org](http://translate.zanata.org).*
*Note: If you want to translate a JBoss-related project, use the [translate.jboss.org](https://translate.jboss.org) site, which requires a jboss.org account. You can create a jboss.org account at the [jboss.org registration page](https://community.jboss.org/register.jspa); Fedora projects should use [fedora.zanata.org](https://fedora.zanata.org); The general open source projects should use [translate.zanata.org](https://translate.zanata.org), which is used in the following instructions.

## Sign up Using OpenID

Expand Down Expand Up @@ -51,3 +51,4 @@ To add an OpenID account to your Zanata account:
1. In the `Actions` menu, click `Add New Identity` and follow the procedure described earlier.

*Note: if you want to translate a project that falls under the Fedora CLA, you must add a Fedora OpenID to your Zanata account. You can then sign in with your password or any OpenID account and be allowed to translate Fedora projects.*

4 changes: 4 additions & 0 deletions docs/user-guide/system-admin/configuration/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ It's possible to configure Zanata to use a single pre-defined Open Id authentica
...
```

### Attribute Exchange

By default Zanata will try to fetch the user's full name, email and username from the Open Id provider using [Attribute Exchange 1.0](https://openid.net/specs/openid-attribute-exchange-1_0.html) and [Simple Registration 1.1](https://openid.net/specs/openid-simple-registration-extension-1_0.html). If successful, Zanata will make suggestions when a new user signs up.

### Upgrading the Java security provider (for OpenID on Java 1.7)

Java 1.7 is unable to connect to some websites, such as the [Fedora OpenID provider](https://id.fedoraproject.org/). See [Fedora bug 1163501](https://bugzilla.redhat.com/show_bug.cgi?id=1163501) for details.
Expand Down
22 changes: 16 additions & 6 deletions frontend/src/main/web/lib/components/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var UserProfile = React.createClass({
imageUrl = '',
name = '',
languageTeams = '',
email = '',
username;

if(authenticated) {
Expand All @@ -57,6 +58,19 @@ var UserProfile = React.createClass({
imageUrl = user.imageUrl;
name = user.name;
languageTeams = user.languageTeams.join();
email = user.email;
}

if(email) {
var emailEle = <span class="txt--meta">({email})</span>
}

if (user.languageTeams) {
var langTeamsEle = (
<li id="profile-languages">
<i className="i i--language list__icon" title="Spoken languages"></i>
{languageTeams}
</li>)
}

return (
Expand All @@ -73,13 +87,9 @@ var UserProfile = React.createClass({
<li id="profile-username">
<i className="i i--user list__icon"
title="Username"></i>
{username}
</li>
<li id="profile-languages">
<i className="i i--language list__icon"
title="Spoken languages"></i>
{languageTeams}
{username} {emailEle}
</li>
{langTeamsEle}
</ul>
</div>
</div>
Expand Down
21 changes: 17 additions & 4 deletions functional-test/src/main/java/org/zanata/page/AbstractPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@

import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;

import lombok.extern.slf4j.Slf4j;

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.PageFactory;
Expand Down Expand Up @@ -412,6 +408,23 @@ public boolean apply(WebDriver input) {
triggerScreenshot("_text");
}

/**
* 'Touch' a text field to see if it's writable. For cases
* where fields are available but briefly won't accept text
* for some reason
* @param textField
*/
public void touchTextField(WebElement textField) {
waitForAMoment().until(new Predicate<WebDriver>() {
@Override
public boolean apply(WebDriver input) {
enterText(textField, ".", true, false, false);
return textField.getAttribute("value").equals(".");
}
});
textField.clear();
}

private void waitForElementReady(final WebElement element) {
waitForAMoment().withMessage("Waiting for element to be ready").until(
new Predicate<WebDriver>() {
Expand Down
128 changes: 128 additions & 0 deletions functional-test/src/main/java/org/zanata/page/DswidParamChecker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright 2016, 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.page;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Optional;

import javax.annotation.Nullable;

import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.openqa.selenium.support.events.WebDriverEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>
* DswidParamChecker provides a WebDriverEventListener which tracks dswid
* parameters (used by DeltaSpike's window/conversation management). It logs
* a warning when navigation loses the dswid parameter, and throws an
* AssertionError if the dswid changes to a different value.
* </p>
* <p>
* DswidParamChecker currently only supports a single browser tab, since
* it assumes a single dswid value.
* </p>
* <p>TODO: ignore URLs generated by explicit navigation by the test
* <br/>TODO: treat loss of previous dswid as failure
* </p>
* @author Sean Flanigan <a href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
*/
public class DswidParamChecker {
private static final Logger log = LoggerFactory.getLogger(DswidParamChecker.class);
private final EventFiringWebDriver driver;
private final WebDriverEventListener urlListener;
private @Nullable String oldUrl;
private @Nullable String oldDswid;

/**
* Creates a listener for the specified driver, but does not register it. See getEventListener().
* @param driver
*/
public DswidParamChecker(EventFiringWebDriver driver) {
this.driver = driver;
this.urlListener =
(WebDriverEventListener) Proxy.newProxyInstance(
DswidParamChecker.class.getClassLoader(),
new Class<?>[]{ WebDriverEventListener.class },
this::invoke
);
}

/**
* Returns a WebDriverEventListener which will track dswid parameters. It can be registered like this:
* driver.register(new DswidParamChecker(driver).getEventListener());
*/
public WebDriverEventListener getEventListener() {
return urlListener;
}

private Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
try {
String url = driver.getCurrentUrl();
String query = new URL(url).getQuery();
Optional<String> dswid;
if (query == null) {
dswid = Optional.empty();
} else {
dswid = URLEncodedUtils.parse(query, UTF_8)
.stream()
.filter(p -> p.getName().equals("dswid"))
.map(NameValuePair::getValue)
.findFirst();
}
if (oldDswid != null) {
assert oldUrl != null;
if (!dswid.isPresent()) {
String msg = "missing dswid on transition from " +
oldUrl + " to " + url;
// throw new AssertionError(msg);
log.warn(msg);
} else {
if (!oldDswid.equals(dswid.get())) {
throw new AssertionError(
"changed dswid on transition from " +
oldUrl + " to " + url);
}
}
}
oldDswid = dswid.orElse(null);
oldUrl = url;
return null;
} catch (MalformedURLException e) {
// just ignore this URL entirely
return null;
}
}

public void clear() {
oldDswid = null;
oldUrl = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import java.io.File;
import java.io.IOException;
import java.util.Optional;
import java.util.logging.Level;

import org.openqa.selenium.WebDriver;
Expand All @@ -48,6 +47,7 @@
import org.zanata.util.ScreenshotDirForTest;
import org.zanata.util.TestEventForScreenshotListener;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static org.zanata.util.Constants.webDriverType;
Expand All @@ -59,6 +59,7 @@ public enum WebDriverFactory {
INSTANCE;

private volatile EventFiringWebDriver driver = createDriver();
private @Nonnull DswidParamChecker dswidParamChecker;
private DriverService driverService;
private TestEventForScreenshotListener eventListener;
private int webdriverWait;
Expand All @@ -81,9 +82,11 @@ private EventFiringWebDriver createDriver() {
throw new UnsupportedOperationException("only support chrome " +
"and firefox driver");
}
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
webdriverWait = Integer.parseInt(PropertiesHolder
.getProperty(webDriverWait.value()));
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
dswidParamChecker = new DswidParamChecker(newDriver);
newDriver.register(dswidParamChecker.getEventListener());
return newDriver;
}

Expand Down Expand Up @@ -255,6 +258,14 @@ private FirefoxProfile makeFirefoxProfile() {
return firefoxProfile;
}

public void testEntry() {
dswidParamChecker.clear();
}

public void testExit() {
dswidParamChecker.clear();
}

private class ShutdownHook extends Thread {
public void run() {
// If webdriver is running quit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
*/
package org.zanata.page.administration;

import com.google.common.base.Predicate;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.zanata.page.BasePage;
Expand Down Expand Up @@ -55,6 +57,7 @@ public ServerConfigurationPage(WebDriver driver) {
}

private void enterTextConfigField(By by, String text) {
touchTextField(readyElement(by));
enterText(readyElement(by), text);
expectFieldValue(by, text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public class DashboardAccountTab extends DashboardBasePage {
public static final String EMAIL_TAKEN_ERROR =
"This email address is already taken";

private By emailForm = By.id("email-update-form");
private By emailField = By.id("email-update-form:emailField:input:email");
private By updateEmailButton = By.id("email-update-form:updateEmailButton");
// Use form and button tag to find the item, as its id is altered by jsf
private By updateEmailButton = By.tagName("button");
private By oldPasswordField = By.id("passwordChangeForm:oldPasswordField:input:oldPassword");
private By newPasswordField = By.id("passwordChangeForm:newPasswordField:input:newPassword");
private By changePasswordButton = By.cssSelector("button[id^='passwordChangeForm:changePasswordButton']");
Expand All @@ -61,7 +63,7 @@ public DashboardAccountTab typeNewAccountEmailAddress(String emailAddress) {

public DashboardAccountTab clickUpdateEmailButton() {
log.info("Click Update Email");
clickElement(updateEmailButton);
clickElement(readyElement(emailForm).findElement(updateEmailButton));
return new DashboardAccountTab(getDriver());
}

Expand Down
Loading

0 comments on commit 93bda0c

Please sign in to comment.