refactors acceptance login into helper function. adds acceptance tests for tabbed dataset routes

This commit is contained in:
Seyi Adebajo 2018-02-09 10:49:35 -08:00
parent ca7ef2136d
commit c90ff310f7
7 changed files with 134 additions and 11 deletions

View File

@ -0,0 +1,23 @@
import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/comments', {
async beforeEach() {
appLogin();
}
});
test('visiting /datasets/dataset/comments', async function(assert) {
assert.expect(2);
defaultScenario(server);
const url = '/datasets/12345/comments';
await visit(url);
assert.equal(currentURL(), url, 'comments route is visitable');
await waitUntil(() => find('.ivy-tabs-tab'));
assert.equal(find('.ivy-tabs-tab.active').textContent.trim(), 'Comments', 'comments tab is selected');
});

View File

@ -0,0 +1,23 @@
import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/ownership', {
async beforeEach() {
appLogin();
}
});
test('visiting /datasets/dataset/ownership', async function(assert) {
assert.expect(2);
defaultScenario(server);
const url = '/datasets/12345/ownership';
await visit(url);
assert.equal(currentURL(), url, 'ownership route is visitable');
await waitUntil(() => find('.ivy-tabs-tab'));
assert.equal(find('.ivy-tabs-tab.active').textContent.trim(), 'Ownership', 'ownership tab is selected');
});

View File

@ -1,20 +1,12 @@
import { test } from 'qunit'; import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance'; import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import { visit, click, find, fillIn, currentURL, waitUntil } from 'ember-native-dom-helpers';
import { authenticationUrl, testUser, testPassword } from 'wherehows-web/tests/helpers/login/constants';
import {
loginUserInput,
loginPasswordInput,
loginSubmitButton
} from 'wherehows-web/tests/helpers/login/page-element-constants';
import defaultScenario from 'wherehows-web/mirage/scenarios/default'; import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/properties', { moduleForAcceptance('Acceptance | datasets/dataset/properties', {
async beforeEach() { async beforeEach() {
await visit(authenticationUrl); appLogin();
await fillIn(loginUserInput, testUser);
await fillIn(loginPasswordInput, testPassword);
await click(loginSubmitButton);
} }
}); });

View File

@ -0,0 +1,23 @@
import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/relations', {
async beforeEach() {
appLogin();
}
});
test('visiting /datasets/dataset/relations', async function(assert) {
assert.expect(2);
defaultScenario(server);
const url = '/datasets/12345/relations';
await visit(url);
assert.equal(currentURL(), url, 'relations route is visitable');
await waitUntil(() => find('.ivy-tabs-tab'));
assert.equal(find('.ivy-tabs-tab.active').textContent.trim(), 'Relations', 'relations tab is selected');
});

View File

@ -0,0 +1,23 @@
import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/sample', {
async beforeEach() {
appLogin();
}
});
test('visiting /datasets/dataset/sample', async function(assert) {
assert.expect(2);
defaultScenario(server);
const url = '/datasets/12345/sample';
await visit(url);
assert.equal(currentURL(), url, 'sample route is visitable');
await waitUntil(() => find('.ivy-tabs-tab'));
assert.equal(find('.ivy-tabs-tab.active').textContent.trim(), 'Sample Data', 'sample tab is selected');
});

View File

@ -0,0 +1,23 @@
import { test } from 'qunit';
import moduleForAcceptance from 'wherehows-web/tests/helpers/module-for-acceptance';
import { visit, find, currentURL, waitUntil } from 'ember-native-dom-helpers';
import defaultScenario from 'wherehows-web/mirage/scenarios/default';
import appLogin from 'wherehows-web/tests/helpers/login/test-login';
moduleForAcceptance('Acceptance | datasets/dataset/schema', {
async beforeEach() {
appLogin();
}
});
test('visiting /datasets/dataset/schema', async function(assert) {
assert.expect(2);
defaultScenario(server);
const url = '/datasets/12345/schema';
await visit(url);
assert.equal(currentURL(), url, 'schema route is visitable');
await waitUntil(() => find('.ivy-tabs-tab'));
assert.equal(find('.ivy-tabs-tab.active').textContent.trim(), 'Schema', 'schema tab is selected');
});

View File

@ -0,0 +1,16 @@
import { visit, click, fillIn } from 'ember-native-dom-helpers';
import { authenticationUrl, testUser, testPassword } from 'wherehows-web/tests/helpers/login/constants';
import {
loginUserInput,
loginPasswordInput,
loginSubmitButton
} from 'wherehows-web/tests/helpers/login/page-element-constants';
const appLogin = async () => {
await visit(authenticationUrl);
await fillIn(loginUserInput, testUser);
await fillIn(loginPasswordInput, testPassword);
await click(loginSubmitButton);
};
export default appLogin;