Skip to content

Commit

Permalink
Merge pull request #385 from davidbgk/384-fix-integration-tests
Browse files Browse the repository at this point in the history
Fix integration tests and code, fix #384
  • Loading branch information
davidbgk committed Mar 16, 2016
2 parents e524d30 + 09ceaaf commit bd5cb4e
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 81 deletions.
5 changes: 4 additions & 1 deletion js/components/reuse/post-create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import Reuse from 'models/reuse';
export default {
props: {
reuse: Object
reuse: {
type: Object,
default: function() {return {};}
}
},
components: {
share: require('components/widgets/share.vue')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to perform various search queries from the homepage " +
"in order to find datasets, orgs, reuses and users.",
description: "Perform front search queries",

steps: [
NavigationComponent.home(),
Expand Down
4 changes: 1 addition & 3 deletions specs/integration/2 - LoginScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to log in then log out from the homepage " +
"in order to perform authorization-required actions.",
description: "Login then logout",

steps: [
NavigationComponent.home(),
Expand Down
9 changes: 2 additions & 7 deletions specs/integration/3 - CreateDatasetScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to create a dataset from the homepage " +
"in order to add new data to my organization.",
description: "Create a dataset",

steps: [
// Login.
Expand All @@ -18,10 +16,7 @@ steps: [
// Add the dedicated resource file.
CreateDatasetComponent.chooseLocalFile(),
CreateResourceComponent.setTitle(resourceName),
CreateResourceComponent.openFileUploader(),
{
"CreateResourceComponent.checksumInput": true // Waiting for manual upload.
},
CreateResourceComponent.upload('specs/integration/files/image.png'),
NavigationComponent.next(),
{
"CreateDatasetComponent.successTitle": true
Expand Down
9 changes: 2 additions & 7 deletions specs/integration/4 - CreateReuseScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to create a reuse from the homepage " +
"in order to add share my discovery.",
description: "Create a reuse",

steps: [
// Login.
Expand All @@ -18,10 +16,7 @@ steps: [
// Choose the related dataset.
CreateReuseComponent.chooseDataset("geozones"),
NavigationComponent.next(),
CreateReuseComponent.openFileUploader(),
{
"CreateReuseComponent.cropScreen": true // Waiting for manual upload.
},
CreateReuseComponent.upload('specs/integration/files/image.png'),
NavigationComponent.next(),
{
"CreateReuseComponent.successTitle": true
Expand Down
9 changes: 2 additions & 7 deletions specs/integration/5 - CreateOrgScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to create an organization from the homepage " +
"in order to start publishing opendata on the platform.",
description: "Create an organization",

steps: [
// Login.
Expand All @@ -14,10 +12,7 @@ steps: [
// Fill the main form.
CreateOrgComponent.fill(orgName, orgDescription),
NavigationComponent.next(),
CreateOrgComponent.openFileUploader(),
{
"CreateOrgComponent.cropScreen": true // Waiting for manual upload.
},
CreateOrgComponent.upload('specs/integration/files/image.png'),
NavigationComponent.next(),
{
"CreateOrgComponent.successTitle": true
Expand Down
9 changes: 2 additions & 7 deletions specs/integration/6 - CreateCommunityResourceScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to create a community resource from the homepage " +
"in order to share my work on the platform.",
description: "Create a community resource",

steps: [
// Find the BAN dataset and click the add community resource link.
Expand All @@ -14,10 +12,7 @@ steps: [
// Add the dedicated community resource file.
CreateDatasetComponent.chooseLocalFile(),
CreateResourceComponent.setTitle(resourceName),
CreateResourceComponent.openFileUploader(),
{
"CreateResourceComponent.checksumInput": true // Waiting for manual upload.
},
CreateResourceComponent.upload('specs/integration/files/image.png'),
NavigationComponent.next(),
{
"CreateDatasetComponent.successTitle": true
Expand Down
60 changes: 21 additions & 39 deletions specs/integration/7 - SearchAdminScenario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
description: "As an anonymous user, " +
"I want to look for datasets, community resources, reuses, issues and discussions " +
"in order to find a given thing related to my data.",
description: "Perform admin search queries",

steps: [
// Reach the admin dashboard.
Expand All @@ -12,52 +10,36 @@ steps: [
NavigationComponent.adminFromFrontMenu(),
SearchComponent.searchForAdmin(adminQueryGeo),
{
"SearchComponent.datasetsTitleSearchAdminResult": 'Datasets related to your data about "' + adminQueryGeo + '"'
"SearchComponent.titleSearchAdminResult": 'Search in your data: ' + adminQueryGeo
},
{
"SearchComponent.communitiesTitleSearchAdminResult": 'Community resources related to your data about "' + adminQueryGeo + '"'
"SearchComponent.datasetsSearchAdminResult": function hasResults(result) {
return result.elementsByCssSelector('tr')
.then(function(rows) {
assert.equal(rows.length, 1, result);
});
}
},
{
"SearchComponent.reusesTitleSearchAdminResult": 'Reuses related to your data about "' + adminQueryGeo + '"'
},
{
"SearchComponent.issuesTitleSearchAdminResult": 'Issues related to your data about "' + adminQueryGeo + '"'
},
{
"SearchComponent.discussionsTitleSearchAdminResult": 'Discussions related to your data about "' + adminQueryGeo + '"'
"SearchComponent.reusesSearchAdminResult": function hasResults(result) {
return result.elementsByCssSelector('tr')
.then(function(rows) {
assert.equal(rows.length, 1, result);
});
}
},
SearchComponent.searchForAdmin(adminQueryCSV),
{
"SearchComponent.datasetsTitleSearchAdminResult": 'Datasets related to your data about "' + adminQueryCSV + '"'
},
{
"SearchComponent.communitiesTitleSearchAdminResult": 'Community resources related to your data about "' + adminQueryCSV + '"'
},
{
"SearchComponent.reusesTitleSearchAdminResult": 'Reuses related to your data about "' + adminQueryCSV + '"'
},
{
"SearchComponent.issuesTitleSearchAdminResult": 'Issues related to your data about "' + adminQueryCSV + '"'
},
{
"SearchComponent.discussionsTitleSearchAdminResult": 'Discussions related to your data about "' + adminQueryCSV + '"'
},
SearchComponent.searchForAdmin(adminQueryAccent),
{
"SearchComponent.datasetsTitleSearchAdminResult": 'Datasets related to your data about "' + adminQueryAccent + '"'
},
{
"SearchComponent.communitiesTitleSearchAdminResult": 'Community resources related to your data about "' + adminQueryAccent + '"'
},
{
"SearchComponent.reusesTitleSearchAdminResult": 'Reuses related to your data about "' + adminQueryAccent + '"'
},
{
"SearchComponent.issuesTitleSearchAdminResult": 'Issues related to your data about "' + adminQueryAccent + '"'
"SearchComponent.titleSearchAdminResult": 'Search in your data: ' + adminQueryCSV
},
{
"SearchComponent.discussionsTitleSearchAdminResult": 'Discussions related to your data about "' + adminQueryAccent + '"'
"SearchComponent.notFoundSearchAdminResult": 'No result found'
},
// Waiting for https://github.com/vuejs/vue-router/pull/391
// SearchComponent.searchForAdmin(adminQueryAccent),
// {
// "SearchComponent.titleSearchAdminResult": 'Search in your data: ' + adminQueryAccent
// },

// Logout.
NavigationComponent.homeFromAdmin(),
Expand Down
7 changes: 6 additions & 1 deletion specs/integration/CreateOrgComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ cropScreen: ".thumbnailer .crop-pane",
fill: function fill(name, description) {
return this.setTitleField(name)()
.then(this.setDescriptionField(description));
}
},
upload: function uploadFile(filePath) {
return this.openFileUploaderLink.then(function(fileField) {
return fileField.sendKeys(filePath);
})
},
6 changes: 6 additions & 0 deletions specs/integration/CreateResourceComponent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
title: "input#title",
openFileUploaderLink: '.resource-upload-dropzone input[type="file"]',
checksumInput: 'input#checksum',

upload: function uploadFile(filePath) {
return this.openFileUploaderLink.then(function(fileField) {
return fileField.sendKeys(filePath);
})
},
5 changes: 5 additions & 0 deletions specs/integration/CreateReuseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ fill: function fill(name, url, description) {
.then(this.setUrlField(url))
.then(this.setDescriptionField(description));
},
upload: function uploadFile(filePath) {
return this.openFileUploaderLink.then(function(fileField) {
return fileField.sendKeys(filePath);
})
},
9 changes: 4 additions & 5 deletions specs/integration/SearchComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ firstReuseResult: ".reuse-result:first-child .result-title",
firstOrgResult: ".organization-result:first-child .result-title",
firstUserResult: ".user-result:first-child .result-title",

datasetsTitleSearchAdminResult: "datasets .box-title",
communitiesTitleSearchAdminResult: "communities .box-title",
reusesTitleSearchAdminResult: "reuses .box-title",
issuesTitleSearchAdminResult: "issues .box-title",
discussionsTitleSearchAdminResult: "discussions .box-title",
titleSearchAdminResult: ".content-header h1",
datasetsSearchAdminResult: ".datasets-widget table tbody",
reusesSearchAdminResult: ".reuses-widget table tbody",
notFoundSearchAdminResult: ".content .row .lead",

searchFor: function searchFor(term) {
return this.setField(term)()
Expand Down
2 changes: 1 addition & 1 deletion specs/integration/SearchFixture.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
datasetQuery = 'base adresse'
datasetResult = "Base d'Adresses Nationale Ouverte - BANO"
datasetResult = "BAN - Base Adresse Nationale"
orgQuery = 'etalab'
orgResult = 'Etalab'
reuseQuery = 'geocheck'
Expand Down
Binary file added specs/integration/files/image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd5cb4e

Please sign in to comment.