1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-28 08:54:27 +07:00

test: BDD / acceptance tests

Implement acceptance testing using codeceptjs and puppeteer.
This commit is contained in:
Daniel Ruf 2019-05-02 11:08:41 +02:00
parent 9d7be476ad
commit d468ca7c5f
No known key found for this signature in database
GPG Key ID: F1C4F86FD2048661
6 changed files with 57 additions and 1 deletions

22
codecept.conf.js Normal file
View File

@ -0,0 +1,22 @@
exports.config = {
tests: './test/acceptance/*_test.js',
output: './test/acceptance/output',
helpers: {
Puppeteer: {
url: 'http://localhost:8080',
// "show": true,
chrome: {
// headless: false
}
}
},
include: {
I: './test/acceptance/steps_file.js'
},
smartWait: 30000,
bootstrap: null,
plugins: {},
mocha: {},
name: '@verdaccio/ui-theme'
}

View File

@ -20,6 +20,7 @@
"@verdaccio/types": "5.0.0-beta.4", "@verdaccio/types": "5.0.0-beta.4",
"autosuggest-highlight": "3.1.1", "autosuggest-highlight": "3.1.1",
"bundlesize": "0.17.1", "bundlesize": "0.17.1",
"codeceptjs": "2.1.0",
"codecov": "3.2.0", "codecov": "3.2.0",
"concurrently": "4.1.0", "concurrently": "4.1.0",
"cross-env": "5.2.0", "cross-env": "5.2.0",
@ -66,7 +67,7 @@
"ora": "1.4.0", "ora": "1.4.0",
"prettier": "1.14.3", "prettier": "1.14.3",
"prop-types": "15.7.2", "prop-types": "15.7.2",
"puppeteer": "1.8.0", "puppeteer": "1.15.0",
"react": "16.8.3", "react": "16.8.3",
"react-autosuggest": "9.4.2", "react-autosuggest": "9.4.2",
"react-dom": "16.8.3", "react-dom": "16.8.3",
@ -110,6 +111,8 @@
"flow": "flow check", "flow": "flow check",
"release": "standard-version -a -s", "release": "standard-version -a -s",
"test:clean": "npx jest --clearCache", "test:clean": "npx jest --clearCache",
"test:acceptance": "codeceptjs run --steps",
"test:acceptance:server": "concurrently --kill-others \"npm run verdaccio:server\" \"npm run test:acceptance\"",
"test": "cross-env NODE_ENV=test BABEL_ENV=test TZ=UTC jest --config ./jest.config.js --maxWorkers 2 --passWithNoTests", "test": "cross-env NODE_ENV=test BABEL_ENV=test TZ=UTC jest --config ./jest.config.js --maxWorkers 2 --passWithNoTests",
"test:size": "bundlesize", "test:size": "bundlesize",
"lint": "npm run flow && npm run lint:js && npm run lint:css", "lint": "npm run flow && npm run lint:js && npm run lint:css",

1
test/acceptance/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
output

View File

@ -0,0 +1,9 @@
Feature('Menu');
Scenario('check if we find the npm commands to set the registry', (I) => {
I.amOnPage('http://localhost:8080');
I.waitForElement('#header--button-registryInfo', 5);
I.click('#header--button-registryInfo');
I.waitForElement('#registryInfo--dialog-container');
I.see('npm set registry http://localhost:8080');
});

View File

@ -0,0 +1,10 @@
Feature('SearchResult');
Scenario('check if we get the "no results found" text', (I) => {
I.amOnPage('http://localhost:8080');
I.seeElement('header .react-autosuggest__input input');
I.fillField('header .react-autosuggest__input input', 'test');
I.waitForElement('header .react-autosuggest__suggestions-container');
I.wait(1);
I.see('No results found.', 'header .react-autosuggest__suggestions-container');
});

View File

@ -0,0 +1,11 @@
// in this file you can append custom step methods to 'I' object
module.exports = function() {
return actor({
// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.
});
}