diff --git a/ghost/admin/app/controllers/settings/apps/index.js b/ghost/admin/app/controllers/settings/apps/index.js new file mode 100644 index 0000000000..ec571b4561 --- /dev/null +++ b/ghost/admin/app/controllers/settings/apps/index.js @@ -0,0 +1,6 @@ +import Controller from '@ember/controller'; +import {inject as injectService} from '@ember/service'; + +export default Controller.extend({ + settings: injectService() +}); diff --git a/ghost/admin/app/templates/settings/apps/index.hbs b/ghost/admin/app/templates/settings/apps/index.hbs index fa7ff20871..5c5c56099b 100644 --- a/ghost/admin/app/templates/settings/apps/index.hbs +++ b/ghost/admin/app/templates/settings/apps/index.hbs @@ -6,8 +6,8 @@
Available integrations
-
- {{#link-to "settings.apps.slack" id="slack-link"}} +
+ {{#link-to "settings.apps.slack" data-test-link="slack"}}
@@ -18,10 +18,10 @@
- {{#if slack.isActive}} - Active + {{#if settings.slack.isActive}} + Active {{else}} - Configure + Configure {{/if}} {{inline-svg "arrow-right"}}
@@ -30,8 +30,8 @@ {{/link-to}}
-
- {{#link-to "settings.apps.amp" id="amp-link"}} +
+ {{#link-to "settings.apps.amp" data-test-link="amp"}}
@@ -42,10 +42,10 @@
- {{#if amp}} - Active + {{#if settings.amp}} + Active {{else}} - Configure + Configure {{/if}} {{inline-svg "arrow-right"}}
@@ -54,8 +54,8 @@ {{/link-to}}
-
- {{#link-to "settings.apps.unsplash" id="unsplash-link"}} +
+ {{#link-to "settings.apps.unsplash" data-test-link="unsplash"}}
@@ -66,10 +66,10 @@
- {{#if unsplash.isActive}} - Active + {{#if settings.unsplash.isActive}} + Active {{else}} - Configure + Configure {{/if}} {{inline-svg "arrow-right"}}
diff --git a/ghost/admin/tests/acceptance/settings/apps-test.js b/ghost/admin/tests/acceptance/settings/apps-test.js index e6fc46abe8..09c9dea1ac 100644 --- a/ghost/admin/tests/acceptance/settings/apps-test.js +++ b/ghost/admin/tests/acceptance/settings/apps-test.js @@ -56,35 +56,53 @@ describe('Acceptance: Settings - Apps', function () { return authenticateSession(application); }); + it('renders correctly', async function () { + await visit('/settings/apps'); + + // slack is not configured in the fixtures + expect( + find('[data-test-app="slack"] [data-test-app-status]').text().trim(), + 'slack app status' + ).to.equal('Configure'); + + // amp is enabled in the fixtures + expect( + find('[data-test-app="amp"] [data-test-app-status]').text().trim(), + 'amp app status' + ).to.equal('Active'); + }); + it('it redirects to Slack when clicking on the grid', async function () { await visit('/settings/apps'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps'); - await click('#slack-link'); + await click('[data-test-link="slack"]'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps/slack'); }); + it('it redirects to AMP when clicking on the grid', async function () { await visit('/settings/apps'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps'); - await click('#amp-link'); + await click('[data-test-link="amp"]'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps/amp'); }); + it('it redirects to Unsplash when clicking on the grid', async function () { await visit('/settings/apps'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps'); - await click('#unsplash-link'); + await click('[data-test-link="unsplash"]'); // has correct url expect(currentURL(), 'currentURL').to.equal('/settings/apps/unsplash');