mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
683dbaa376
refs TryGhost/Ghost#7769 - adds Google AMP to `apps` in order to disable and enable it on request.
97 lines
2.8 KiB
JavaScript
97 lines
2.8 KiB
JavaScript
/* jshint expr:true */
|
|
import {
|
|
describe,
|
|
it,
|
|
beforeEach,
|
|
afterEach
|
|
} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import startApp from '../../helpers/start-app';
|
|
import destroyApp from '../../helpers/destroy-app';
|
|
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
|
|
|
describe('Acceptance: Settings - Apps', function () {
|
|
let application;
|
|
|
|
beforeEach(function () {
|
|
application = startApp();
|
|
});
|
|
|
|
afterEach(function () {
|
|
destroyApp(application);
|
|
});
|
|
|
|
it('redirects to signin when not authenticated', function () {
|
|
invalidateSession(application);
|
|
visit('/settings/apps');
|
|
|
|
andThen(function () {
|
|
expect(currentURL(), 'currentURL').to.equal('/signin');
|
|
});
|
|
});
|
|
|
|
it('redirects to team page when authenticated as author', function () {
|
|
let role = server.create('role', {name: 'Author'});
|
|
server.create('user', {roles: [role], slug: 'test-user'});
|
|
|
|
authenticateSession(application);
|
|
visit('/settings/apps');
|
|
|
|
andThen(() => {
|
|
expect(currentURL(), 'currentURL').to.equal('/team/test-user');
|
|
});
|
|
});
|
|
|
|
it('redirects to team page when authenticated as editor', function () {
|
|
let role = server.create('role', {name: 'Editor'});
|
|
server.create('user', {roles: [role], slug: 'test-user'});
|
|
|
|
authenticateSession(application);
|
|
visit('/settings/apps');
|
|
|
|
andThen(() => {
|
|
expect(currentURL(), 'currentURL').to.equal('/team');
|
|
});
|
|
});
|
|
|
|
describe('when logged in', function () {
|
|
beforeEach(function () {
|
|
let role = server.create('role', {name: 'Administrator'});
|
|
server.create('user', {roles: [role]});
|
|
|
|
return authenticateSession(application);
|
|
});
|
|
|
|
it('it redirects to Slack when clicking on the grid', function () {
|
|
visit('/settings/apps');
|
|
|
|
andThen(() => {
|
|
// has correct url
|
|
expect(currentURL(), 'currentURL').to.equal('/settings/apps');
|
|
});
|
|
|
|
click('#slack-link');
|
|
|
|
andThen(() => {
|
|
// has correct url
|
|
expect(currentURL(), 'currentURL').to.equal('/settings/apps/slack');
|
|
});
|
|
});
|
|
it('it redirects to AMP when clicking on the grid', function () {
|
|
visit('/settings/apps');
|
|
|
|
andThen(() => {
|
|
// has correct url
|
|
expect(currentURL(), 'currentURL').to.equal('/settings/apps');
|
|
});
|
|
|
|
click('#amp-link');
|
|
|
|
andThen(() => {
|
|
// has correct url
|
|
expect(currentURL(), 'currentURL').to.equal('/settings/apps/amp');
|
|
});
|
|
});
|
|
});
|
|
});
|