-
Notifications
You must be signed in to change notification settings - Fork 237
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
Cypress test for service name #1453
Conversation
27e5e0b
to
1cdcf79
Compare
8b18a63
to
2015034
Compare
cypress/plugins/index.js
Outdated
try { | ||
const content = fs.readFileSync(filename).toString() | ||
fs.writeFileSync(filename, content.replace(originalText, newText)) | ||
return Promise.resolve(null) | ||
} catch (err) { | ||
return Promise.reject(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're writing an async function is there any reason not to use the fs.promises
methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed this to use fs.promises but had to still return Promise.resolve(null) so that cypress was happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this back to draft while I wait for the PR to use fs.promises is merged into main. I'll then rebase this on to main and amend this test to match.
30e26f8
to
382ce38
Compare
750e072
to
83795b7
Compare
cypress/plugins/index.js
Outdated
@@ -50,6 +51,8 @@ module.exports = (on, config) => { | |||
|
|||
const waitUntilAppRestarts = async (timeout) => await waitOn({ delay: 2000, resources: [config.baseUrl], timeout }) | |||
|
|||
const makeSureCypressCanInterpretTheResult = () => null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I commented here https://github.com/alphagov/govuk-prototype-kit/pull/1454/files#r915009116
I think it's worth passing through any non-undefined result unless you're sure it makes no difference.
Also, should this function be centralised in test helpers somewhere?
If I'm overcomplicating it I'm happy with it as-is and we can update if it causes a problem.
83795b7
to
b9a6b95
Compare
39a81ce
to
20e06e1
Compare
Cypress test to detect the service name change in the app config