Skip to content

Commit

Permalink
improved acceptance tests. #280
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 3, 2020
1 parent 631e959 commit af72c5d
Show file tree
Hide file tree
Showing 41 changed files with 1,191 additions and 692 deletions.
2 changes: 1 addition & 1 deletion app/templates/components/bar-chart.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<h3 class="panel-title" id="{{chartId}}-title">
{{pluralize count label without-count=true}}
<span class="small pull-right">by year</span>
</h3>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/doi-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@

{{#if model}}
{{#each model as |doi|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-doi>
<DoiSummary @model={{doi}} @isList={{true}} />

<div class="panel-footer">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/donut-chart.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<h3 class="panel-title" id="{{chartId}}-title">
{{pluralize count label without-count=true}}
<span class="small pull-right">by resource type</span>
</h3>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/model-search.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
</div>
{{/if}}

<h3 class="member-results">{{format-number model.meta.total}} {{titleize (pluralize model.meta.total modelName without-count=true)}}</h3>
<h3 class="member-results" data-test-results>{{format-number model.meta.total}} {{titleize (pluralize model.meta.total modelName without-count=true)}}</h3>
{{/if}}
2 changes: 1 addition & 1 deletion app/templates/components/month-chart.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<h3 class="panel-title" id="{{chartId}}-title">
{{pluralize count label without-count=true}}
<span class="small pull-right">by month</span>
</h3>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/organization-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<div class="panel-body">
<div class="btn-toolbar">
<div class="btn-group btn-group-sm">
<button {{action "new"}} class="btn btn-warning">{{fa-icon "plus"}}Create Consortium Organization</button>
<button {{action "new"}} class="btn btn-warning" id="add-organization">{{fa-icon "plus"}}Add {{if media.isXl 'Consortium '}}Organization</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -284,7 +284,7 @@

{{#if model.organizations}}
{{#each model.organizations as |provider|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-organization>
<div class="panel-body">
<h3 class="work">
<LinkTo @route="providers.show" @model={{provider.id}}>{{provider.displayName}}</LinkTo>
Expand Down
8 changes: 4 additions & 4 deletions app/templates/components/provider-list.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#if new}}
<div class="panel panel-transparent">
<div class="panel-body">
<div class="col-md-9 col-md-offset-3"><h3 class="edit">Create Member</h3></div>
<div class="col-md-9 col-md-offset-3"><h3 class="edit">Add Member</h3></div>

<BsForm @formLayout="horizontal" @horizontalLabelGridClass="col-md-3" @model={{provider}} @onSubmit={{action "submit" provider model}} @submitOnEnter={{true}} as |form|>
<div class="col-md-12">
Expand Down Expand Up @@ -227,7 +227,7 @@
{{/if}}

<div class="col-md-9 col-md-offset-3">
<button type="submit" class="btn btn-sm btn-fill">Create Member</button>
<button type="submit" class="btn btn-sm btn-fill">Add Member</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
</BsForm>
Expand All @@ -240,7 +240,7 @@
<div class="panel-body">
<div class="btn-toolbar">
<div class="btn-group btn-group-sm">
<button {{action "new"}} class="btn btn-warning">{{fa-icon "plus"}}Create Member</button>
<button {{action "new"}} class="btn btn-warning" id="add-provider">{{fa-icon "plus"}} Add Member</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -443,7 +443,7 @@

{{#if model}}
{{#each model as |provider|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-provider>
<div class="panel-body">
<h3 class="work">
<LinkTo @route="providers.show" @model={{provider.id}}>{{provider.displayName}}</LinkTo>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/repository-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
{{/if}}
{{#if model.repositories}}
{{#each model.repositories as |repository|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-repository>
<div class="panel-body">
<h3 class="work">
<LinkTo @route="repositories.show" @model={{repository.id}}>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/user-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{{#if model}}
{{#each model as |user|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-user>
<div class="panel-body">
<h3 class="work">
<LinkTo @route="users.show" @model={{user.id}}>{{user.name}}</LinkTo>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/prefixes/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

{{#if model}}
{{#each model as |prefix|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-prefix>
<div class="panel-body">
<h3 class="member">{{prefix.id}}</h3>

Expand Down
8 changes: 3 additions & 5 deletions app/templates/providers/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@
<nav.item>
<nav.link-to @route="providers.show.repositories" model="model.id" class="nav-link">Repositories</nav.link-to>
</nav.item>
{{#if (not-eq model.memberType "consortium")}}
<nav.item>
<nav.link-to @route="providers.show.prefixes" model="model.id" class="nav-link">Prefixes</nav.link-to>
</nav.item>
{{/if}}
<nav.item>
<nav.link-to @route="providers.show.prefixes" model="model.id" class="nav-link">Prefixes</nav.link-to>
</nav.item>
<nav.item>
<nav.link-to @route="providers.show.dois" model="model.id" class="nav-link">DOIs</nav.link-to>
</nav.item>
Expand Down
5 changes: 2 additions & 3 deletions app/templates/providers/show/prefixes/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<div class="panel-body">
<div class="btn-toolbar">
<div class="btn-group btn-group-sm">
<LinkTo @route="providers.show.prefixes.new" @model={{model.provider.id}} class="btn btn-warning">{{fa-icon "link"}}Assign Prefix
</LinkTo>
<LinkTo @route="providers.show.prefixes.new" @model={{model.provider.id}} class="btn btn-warning" id="assign-prefix">{{fa-icon "link"}}Assign Prefix</LinkTo>
</div>
</div>
</div>
Expand Down Expand Up @@ -92,7 +91,7 @@

{{#if model.prefixes}}
{{#each model.prefixes as |providerPrefix|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-prefix>
<div class="panel-body">
<h3 class="work"><LinkTo @route="providers.show.prefixes.show" @models={{array model.provider.id providerPrefix.prefix.id}}>{{providerPrefix.prefix.id}}</LinkTo></h3>

Expand Down
2 changes: 1 addition & 1 deletion app/templates/repositories/show/prefixes/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

{{#if model.prefixes}}
{{#each model.prefixes as |repositoryPrefix|}}
<div class="panel panel-transparent">
<div class="panel panel-transparent" data-test-prefix>
<div class="panel-body">
{{#if (can "update prefix" model)}}
<h3 class="work"><LinkTo @route="repositories.show.prefixes.show" @models={{array model.repository.id repositoryPrefix.prefix.id}}>{{repositoryPrefix.prefix.id}}</LinkTo></h3>
Expand Down
28 changes: 0 additions & 28 deletions tests/acceptance/anonymous/admin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,4 @@ module('Acceptance | anonymous | admin', function(hooks) {
assert.equal(currentURL(), '/prefixes/10.5038');
assert.dom('div.alert-warning').includesText('The page was not found.');
});

test('visiting dois', async function(assert) {
await visit('/dois');

assert.equal(currentURL(), '/');
assert.dom('div.motto h1').hasText('DataCite Fabrica Test');
});

// test('visiting specific doi', async function(assert) {
// await visit('/dois/10.70048%2Fe605-dg05');

// assert.equal(currentURL(), '/dois/10.70048%2Fe605-dg05');
// assert.dom('h2.work').hasText('10.70048/e605-dg05');
// });

test('visiting users', async function(assert) {
await visit('/users');

assert.equal(currentURL(), '/');
assert.dom('div.motto h1').hasText('DataCite Fabrica Test');
});

test('visiting specific user', async function(assert) {
await visit('/users/0000-0003-1419-2405');

assert.equal(currentURL(), '/users/0000-0003-1419-2405');
assert.dom('h2.work').hasText('Martin Fenner');
});
});
21 changes: 21 additions & 0 deletions tests/acceptance/anonymous/doi-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { currentURL, visit } from '@ember/test-helpers';

module('Acceptance | anonymous | admin', function(hooks) {
setupApplicationTest(hooks);

test('visiting dois', async function(assert) {
await visit('/dois');

assert.equal(currentURL(), '/');
assert.dom('div.motto h1').hasText('DataCite Fabrica Test');
});

// test('visiting specific doi', async function(assert) {
// await visit('/dois/10.70048%2Fe605-dg05');

// assert.equal(currentURL(), '/dois/10.70048%2Fe605-dg05');
// assert.dom('h2.work').hasText('10.70048/e605-dg05');
// });
});
21 changes: 21 additions & 0 deletions tests/acceptance/anonymous/user-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { currentURL, visit } from '@ember/test-helpers';

module('Acceptance | anonymous | user', function(hooks) {
setupApplicationTest(hooks);

test('visiting users', async function(assert) {
await visit('/users');

assert.equal(currentURL(), '/');
assert.dom('div.motto h1').hasText('DataCite Fabrica Test');
});

test('visiting specific user', async function(assert) {
await visit('/users/0000-0003-1419-2405');

assert.equal(currentURL(), '/users/0000-0003-1419-2405');
assert.dom('h2.work').hasText('Martin Fenner');
});
});
35 changes: 0 additions & 35 deletions tests/acceptance/client_admin/admin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,4 @@ module('Acceptance | client_admin | admin', function(hooks) {
assert.equal(currentURL(), '/repositories/tib.awi');
assert.dom('h2.work').hasText('Alfred Wegener Institute');
});

test('visiting dois', async function(assert) {
await visit('/dois');

assert.equal(currentURL(), '/repositories/tib.awi');
assert.dom('h2.work').hasText('Alfred Wegener Institute');
});

// test('visiting specific doi', async function(assert) {
// await authenticateSession({
// uid: 'tib.awi',
// name: 'Alfred Wegener Institute',
// role_id: 'client_admin',
// provider_id: 'tib',
// client_id: 'tib.awi',
// });
// await visit('/dois/10.70048%2Fe605-dg05');

// assert.equal(currentURL(), '/dois/10.70048%2Fe605-dg05');
// assert.dom('h2.work').hasText('10.70048/e605-dg05');
// });

test('visiting users', async function(assert) {
await visit('/users');

assert.equal(currentURL(), '/repositories/tib.awi');
assert.dom('h2.work').hasText('Alfred Wegener Institute');
});

test('visiting specific user', async function(assert) {
await visit('/users/0000-0003-1419-2405');

assert.equal(currentURL(), '/users/0000-0003-1419-2405');
assert.dom('h2.work').hasText('Martin Fenner');
});
});
Loading

0 comments on commit af72c5d

Please sign in to comment.