@isaac.frontend/testcafe-scaffolding
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,0 +0,0 @@ { |
@@ -12,3 +12,5 @@ #!/usr/bin/env node | ||
const util = require('util') | ||
const yarnOrNpm = require('yarn-or-npm') | ||
const hasYarn = yarnOrNpm() === 'yarn' | ||
const pkg = path.resolve('package.json') | ||
@@ -41,3 +43,3 @@ // eslint-disable-next-line import/no-dynamic-require | ||
*/ | ||
const createPageModels = ({ testSuitePath, isInstallExampleTests }) => { | ||
const createPageModels = ({ testSuitePath, isInstallExampleTests, isInstallDSLExample }) => { | ||
const paths = ['dsl', 'tests', 'page-models'] | ||
@@ -52,6 +54,8 @@ | ||
} | ||
fs.mkdirSync(dstPath) | ||
if (subDirectory !== 'dsl' | ||
|| (subDirectory === 'dsl' && isInstallDSLExample)) fs.mkdirSync(dstPath) | ||
// add .gitkeep files to the directories when no example tests are chosen | ||
if (!isInstallExampleTests) { | ||
if (!isInstallExampleTests && subDirectory !== 'dsl') { | ||
fs.closeSync(fs.openSync(path.join(dstPath, '.gitkeep'), 'w')) | ||
@@ -61,3 +65,5 @@ } | ||
// Copy example data: | ||
if (isInstallExampleTests) { | ||
if (isInstallExampleTests | ||
&& (subDirectory !== 'dsl' | ||
|| (subDirectory === 'dsl' && isInstallDSLExample))) { | ||
const sourcePath = path.join(__dirname, '..', 'examples', subDirectory) | ||
@@ -142,3 +148,3 @@ fs.readdirSync(`${sourcePath}`).forEach((file) => { | ||
}) => { | ||
console.log(['', 'Updating package.json and installing packages...', ''].join('\n').gray) | ||
console.log(['', 'Updating package.json...', ''].join('\n').gray) | ||
@@ -151,3 +157,3 @@ const packages = [ | ||
const npmAddScript = (script) => { | ||
const addScriptToPkgJson = (script) => { | ||
// eslint-disable-next-line import/no-dynamic-require, global-require | ||
@@ -171,3 +177,3 @@ const currentPkgObject = require(pkg) | ||
npmAddScript({ | ||
addScriptToPkgJson({ | ||
key: 'test:e2e', | ||
@@ -177,10 +183,20 @@ value: `node ${testSuitePath}/runner.js`, | ||
await exec(`npm install --save-dev --force ${packages}`) | ||
console.log(['', 'installing packages...', ''].join('\n').gray) | ||
if (hasYarn) { | ||
await exec(`yarn add -D ${packages}`) | ||
} else { | ||
await exec(`npm install -D --force ${packages}`) | ||
} | ||
console.log(['', 'package.json updated and new dependencies installed.', ''].join('\n').green) | ||
} | ||
const removeQaTools = async () => { | ||
await exec('npm rm @isaac.frontend/testcafe-scaffolding', { verbose: false }) | ||
console.log('Removed @isaac.frontend/testcafe-scaffolding depedency'.green) | ||
const removeScaffoldingPkg = async () => { | ||
if (hasYarn) { | ||
await exec('yarn remove @isaac.frontend/testcafe-scaffolding', { verbose: false }) | ||
} else { | ||
await exec('npm rm @isaac.frontend/testcafe-scaffolding', { verbose: false }) | ||
} | ||
console.log('Removed @isaac.frontend/testcafe-scaffolding dependency'.green) | ||
} | ||
@@ -212,3 +228,3 @@ | ||
if (!fs.existsSync(pkg)) { | ||
console.error('No package.json found. Please run this command in the root of your project or run "npm init"!'.bgRed.white.bold) | ||
console.error('No package.json found. Please run this command in the root of your project or run "npm init" / "yarn init"!'.bgRed.white.bold) | ||
process.exit(1) | ||
@@ -220,9 +236,13 @@ } | ||
}) | ||
// Always use forward slashes as it will be running in npm scripts | ||
// Always use forward slashes as it will be running in package.json scripts | ||
.replace(/\\/, '/').replace(/^\/|\/$/, '') | ||
const isInstallExampleTests = readlineSync.keyInYN('Install example tests?') | ||
const isInstallDSLExample = isInstallExampleTests | ||
? readlineSync.keyInYN('Install Domain Specific Language (DSL) folder? https://github.com/isaaceindhoven/testcafe-scaffolding/blob/master/docs/writing-the-testsuite.md') | ||
: false | ||
const isInstallAllureReporting = readlineSync.keyInYN('Install Allure reporting?') | ||
const isInstallBrowserstack = readlineSync.keyInYN('Install BrowserStack integration?') | ||
const isRemovingIsaacQaTestcafe = pkgObject && pkgObject.devDependencies && pkgObject.devDependencies['@isaac.frontend/testcafe-scaffolding'] | ||
const isRemovingTestcafeScaffolding = pkgObject && pkgObject.devDependencies && pkgObject.devDependencies['@isaac.frontend/testcafe-scaffolding'] | ||
? readlineSync.keyInYN( | ||
@@ -238,5 +258,6 @@ 'After running this initialization, you no longer need this tool as a dependency. Do you want to remove it after this script has ran?', | ||
`Example data : ${`${isInstallExampleTests}`.bold}`, | ||
...(isInstallExampleTests ? [`Example DSL : ${`${isInstallDSLExample}`.bold}`] : []), | ||
`Allure reporting : ${`${isInstallAllureReporting}`.bold}`, | ||
`Browserstack integration : ${`${isInstallBrowserstack}`.bold}`, | ||
...(typeof isRemovingIsaacQaTestcafe !== 'undefined' ? [`Remove @isaac.frontend/testcafe-scaffolding : ${`${isRemovingIsaacQaTestcafe}`.bold}`] : []), | ||
...(typeof isRemovingTestcafeScaffolding !== 'undefined' ? [`Remove @isaac.frontend/testcafe-scaffolding : ${`${isRemovingTestcafeScaffolding}`.bold}`] : []), | ||
'', | ||
@@ -253,2 +274,3 @@ ].join('\n')) | ||
isInstallExampleTests, | ||
isInstallDSLExample, | ||
} | ||
@@ -262,3 +284,3 @@ | ||
await updatePackageJson(context) | ||
if (typeof isRemovingIsaacQaTestcafe !== 'undefined' && isRemovingIsaacQaTestcafe === true) await removeQaTools() | ||
if (typeof isRemovingTestcafeScaffolding !== 'undefined' && isRemovingTestcafeScaffolding === true) await removeScaffoldingPkg() | ||
} catch (err) { | ||
@@ -275,3 +297,3 @@ console.error('Something went horribly wrong!'.bgRed.white.bold) | ||
'', | ||
'To run your test suite, type: `npm run test:e2e`'.bold, | ||
'To run your test suite, type: `npm run test:e2e` or `yarn test:e2e`'.bold, | ||
'-'.repeat(100).gray, | ||
@@ -278,0 +300,0 @@ ].join('\n')) |
@@ -0,0 +0,0 @@ # Allure reporting |
@@ -0,0 +0,0 @@ [Home](../README.md) |
@@ -9,3 +9,3 @@ [Home](../README.md) | ||
The initializer script will install a basic runner at `tests/e2e/runner.js` and add a `test:e2e` script to your `package.json`. To start the script, run `npm run test:e2e` in the root of your project. | ||
The initializer script will install a basic runner at `tests/e2e/runner.js` and add a `test:e2e` script to your `package.json`. To start the script, run `npm run test:e2e` or `yarn test:e2e` in the root of your project. | ||
@@ -12,0 +12,0 @@ By default the Chrome browser is used and all the tests in your `tests`-folder are executed. |
@@ -0,0 +0,0 @@ [Home](../../README.md) - [Writing the test suite](../writing-the-testsuite.md) |
@@ -0,0 +0,0 @@ [Home](../README.md) |
@@ -1,2 +0,2 @@ | ||
import { Selector } from 'testcafe' | ||
import { t, Selector } from 'testcafe' | ||
@@ -8,4 +8,10 @@ class GoogleHomePage { | ||
} | ||
async enterSearchQuery(query) { | ||
await t | ||
.typeText(this.searchQueryInput, query) | ||
.pressKey('enter') | ||
} | ||
} | ||
export default new GoogleHomePage(); | ||
export default new GoogleHomePage(); |
@@ -0,0 +0,0 @@ import { Selector } from 'testcafe' |
@@ -0,0 +0,0 @@ import { Selector } from 'testcafe' |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -8,4 +8,3 @@ /** | ||
import googleHomePage from '../page-models/google-home' | ||
import search from '../dsl/search' | ||
import results from '../dsl/results' | ||
import googleResultsPage from '../page-models/google-results' | ||
import isaacHomePage from '../page-models/isaac-website' | ||
@@ -17,5 +16,5 @@ | ||
test('ISAAC is at #1 at Google for the search term \'isaac\'', async (t) => { | ||
await search.enterSearchQuery('isaac') | ||
await t.expect(results.getFirstLinkHref()) | ||
await googleHomePage.enterSearchQuery('isaac') | ||
await t.expect(googleResultsPage.getFirstLinkHref()) | ||
.eql(isaacHomePage.home) | ||
}) |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { ClientFunction } from 'testcafe' |
{ | ||
"name": "@isaac.frontend/testcafe-scaffolding", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "TestCafe scaffolding tool to setup your repository for end-to-end testing with TestCafe", | ||
@@ -11,3 +11,4 @@ "author": "ISAAC E-commerce Solutions BV", | ||
"e2e", | ||
"testing" | ||
"testing", | ||
"scaffolding" | ||
], | ||
@@ -26,3 +27,4 @@ "bin": "./bin/init.js", | ||
"mkdir-recursive": "^0.4.0", | ||
"readline-sync": "^1.4.10" | ||
"readline-sync": "^1.4.10", | ||
"yarn-or-npm": "^3.0.1" | ||
}, | ||
@@ -29,0 +31,0 @@ "devDependencies": { |
@@ -7,6 +7,6 @@ # TestCafé scaffolding tool | ||
_Note: these installation instructions assume you already have a `package.json` present in the root of your project. If you do not have this, run `npm init` and follow the instructions on screen._ | ||
_Note: these installation instructions assume you already have a `package.json` present in the root of your project. If you do not have this, run `npm init` or `yarn init` and follow the instructions on screen._ | ||
1. Next, run the initialization script `npx @isaac.frontend/testcafe-scaffolding` follow the on-screen instructions. This will install the proper dependencies and setup a directory structure in your project. | ||
2. To run your test suite locally, run: `npm run test:e2e` | ||
2. To run your test suite locally, run: `npm run test:e2e` or `yarn test:e2e` | ||
@@ -35,2 +35,2 @@ The latest version of the following dependencies will be installed, depending on the features you want: | ||
## License | ||
[MIT](https://github.com/isaaceindhoven/) © ISAAC E-commerce Solutions BV | ||
[MIT](https://github.com/isaaceindhoven/testcafe-scaffolding/blob/master/LICENSE) © ISAAC E-commerce Solutions BV |
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:base", "group:allNonMajor"], | ||
"rangeStrategy": "bump", | ||
"assignees": ["maarten.vanhoof"] | ||
"rangeStrategy": "bump" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
490
122096
4
25
2
+ Addedyarn-or-npm@^3.0.1
+ Addedcross-spawn@6.0.5(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpkg-dir@4.2.0(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedyarn-or-npm@3.0.1(transitive)