Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suite's history #328

Merged
merged 42 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3a2ec2a
new servlet - HistoryServlet
PiteroS678 Aug 13, 2018
7f00eab
history.html added
PiteroS678 Aug 14, 2018
ecbc0d8
license added
PiteroS678 Aug 14, 2018
c38b889
access to specific suite version
PiteroS678 Aug 14, 2018
f83a33a
access to specific suite version
PiteroS678 Aug 14, 2018
99debc8
Suite's history is now displayed in a lightbox
Aug 16, 2018
3179138
CHANGELOG update
PiteroS678 Aug 16, 2018
e58d84d
Overlay deleted
Aug 17, 2018
21ce958
Merge branch 'feature/suite-history' of https://github.com/Cognifide/…
Aug 17, 2018
90bfa60
added version to HistoryServlet output
PiteroS678 Aug 17, 2018
76ebe6e
javadoc update
PiteroS678 Aug 17, 2018
26610db
minor refactor
PiteroS678 Aug 17, 2018
71aaf63
Wiki - RestAPI update
PiteroS678 Aug 17, 2018
e4e8408
Suite's history is now properly displayed with correlationId in URL
Aug 17, 2018
e700335
history.html 'references' removed
PiteroS678 Aug 17, 2018
df0372e
refactor
PiteroS678 Aug 20, 2018
f90f430
minor refactor
PiteroS678 Aug 20, 2018
2867454
refactor
PiteroS678 Aug 20, 2018
acfbd2f
Merge branch 'master' into feature/suite-history
PiteroS678 Aug 20, 2018
1072bc2
historyRebased color changed
PiteroS678 Aug 21, 2018
d82b484
added button "Go to latest version"
PiteroS678 Aug 21, 2018
c50ae23
version validation added
PiteroS678 Aug 21, 2018
ce22594
added buttons NEXT/PREVIOUS version
PiteroS678 Aug 22, 2018
d45e939
History popup is now a modal
Aug 22, 2018
eb88b90
Merge branch 'master' into feature/suite-history
PiteroS678 Aug 22, 2018
fced7a7
Updated documentation
Aug 22, 2018
157db3b
Documentation image fix
Aug 22, 2018
900e4c0
Suite's history is now displayed properly when correlation id is used
Aug 22, 2018
f7c1d59
HistoryServlet - OSGi annotation
PiteroS678 Aug 22, 2018
df785c8
formatting fix
PiteroS678 Aug 22, 2018
74a918a
typo fix
PiteroS678 Aug 22, 2018
811eee5
Documentation fix
Aug 23, 2018
56d8785
Documentation missing image fix
Aug 23, 2018
80d3f20
Handle case with correlationId
Aug 23, 2018
2744b96
Fix for modal visual bug
Aug 24, 2018
41e7b54
Fixed array numeration
Aug 27, 2018
ccab222
Fixed array numeration
Aug 27, 2018
5facea8
Fixed variable naming
Aug 28, 2018
aa91053
Merge branch 'master' into feature/suite-history
tkaik Aug 28, 2018
7e4c414
JS Fix
Aug 28, 2018
28c36c1
Merge branch 'feature/suite-history' of https://github.com/Cognifide/…
Aug 28, 2018
3c4908a
Merge branch 'master' into feature/suite-history
tkaik Aug 29, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to AET will be documented in this file.
## Unreleased
**List of changes that are finished but not yet released in any final version.**

