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

Added percy integration #143

Merged
merged 9 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"ember-metrics": "^0.13.0",
"ember-moment": "^7.6.0",
"ember-pad": "1.2.3",
"ember-percy": "^1.5.0",
"ember-power-select": "^2.2.1",
"ember-power-select-typeahead": "^0.7.3",
"ember-qunit": "^3.4.1",
Expand Down
29 changes: 26 additions & 3 deletions tests/acceptance/addons-test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { click, currentRouteName, currentURL, visit, findAll } from '@ember/test-helpers';
import { enableFeature } from 'ember-feature-flags/test-support';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import visitAddon from '../helpers/visit-addon';
import { enableFeature } from 'ember-feature-flags/test-support';
import moment from 'moment';
import visitAddon from '../helpers/visit-addon';

module('Acceptance: Addons', function(hooks) {
setupEmberObserverTest(hooks);

test('addon not found', async function(assert) {
await visit('/addons/what');

await percySnapshot('/model-not-found');

assert.equal(currentURL(), '/model-not-found');
assert.dom('.test-not-found').hasText("Oops! We can't find what you were looking for. Try searching above?");
});
Expand Down Expand Up @@ -110,6 +114,8 @@ module('Acceptance: Addons', function(hooks) {

await click('.info-action');

await percySnapshot('/addons/show | with github data');

assert.dom('.test-github-data').containsText('TOP 10% STARRED');
assert.dom('.test-open-issues').containsText('13');
assert.dom('.test-open-issues').containsText('Open Issues');
Expand Down Expand Up @@ -198,6 +204,8 @@ module('Acceptance: Addons', function(hooks) {

await click('.info-action');

await percySnapshot('/addons/show | with review');

let questions = findAll('.test-review-question');
assert.dom(questions[0]).hasText('Are there meaningful tests? Yes');
assert.dom(questions[1]).hasText('Is the README filled out? Unknown');
Expand Down Expand Up @@ -288,7 +296,6 @@ module('Acceptance: Addons', function(hooks) {

assert.dom('.test-addon-badge img[src="/badges/test-addon.svg"]').exists();
assert.dom('.test-addon-badge .test-show-badge-markdown .icon-content-paste').exists('Show badge markdown to copy');
assert.dom('.test-addon-correction-link[href*="/addons/test-addon/correct"]').exists('Suggest a correction');

await click('.test-addon-badge .test-show-badge-markdown');
assert.dom('.test-addon-badge .test-badge-markdown').hasText('[![Ember Observer Score](https://emberobserver.com/badges/test-addon.svg)](https://emberobserver.com/addons/test-addon)');
Expand Down Expand Up @@ -390,6 +397,20 @@ module('Acceptance: Addons', function(hooks) {
assert.dom('.test-dev-dependencies').doesNotExist();
});

test('has a link for users to provide suggestions', async function(assert) {
let addon = server.create('addon', {
name: 'test-addon',
});

await visitAddon(addon);

await click('.test-addon-correction-link');

await percySnapshot('/addons/correct');

assert.equal(currentURL(), '/addons/test-addon/correct', 'suggest a correction link works');
});

module('Scoped addons', function(hooks) {
hooks.beforeEach(function() {
this.addon = server.create('addon', {
Expand All @@ -399,11 +420,13 @@ module('Acceptance: Addons', function(hooks) {

test('can view a scoped addon with a / in the URL', async function(assert) {
await visit('/addons/@foo-bar/test-addon');

assert.equal(currentRouteName(), 'addons.show');
});

test('can view a scoped addon with / encoded in the URL', async function(assert) {
await visit('/addons/@foo-bar%2Ftest-addon');

assert.equal(currentRouteName(), 'addons.show');
});

Expand Down
15 changes: 9 additions & 6 deletions tests/acceptance/admin-review-addon-test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { module, test } from 'qunit';
import {
visit,
currentURL,
click,
currentURL,
fillIn,
findAll,
visit,
} from '@ember/test-helpers';
import Mirage from 'ember-cli-mirage';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { selectChoose } from 'ember-power-select/test-support/helpers';
import moment from 'moment';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import login from 'ember-observer/tests/helpers/login';
import findByText from '../helpers/find-by-text';
import login from 'ember-observer/tests/helpers/login';
import Mirage from 'ember-cli-mirage';
import moment from 'moment';

let windowAlert;

Expand Down Expand Up @@ -88,6 +89,8 @@ module('Acceptance | admin review addon', function(hooks) {

await visitAddon(addon);

await percySnapshot('/admin/review/addon');

assert.dom('.test-addon-link').includesText('fake-addon');
assert.dom('.test-description').includesText('Foo bar baz');
assert.dom('.test-last-updated').hasText('1.1.3 from a day ago');
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/admin-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { click, fillIn, currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';

module('Acceptance: admin', function(hooks) {
Expand All @@ -24,10 +25,16 @@ module('Acceptance: admin', function(hooks) {
});

await visit('/login');

await percySnapshot('/login');

await fillIn('.test-email', '[email protected]');
await fillIn('.test-password', 'password123');
await click('.test-log-in');
await visit('/admin');

await percySnapshot('/admin/index');

assert.equal(currentURL(), '/admin', 'Does not redirect');
});
});
Expand Down
7 changes: 5 additions & 2 deletions tests/acceptance/build-results-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { findAll, click, currentURL, currentRouteName, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import findByText from '../helpers/find-by-text';
import moment from 'moment';
import login from 'ember-observer/tests/helpers/login';
import moment from 'moment';

module('Acceptance | build results', function(hooks) {
setupEmberObserverTest(hooks);
Expand Down Expand Up @@ -144,7 +145,9 @@ module('Acceptance | build results', function(hooks) {
await login();
await visit('/admin/build-results');
await click(findByText('.test-build-result a', 'details'));


await percySnapshot('/admin/build-results');

assert.equal(currentURL(), `/admin/build-results/${testResult.id}`);
});

Expand Down
27 changes: 27 additions & 0 deletions tests/acceptance/canary-test-results-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { currentRouteName, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import moment from 'moment';

module('Acceptance | canary test results', function(hooks) {
setupEmberObserverTest(hooks);

test('redirects to current day', async function(assert) {
let addon = server.create('addon');

let addonVersion = server.create('version', { addonId: addon.id });

server.create('testResult', {
versionId: addonVersion.id,
canary: true,
createdAt: moment('2016-08-07 16:30').utc()
});

await visit('/canary-test-results');

await percySnapshot('/canary-test-results/date');

assert.equal(currentRouteName(), 'canary-test-results.date', 'transitions to canary test results date route');
});
});
3 changes: 3 additions & 0 deletions tests/acceptance/code-search-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { click, fillIn, findAll, currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import findByText from '../helpers/find-by-text';

Expand Down Expand Up @@ -177,6 +178,8 @@ module('Acceptance | code search', function(hooks) {

await click(usageSortButton);

await percySnapshot('/code-search');

let resortedAddonNames = findAll('.test-addon-name');
assert.dom(resortedAddonNames[0]).containsText('ember-foo', 'Addons are sorted descending by default for switch to usage count sort');
assert.dom(resortedAddonNames[1]).containsText('ember-blanket', 'Addons are sorted descending by usage count');
Expand Down
20 changes: 20 additions & 0 deletions tests/acceptance/index-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { click, fillIn, find, findAll, currentURL, currentRouteName, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import findByText from '../helpers/find-by-text';

Expand Down Expand Up @@ -32,6 +33,8 @@ module('Acceptance: Index', function(hooks) {

await visit('/');

await percySnapshot('/index');

assert.dom('.test-category').exists({ count: 8 }, 'All categories should display');
assert.ok(findByText('.test-category', 'Authentication (5)'), 'Categories should list title and count of addons');
let firstSubcategory = findAll('.test-subcategory')[0];
Expand All @@ -49,6 +52,8 @@ module('Acceptance: Index', function(hooks) {
let simpleAuth = findByText('a', 'Simple Auth (1)');
await click(simpleAuth);

await percySnapshot('/categories/show');

assert.equal(currentURL(), '/categories/simple-auth', 'URL should use category name token');
assert.dom('.test-category-header').containsText('Simple Auth', 'Header should display');
assert.dom('.test-category-description').containsText('Simple Auth addons', 'Description should display');
Expand Down Expand Up @@ -163,9 +168,24 @@ module('Acceptance: Index', function(hooks) {
test('Unknown routes are handled', async function(assert) {
await visit('/bullshit');

await percySnapshot('not-found');

assert.equal(currentRouteName(), 'not-found');
});

test('provides a link to the top addons', async function(assert) {
server.create('addon', { name: 'ember-a-thing' });
server.create('addon', { name: 'ember-test-me', description: 'A thin addon' });

await visit(`/?query=test`);

await click(findByText('.top-addons a', 'See all top 100 addons'));

await percySnapshot('/lists/top-addons');

assert.equal(currentURL(), '/lists/top-addons', 'link to top addons works');
});

function testSearch(url, assertForContentOnUrl) {
test(`visiting ${url} with a query`, async function(assert) {
server.create('addon', { name: 'ember-a-thing' });
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/maintainers-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { currentRouteName, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';

module('Acceptance: Maintainers', function(hooks) {
Expand All @@ -10,6 +11,8 @@ module('Acceptance: Maintainers', function(hooks) {

await visit('/maintainers/maintainer-0');

await percySnapshot('/maintainers/show');

assert.equal(currentRouteName(), 'maintainers.show');
});

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/managing-build-servers-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { click, fillIn, currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { percySnapshot } from 'ember-percy';
import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test';
import login from '../helpers/login';
import findByText from '../helpers/find-by-text'
import login from '../helpers/login';

module('Acceptance | managing build servers', function(hooks) {
setupEmberObserverTest(hooks);
Expand All @@ -19,6 +20,8 @@ module('Acceptance | managing build servers', function(hooks) {
await login();
await visit('/admin/build-servers');

await percySnapshot('/admin/build-servers');

assert.dom('.test-build-server-row').exists({ count: 15 });
});

Expand Down
Loading