-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allowing upgrade and update to be used interchangably in the URLs (to…
… support updating the kit).
- Loading branch information
1 parent
dde4af7
commit 066e60c
Showing
2 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
cypress/e2e/plugins/2-prototype-kit-plugin-tests/allow-upgrade-in-url.cypress.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { replaceInFile, waitForApplication, uninstallPlugin, log } = require('../../utils') | ||
const path = require('path') | ||
const { performPluginAction } = require('../plugin-utils') | ||
const plugin = '@govuk-prototype-kit/task-list' | ||
const pluginVersion = '1.1.1' | ||
const originalText = '"dependencies": {' | ||
const replacementText = `"dependencies": { "${plugin}": "${pluginVersion}",` | ||
const pkgJsonFile = path.join(Cypress.env('projectFolder'), 'package.json') | ||
|
||
function restore () { | ||
uninstallPlugin(plugin) | ||
} | ||
|
||
describe('Allow upgrade in URLs', () => { | ||
before(restore) | ||
after(restore) | ||
|
||
it('When updating the old upgrade URL should still work', () => { | ||
waitForApplication() | ||
|
||
log(`Add an old version of ${plugin} within the package.json`) | ||
replaceInFile(pkgJsonFile, originalText, '', replacementText) | ||
cy.exec(`cd ${Cypress.env('projectFolder')} && npm install`) | ||
|
||
log('Make sure old upgrade URL still works') | ||
cy.visit(`/manage-prototype/plugins/upgrade?package=${encodeURIComponent(plugin)}`) | ||
cy.get('button#plugin-action-button') | ||
.contains('Update') | ||
.click() | ||
|
||
log('Force the plugins to be installed with an npm install') | ||
performPluginAction('update', plugin, 'Task List') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters