-
Notifications
You must be signed in to change notification settings - Fork 8
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
Migrate to Cypress 10 #74
Changes from all commits
aee56a7
b23bfdb
f64c0c3
f755c20
37d5e62
8aa49ab
0166934
cb5551f
877fa42
2b02141
ad092d0
319f188
c2fb6bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { defineConfig } = require('cypress'); | ||
const { readConfig } = require('@wordpress/env/lib/config'); | ||
|
||
module.exports = defineConfig({ | ||
fixturesFolder: 'tests/cypress/fixtures', | ||
screenshotsFolder: 'tests/cypress/screenshots', | ||
videosFolder: 'tests/cypress/videos', | ||
downloadsFolder: 'tests/cypress/downloads', | ||
video: false, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
return setBaseUrl(on, config); | ||
}, | ||
specPattern: 'tests/cypress/e2e/**/*.test.{js,jsx,ts,tsx}', | ||
supportFile: 'tests/cypress/support/e2e.js', | ||
}, | ||
reporter: 'mochawesome', | ||
reporterOptions: { | ||
reportFilename: 'mochawesome-[name]', | ||
reportDir: 'tests/cypress/reports', | ||
overwrite: false, | ||
html: false, | ||
json: true, | ||
}, | ||
}); | ||
|
||
/** | ||
* Set WP URL as baseUrl in Cypress config. | ||
* | ||
* @param {Function} on function that used to register listeners on various events. | ||
* @param {object} config Cypress Config object. | ||
* @returns config Updated Cypress Config object. | ||
*/ | ||
const setBaseUrl = async (on, config) => { | ||
const wpEnvConfig = await readConfig('wp-env'); | ||
|
||
if (wpEnvConfig) { | ||
const port = wpEnvConfig.env.tests.port || null; | ||
|
||
if (port) { | ||
config.baseUrl = wpEnvConfig.env.tests.config.WP_SITEURL; | ||
} | ||
} | ||
|
||
return config; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,20 @@ describe('Command: createPost', () => { | |
title: postTitle, | ||
content: postContent, | ||
beforeSave: () => { | ||
cy.openDocumentSettingsPanel('Status & visibility'); | ||
// WP 6.1 renamed the panel name "Status & visibility" to "Summary". | ||
cy.openDocumentSettingsSidebar('Post'); | ||
cy.get('body').then($body => { | ||
let name = 'Status & visibility'; | ||
if ( | ||
$body.find( | ||
'.components-panel__body .components-panel__body-title button:contains("Summary")' | ||
).length > 0 | ||
) { | ||
name = 'Summary'; | ||
} | ||
cy.openDocumentSettingsPanel(name); | ||
}); | ||
Comment on lines
+88
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The selector for the component hasn't changed, ie it is Otherwise, maybe see if it's possible to catch the change in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peterwilsoncc the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think it is better to catch the change in |
||
|
||
cy.get('label') | ||
.contains('Stick to the top of the blog') | ||
.click() | ||
|
This file was deleted.
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.
Is it possible to use a custom script that allows the
--browser
parameter to be overridden when running the script?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.
@peterwilsoncc The
--browser
parameter was added here to the auto-select browser during the test, otherwise, we have to select the browser from UI during the run test in open mode.Also, we can use a script like this
npm run cypress:open -- --browser=firefox
to select the Firefox browser ornpm run cypress:open -- --browser=electron
for Electron.Should I remove the
--browser
parameter?