- [PR-328](https://github.com/Cognifide/aet/pull/328) Added suite's history
- [PR-303](https://github.com/Cognifide/aet/pull/303) Added `exclude-elements` parameter to [ScreenCollector](https://github.com/Cognifide/aet/wiki/ScreenCollector)
- [PR-327](https://github.com/Cognifide/aet/pull/327) Default web driver changed from Firefox to Chrome
- [PR-294](https://github.com/Cognifide/aet/pull/294) Added support for full page screenshot in chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public interface MetadataDAO extends Serializable {
*/
Suite getSuite(DBKey dbKey, String correlationId) throws StorageException;

/**
* @param dbKey - key with project and company name
* @param name - name of suite
* @param version - version of suite
* @return Suite object found by given criteria or null.
*/
Suite getSuite(DBKey dbKey, String name, String version) throws StorageException;

/**
* @param dbKey - key with project and company name
* @param name - name of suite
Expand All @@ -61,6 +69,13 @@ public interface MetadataDAO extends Serializable {
*/
List<Suite> listSuites(DBKey dbKey) throws StorageException;

/**
* @param dbKey - key with project and company name
* @param name - name of suite
* @return List of suite's correlationsIds & versions that were found in database.
*/
List<SuiteVersion> listSuiteVersions(DBKey dbKey, String name) throws StorageException;

/**
* Removes suite from .metadata collection.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.cognifide.aet.vs;

public class SuiteVersion {
private final String correlationId;

private final Integer version;

public SuiteVersion(String correlationId, Integer version) {
this.correlationId = correlationId;
this.version = version;
}

public String getCorrelationId() {
return correlationId;
}

public Integer getVersion() {
return version;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
import com.cognifide.aet.vs.MetadataDAO;
import com.cognifide.aet.vs.SimpleDBKey;
import com.cognifide.aet.vs.StorageException;
import com.cognifide.aet.vs.SuiteVersion;
import com.cognifide.aet.vs.mongodb.MongoDBClient;
import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.collect.FluentIterable;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
Expand All @@ -35,6 +34,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import org.osgi.service.component.annotations.Component;
Expand All @@ -51,6 +52,8 @@ public class MetadataDAOMongoDBImpl implements MetadataDAO {

public static final String METADATA_COLLECTION_NAME = "metadata";

private static final String SUITE_PARAM_NAME = "name";

private static final String SUITE_VERSION_PARAM_NAME = "version";

private static final String CORRELATION_ID_PARAM_NAME = "correlationId";
Expand Down Expand Up @@ -109,6 +112,19 @@ public Suite getSuite(DBKey dbKey, String correlationId) throws StorageException
return new DocumentConverter(result).toSuite();
}

@Override
public Suite getSuite(DBKey dbKey, String name, String version) throws StorageException {
MongoCollection<Document> metadata = getMetadataCollection(dbKey);

LOGGER.debug("Fetching suite with name: {}, version: {}", name, version);

final FindIterable<Document> found = metadata
.find(Filters.and(Filters.eq(SUITE_PARAM_NAME, name),
Filters.eq(SUITE_VERSION_PARAM_NAME, Integer.parseInt(version))));
final Document result = found.first();
return new DocumentConverter(result).toSuite();
}

@Override
public Suite getLatestRun(DBKey dbKey, String name) throws StorageException {
MongoCollection<Document> metadata = getMetadataCollection(dbKey);
Expand All @@ -133,12 +149,26 @@ public List<Suite> listSuites(DBKey dbKey) throws StorageException {
.find()
.sort(Sorts.descending(SUITE_VERSION_PARAM_NAME));

return FluentIterable.from(found).transform(new Function<Document, Suite>() {
@Override
public Suite apply(Document result) {
return new DocumentConverter(result).toSuite();
}
}).toList();
return StreamSupport.stream(found.spliterator(), false)
.map(document -> new DocumentConverter(document).toSuite())
.collect(Collectors.toList());
}

public List<SuiteVersion> listSuiteVersions(DBKey dbKey, String name) throws StorageException {
MongoCollection<Document> metadata = getMetadataCollection(dbKey);
LOGGER.debug("Fetching all versions of suite: `{}` , company: `{}`, project: `{}`.", name,
dbKey.getCompany(),
dbKey.getProject());

final FindIterable<Document> found = metadata
.find(Filters.eq(SUITE_PARAM_NAME, name))
.sort(Sorts.descending(SUITE_VERSION_PARAM_NAME));

return StreamSupport.stream(found.spliterator(), false)
.map(document -> new SuiteVersion(
document.getString(CORRELATION_ID_PARAM_NAME),
document.getInteger(SUITE_VERSION_PARAM_NAME)))
.collect(Collectors.toList());
}

@Override
Expand Down
18 changes: 17 additions & 1 deletion documentation/src/main/wiki/RestAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Base api path:
* **HTTP Method**: GET
* **Parameters**: `company`, `project`, `correlationId`
* **Example**: http://aet.example.com/api/metadata?company=cognifide&project=example&correlationId=cognifide-example-1459257500567
* **Description**: Returns newest version of metadata identified by provided correlationId.\
* **Description**: Returns newest version of metadata identified by provided correlationId.

--------
##### Get metadata by suite name
Expand All @@ -35,6 +35,14 @@ Base api path:
* **Example**: http://aet.example.com/api/metadata?company=cognifide&project=example&suite=mysimplesuite
* **Description**: Returns newest version of latest run (identified by latest correlationId) of metadata by with provided suite name.

--------
##### Get metadata by suite name and version
* **URL**: `/api/metadata`
* **HTTP Method**: GET
* **Parameters**: `company`, `project`, `suite`, `version`
* **Example**: http://aet.example.com/api/metadata?company=cognifide&project=example&suite=mysimplesuite&version=7
* **Description**: Returns specified version of metadata identified by provided suite and version.

--------
##### Update suite metadata
* **URL**: `/api/metadata`
Expand All @@ -43,6 +51,14 @@ Base api path:
* **Example**: http://aet.example.com/api/metadata `[raw json in post body]`
* **Description**: This method increments version number before saving to DB and returns updated suite object in json format. Returns status 409 if given suite is locked.

--------
##### Get correlationIds and versions by suite name
* **URL**: `/api/history`
* **HTTP Method**: GET
* **Parameters**: `company`, `project`, `suite`
* **Example**: http://aet.example.com/api/history?company=cognifide&project=example&suite=mysimplesuite
* **Description**: Returns all found correlationIds and versions by suite name

--------
##### Get lock for suite
* **URL**: `/lock`
Expand Down
12 changes: 12 additions & 0 deletions documentation/src/main/wiki/SuiteReportFeatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ Moreover, every URL has information to which test group it belongs.

![Find example](assets/suiteReport/find-in-sidepanel-example.png)

#### Browsing suite's history
It is possible to view current suite's history by clicking current suite's name and version in the top toolbar. User can also navigate through versions by clicking next/previous arrow next to suite's version.

![Suite history](assets/suiteReport/suite-history.png)

Clicking the suite's name in the top toolbar will show a popup in which the user can see every suite's version that is still available in the database. User can also directly go to the newest version of the suite by clicking the step-forward icon (the one furthest to the right in the image above).

Bold version means that this version is the same as the version that's currently being viewed.
Blue version means that it is a rebased version of previous suite - this is also shown by the timestamps which are identical for original and rebased suite versions.

![Suite history popup](assets/suiteReport/history-popup.png)

#### Navigation via keyboard shortcuts
* press **q** to expand/collapse all items
* press **e** to expand/collapse all error items
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions report/src/main/webapp/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"nonew": true,
"quotmark": true,
"maxparams": 10,
"validthis": true,

// Environments
"jquery": true,
Expand Down
4 changes: 3 additions & 1 deletion report/src/main/webapp/app/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require.config({
'metadataService': 'services/metadata.service',
'metadataAccessService': 'services/metadataAccess.service',
'notesService': 'services/notes.service',
'historyService': 'services/history.service',
'suiteInfoService': 'services/suiteInfo.service',
'patternsService': 'services/patterns.service',
'userSettingsService': 'services/userSettings.service',
Expand All @@ -73,7 +74,8 @@ require.config({
'includedCommentPopoverDirective': 'layout/main/url/includedCommentPopover.directive',
//modals
'unsavedChangesModalController': 'layout/modal/unsavedChanges/unsavedChangesModal.controller',
'noteModalController': 'layout/modal/note/noteModal.controller'
'noteModalController': 'layout/modal/note/noteModal.controller',
'historyModalController': 'layout/modal/history/historyModal.controller'
},
shim: {
jquery: {
Expand Down
2 changes: 2 additions & 0 deletions report/src/main/webapp/app/app.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ define(['angularAMD',
'metadataService',
'metadataAccessService',
'notesService',
'historyService',
'suiteInfoService',
'patternsService',
'caseFactory',
Expand All @@ -63,6 +64,7 @@ define(['angularAMD',
'filterInformationDirective',
// modals
'noteModalController',
'historyModalController',
'unsavedChangesModalController'], function (angularAMD, _) {

var app = angular.module('app', ['ui.router', 'ui.bootstrap']);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['angularAMD'], function (angularAMD) {
'use strict';
angularAMD.controller('historyModalController', historyModalController);

function historyModalController($uibModalInstance) {
var vm = this;
init();

/***************************************
*********** Private methods *********
***************************************/

function init() {
vm.hideSuiteHistory = function() {
hideHistory();
};
}

function hideHistory() {
$uibModalInstance.close();
}
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--

AET

Copyright (C) 2013 Cognifide Limited

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

<div class="suite-history-container">
<div class="suite-history-top-bar">
<h3 class="suite-history-title">Suite's History</h3>
<div class="suite-history-top-bar-close" ng-click="historyModal.hideSuiteHistory()">
<i class="far fa-window-close"></i>
</div>
</div>
<div ng-repeat="suiteHeader in suiteHeaders track by $index">
<a href="{{reportPath}}&version={{suiteHeader.version}}" ng-if="suiteHeader.isRebased">
<div class="suite-history-item suite-history-rebased" ng-if="selectedVersion === suiteHeader.version">
<i class="fas fa-angle-right suite-history-arrow"></i><span class="suite-history-rebased-bold">v{{suiteHeader.version}} | {{suiteHeader.timestamp | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
</div>
<div class="suite-history-item suite-history-rebased" ng-if="selectedVersion !== suiteHeader.version">
<i class="fas fa-angle-right suite-history-arrow"></i>v{{suiteHeader.version}} | {{suiteHeader.timestamp | date: 'yyyy-MM-dd HH:mm:ss'}}
</div>
</a>
<a href="{{reportPath}}&version={{suiteHeader.version}}" ng-if="!suiteHeader.isRebased">
<div class="suite-history-item" ng-if="selectedVersion === suiteHeader.version">
<i class="fas fa-angle-right suite-history-arrow"></i><span class="suite-history-bold">v{{suiteHeader.version}} | {{suiteHeader.timestamp | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
</div>
<div class="suite-history-item" ng-if="selectedVersion !== suiteHeader.version">
<i class="fas fa-angle-right suite-history-arrow"></i>v{{suiteHeader.version}} | {{suiteHeader.timestamp | date: 'yyyy-MM-dd HH:mm:ss'}}
</div>
</a>
</div>
</div>
Loading