Skip to content

Commit

Permalink
Merge pull request #1431 from SUI-Components/update-to-cypress-10
Browse files Browse the repository at this point in the history
chore(packages/sui-test-e2e): Update Cypress to version 10.2.0
  • Loading branch information
oegea committed Jun 23, 2022
2 parents 1e3996a + 90e0556 commit dcf51e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions packages/sui-test-e2e/bin/sui-test-e2e.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint no-console:0 */

import {existsSync} from 'fs'
import {existsSync, writeFileSync} from 'fs'
import {createRequire} from 'module'
import {join} from 'path'

Expand All @@ -18,14 +18,17 @@ const DEFAULT_USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 Chrome/65.0.3325.146 Safari/537.36'
const DEFAULT_CYPRESS_CONFIG = {
fixturesFolder: false,
pluginsFile: false,
supportFile: false,
e2e: {},
trashAssetsBeforeRuns: true,
videoUploadOnPasses: false,
viewportWidth: 1240,
viewportHeight: 960
}

const DEFAULT_CYPRESS_CONFIG_FILE_CONTENT = `module.exports = {
e2e: {}
};`

const HELP_MESSAGE = `
Description:
Run end-to-end tests with Cypress
Expand Down Expand Up @@ -113,9 +116,12 @@ const {
viewportWidth
} = program.opts()

// Since Cypress 10, integrationFolder param becomes a file pattern
const scopePattern = `${scope}/**/*.js`

const cypressConfig = {
...DEFAULT_CYPRESS_CONFIG,
integrationFolder: join(TESTS_FOLDER, scope || ''),
specPattern: join(TESTS_FOLDER, scopePattern || ''),
baseUrl,
fixturesFolder: join(TESTS_FOLDER, 'fixtures'),
video,
Expand All @@ -130,11 +136,11 @@ if (defaultCommandTimeout) {
}

if (existsSync(supportFilesFolderPath)) {
cypressConfig.supportFile = supportFilesFolderPath
cypressConfig.e2e.supportFile = `${supportFilesFolderPath}/index.js`
}

if (existsSync(pluginsFilesFolderPath)) {
cypressConfig.pluginsFile = pluginsFilesFolderPath
cypressConfig.e2e.pluginsFile = `${pluginsFilesFolderPath}/index.js`
}

if (userAgent) {
Expand Down Expand Up @@ -163,9 +169,15 @@ if (ci) {

if (noWebSecurity) cypressConfig.chromeWebSecurity = false

const configFilePath = join(TESTS_FOLDER, 'cypress.config.js')

if (!existsSync(configFilePath)) {
writeFileSync(configFilePath, DEFAULT_CYPRESS_CONFIG_FILE_CONTENT)
}

const cypressExecutableConfig = {
config: cypressConfig,
configFile: false,
configFile: configFilePath,
key,
group,
browser,
Expand Down
2 changes: 1 addition & 1 deletion packages/sui-test-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@testing-library/cypress": "8.0.2",
"colors": "1.4.0",
"commander": "8.3.0",
"cypress": "8.7.0",
"cypress": "10.2.0",
"cypress-file-upload": "5.0.8"
},
"keywords": [],
Expand Down

0 comments on commit dcf51e7

Please sign in to comment.