Skip to content

Commit b024111

Browse files
Merge pull request #2305 from alphagov/build-the-enhanced-plugin-page
Build the enhanced plugin page
2 parents 218ca52 + f348335 commit b024111

18 files changed

Lines changed: 470 additions & 253 deletions

.github/workflows/test-acceptance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
name: Acceptance ${{ matrix.type }} test kit on Node v${{ matrix.node-version }} (${{ matrix.os }})
2121
runs-on: ${{ matrix.os }}
22-
timeout-minutes: 25
22+
timeout-minutes: 30
2323

2424
env:
2525
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Unreleased
44

5-
## New features
5+
### New features
66

7+
- [#2305: Build the enhanced plugin page](https://github.com/alphagov/govuk-prototype-kit/pull/2305)
78
- [#2314: Plugin validator allows the user to specify unknown keys](https://github.com/alphagov/govuk-prototype-kit/pull/2314)
89

910
## 13.12.2
Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const { restoreStarterFiles } = require('../../utils')
1+
const { restoreStarterFiles, log } = require('../../utils')
22
const path = require('path')
33
const {
44
loadTemplatesPage,
55
managePluginsPagePath,
6-
performPluginAction,
7-
loadPluginsPage
6+
performPluginAction
87
} = require('../plugin-utils')
98

109
const panelCompleteQuery = '[aria-live="polite"] #panel-complete'
@@ -16,14 +15,16 @@ const dependencyPlugin = 'govuk-frontend'
1615
const dependencyPluginName = 'GOV.UK Frontend'
1716

1817
describe('Install and uninstall Local Plugin via UI Test', async () => {
19-
after(restoreStarterFiles)
18+
afterEach(restoreStarterFiles)
2019

21-
it(`The ${dependentPlugin} plugin templates are not available`, () => {
20+
it(`The ${dependentPlugin} plugin will be installed`, () => {
21+
log(`The ${dependentPlugin} plugin templates are not available`)
2222
loadTemplatesPage()
2323
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('not.exist')
24-
})
2524

26-
it(`Install the ${dependentPlugin} plugin`, () => {
25+
// ------------------------
26+
27+
log(`Install the ${dependentPlugin} plugin`)
2728
cy.task('waitUntilAppRestarts')
2829
cy.visit(`${managePluginsPagePath}/install?package=${encodeURIComponent(dependentPlugin)}&version=${encodeURIComponent(dependentPluginLocation)}`)
2930
cy.get('#plugin-action-button').click()
@@ -32,16 +33,21 @@ describe('Install and uninstall Local Plugin via UI Test', async () => {
3233
.should('be.visible')
3334
cy.get('a').contains('Back to plugins').click()
3435

36+
cy.get('#installed-plugins-link').click()
37+
3538
cy.get(`[data-plugin-package-name="${dependentPlugin}"] button`).contains('Uninstall')
36-
})
3739

38-
it(`The ${dependentPlugin} plugin templates are available`, () => {
39-
loadTemplatesPage()
40+
// ------------------------
41+
42+
log(`The ${dependentPlugin} plugin templates are available`)
43+
cy.get('a').contains('Templates').click()
4044
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('exist')
41-
})
4245

43-
it('Uninstall the local plugin', () => {
44-
loadPluginsPage()
46+
// ------------------------
47+
48+
log('Uninstall the local plugin')
49+
cy.get('a').contains('Plugins').click()
50+
cy.get('#installed-plugins-link').click()
4551

4652
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`)
4753
.scrollIntoView()
@@ -50,54 +56,57 @@ describe('Install and uninstall Local Plugin via UI Test', async () => {
5056
.click()
5157

5258
performPluginAction('uninstall', dependentPlugin, dependentPluginName)
53-
})
5459

55-
it(`The ${dependentPlugin} plugin templates are not available`, () => {
56-
loadTemplatesPage()
60+
// ------------------------
61+
62+
log(`The ${dependentPlugin} plugin templates are not available`)
63+
cy.get('a').contains('Templates').click()
5764
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('not.exist')
5865
})
59-
})
60-
61-
describe('Install and uninstall Local Dependent Plugin via UI Test', async () => {
62-
after(restoreStarterFiles)
6366

64-
it(`The ${dependentPlugin} plugin templates are not available`, () => {
67+
it(`The ${dependentPlugin} plugin and ${dependencyPlugin} will be installed`, () => {
68+
log(`The ${dependentPlugin} plugin templates are not available`)
6569
loadTemplatesPage()
6670
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('not.exist')
67-
})
6871

69-
it(`Uninstall the ${dependencyPlugin} to force the UI to ask for it later`, () => {
72+
// ------------------------
73+
74+
log(`Uninstall the ${dependencyPlugin} to force the UI to ask for it later`)
7075
cy.task('waitUntilAppRestarts')
7176
cy.visit(`${managePluginsPagePath}/uninstall?package=${encodeURIComponent(dependencyPlugin)}`)
7277
cy.get('#plugin-action-button').click()
7378
performPluginAction('uninstall', dependencyPlugin, dependencyPluginName)
74-
})
7579

76-
it(`Install the ${dependentPlugin} plugin and the ${dependencyPlugin}`, () => {
80+
// ------------------------
81+
82+
log(`Install the ${dependentPlugin} plugin and the ${dependencyPlugin}`)
7783
cy.task('waitUntilAppRestarts')
7884
cy.visit(`${managePluginsPagePath}/install?package=${encodeURIComponent(dependentPlugin)}&version=${encodeURIComponent(dependentPluginLocation)}`)
7985
// Should list the dependency plugin
8086
cy.get('li').contains(dependencyPluginName)
8187
cy.get('#plugin-action-button').click()
8288
performPluginAction('install', dependentPlugin, dependentPluginName)
83-
})
8489

85-
it(`The ${dependentPlugin} plugin templates are available`, () => {
86-
loadTemplatesPage()
90+
// ------------------------
91+
92+
log(`The ${dependentPlugin} plugin templates are available`)
93+
cy.get('a').contains('Templates').click()
8794
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('exist')
88-
})
8995

90-
it('Uninstall the dependency plugin', () => {
96+
// ------------------------
97+
98+
log('Uninstall the dependency plugin')
9199
cy.task('waitUntilAppRestarts')
92100
cy.visit(`${managePluginsPagePath}/uninstall?package=${encodeURIComponent(dependencyPlugin)}`)
93101
// Should list the dependent plugin
94102
cy.get('li').contains(dependentPluginName)
95103
cy.get('#plugin-action-button').click()
96104
performPluginAction('uninstall', dependencyPlugin, dependencyPluginName)
97-
})
98105

99-
it(`The ${dependentPlugin} plugin templates are not available`, () => {
100-
loadTemplatesPage()
106+
// ------------------------
107+
108+
log(`The ${dependentPlugin} plugin templates are not available`)
109+
cy.get('a').contains('Templates').click()
101110
cy.get(`[data-plugin-package-name="${dependentPlugin}"]`).should('not.exist')
102111
})
103112
})

cypress/e2e/plugins/1-available-plugins-tests/available-plugins.cypress.js

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,66 @@
11
// local dependencies
2-
const { uninstallPlugin, restoreStarterFiles } = require('../../utils')
3-
const { managePluginsPagePath, loadTemplatesPage, loadPluginsPage } = require('../plugin-utils')
2+
const { uninstallPlugin, restoreStarterFiles, log } = require('../../utils')
3+
const {
4+
managePluginsPagePath,
5+
loadTemplatesPage,
6+
loadPluginsPage,
7+
manageTemplatesPagePath,
8+
manageInstalledPluginsPagePath
9+
} = require('../plugin-utils')
410

511
const panelCompleteQuery = '[aria-live="polite"] #panel-complete'
612

713
async function installPluginTests ({ plugin, templates, version }) {
814
describe(plugin, () => {
915
after(restoreStarterFiles)
1016

11-
it(`The ${plugin} plugin templates are not available`, () => {
17+
it(`The ${plugin} templates will be installed`, () => {
18+
log(`The ${plugin} plugin templates are not available`)
1219
uninstallPlugin(plugin)
1320
loadTemplatesPage()
1421
cy.get(`[data-plugin-package-name="${plugin}"]`).should('not.exist')
15-
})
1622

17-
it(`Install the ${plugin} plugin`, () => {
23+
// ------------------------
24+
25+
log(`Install the ${plugin} plugin`)
1826
if (version) {
1927
cy.task('waitUntilAppRestarts')
2028
cy.visit(`${managePluginsPagePath}/install?package=${encodeURIComponent(plugin)}&version=${version}`)
2129

2230
cy.get('#plugin-action-button').click()
2331
} else {
2432
loadPluginsPage()
25-
cy.task('log', `Install the ${plugin} plugin`)
33+
log(`Install the ${plugin} plugin`)
2634
cy.get(`[data-plugin-package-name="${plugin}"] button`).contains('Install').click()
2735
}
2836

2937
cy.get(panelCompleteQuery, { timeout: 20000 })
3038
.should('be.visible')
3139
cy.get('a').contains('Back to plugins').click()
3240

41+
cy.get('#installed-plugins-link').click()
3342
cy.get(`[data-plugin-package-name="${plugin}"] button`).contains('Uninstall')
34-
})
3543

36-
it(`The ${plugin} plugin templates are available`, () => {
37-
loadTemplatesPage()
44+
// ------------------------
45+
46+
log(`The ${plugin} plugin templates are available`)
47+
cy.get('a').contains('Templates').click()
3848
cy.get(`[data-plugin-package-name="${plugin}"]`).should('exist')
39-
})
4049

41-
templates.forEach(({ name, filename }) => {
42-
it(`View ${name} template`, () => {
43-
loadTemplatesPage()
50+
// ------------------------
51+
52+
templates.forEach(({ name, filename }) => {
53+
log(`View ${name} template`)
54+
cy.visit(manageTemplatesPagePath)
4455
cy.get(`[data-plugin-package-name="${plugin}"] a`).contains(`View ${name} page`).click()
4556
cy.url().then(url => expect(url).to.contain(filename))
4657
})
47-
})
4858

49-
it(`Uninstall the ${plugin} plugin`, () => {
50-
loadPluginsPage()
51-
cy.task('log', `Uninstall the ${plugin} plugin`)
59+
// ------------------------
60+
61+
log(`Uninstall the ${plugin} plugin`)
62+
cy.visit(manageInstalledPluginsPagePath)
63+
5264
cy.get(`[data-plugin-package-name="${plugin}"] button`).contains('Uninstall').click()
5365

5466
cy.get(panelCompleteQuery, { timeout: 20000 })

0 commit comments

Comments
 (0)