-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from 10up/upkeep/199
Migrate to Cypress 11
- Loading branch information
Showing
10 changed files
with
78 additions
and
80 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ on: | |
|
||
jobs: | ||
build: | ||
uses: 10up/autoshare-for-twitter/.github/workflows/build-release-zip.yml@try/release-e2e # TODO: Update this to develop branch. | ||
uses: 10up/autoshare-for-twitter/.github/workflows/build-release-zip.yml@develop | ||
|
||
cypress: | ||
needs: build | ||
|
@@ -61,10 +61,13 @@ jobs: | |
run: npm run env:start | ||
|
||
- name: Test | ||
run: | | ||
npm i -g [email protected] | ||
cypress run --config-file tests/cypress/config.json --env TWITTER_API_KEY=${{ secrets.TWITTER_API_KEY }},TWITTER_API_SECRET=${{ secrets.TWITTER_API_SECRET }},TWITTER_ACCESS_TOKEN=${{ secrets.TWITTER_ACCESS_TOKEN }},TWITTER_ACCESS_SECRET=${{ secrets.TWITTER_ACCESS_SECRET }} | ||
run: npm run cypress:run | ||
env: | ||
CYPRESS_TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | ||
CYPRESS_TWITTER_API_SECRET: ${{ secrets.TWITTER_API_SECRET }} | ||
CYPRESS_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | ||
CYPRESS_TWITTER_ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
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', | ||
}, | ||
}); | ||
|
||
/** | ||
* 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; | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.