mercredi 27 février 2019

Run protractor in localhost server during countinuous integration

I have been studying protractor and I have wrote some tests in with our production web app. Now I want to integrate this tests on our continuous integration. If the tests fail it should not continue to continuous release.

To achieve this I planned to run the same test in local server with the target version that is going to production. My project is coded in angularjs. My package.json file has a script to start a local server and other to test but I'm not being able to wait the server complete to up before running my tests.

Te question is: How can I run my tests in localhost web server?

My selenium config file

exports.config = {
    framework: 'jasmine',
    seleniumAdress: 'http://localhost:4444/wd/hub',
    suites: {
        fluxos: './specs/fluxos/spec.js',
        validacoes: './specs/validacoes/spec.js'
    },
    capabilities: {
        browserName: 'chrome'
    },
}

My package.json

{
  "scripts": {
    "build": "gulp build:dev",
    "build:hmg": "gulp build:hmg",
    "build:hmgi": "gulp build:hmgInterno",
    "build:prod": "gulp build:prod",
    "coverage": "gulp test:build",
    "lint": "./node_modules/.bin/eslint **/*.js",
    "precommit": "npm run lint",
    "prepush": "npm run coverage",
    "start": "gulp serve:dev",
    "start:hmg": "gulp serve:hmg",
    "start:hmgi": "gulp serve:hmgInterno",
    "start:prod": "gulp serve:prod",
    "test": "gulp test",
    "integration:validacoes": "gulp serve:prod && protractor ./tests/integration/conf.js --suite validacoes",
    "integration:fluxos": "gulp serve:prod && protractor ./tests/integration/conf.js --suite fluxos"
  },
  "dependencies": {
    "@uirouter/angularjs": "^1.0.15",
    "@uirouter/core": "^5.0.17",
    "angular": "^1.6.8",
    "angular-cookies": "^1.6.8",
    "angular-format-masks": "^1.0.2",
    "angular-i18n": "^1.6.8",
    "angular-input-masks": "^4.1.0",
    "angular-sanitize": "^1.6.8",
    "angular-spinner": "^1.0.1",
    "angular-touch": "^1.6.8",
    "angulartics": "^1.6.0",
    "angulartics-google-tag-manager": "0.0.1",
    "ng-accessibility-bar": "^1.2.3",
    "spin.js": "^2.3.2"
  },
  "devDependencies": {
    "angular-mocks": "^1.6.10",
    "autoprefixer": "^8.1.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.24.1",
    "browser-sync": "^2.23.7",
    "browser-sync-spa": "^1.0.3",
    "del": "^2.2.2",
    "eslint": "^3.12.2",
    "eslint-config-airbnb": "^13.0.0",
    "eslint-config-angular": "^0.5.0",
    "eslint-plugin-angular": "^1.6.1",
    "eslint-plugin-import": "^2.11.0",
    "eslint-plugin-jsx-a11y": "^2.0.0",
    "eslint-plugin-react": "^6.8.0",
    "gulp": "^3.9.1",
    "gulp-cachebust": "0.0.6",
    "gulp-clean-css": "^3.9.3",
    "gulp-eslint": "^4.0.2",
    "gulp-group-css-media-queries": "^1.2.2",
    "gulp-gzip": "^1.4.2",
    "gulp-htmlmin": "^3.0.0",
    "gulp-if": "^2.0.1",
    "gulp-imagemin": "^3.4.0",
    "gulp-ng-annotate": "^2.1.0",
    "gulp-ng-constant": "^2.0.0-3",
    "gulp-postcss": "^7.0.1",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^3.2.1",
    "gulp-sourcemaps": "^2.6.4",
    "gulp-uglify": "^1.5.4",
    "gulp-uglify-es": "^1.0.4",
    "gulp-uncss": "^1.0.6",
    "gulp-useref": "^3.1.5",
    "husky": "^0.12.0",
    "imagemin-gifsicle": "^5.2.0",
    "imagemin-jpegtran": "^5.0.2",
    "imagemin-optipng": "^5.2.1",
    "imagemin-svgo": "^5.2.4",
    "jasmine": "^2.99.0",
    "jasmine-core": "^2.99.1",
    "karma": "^1.7.1",
    "karma-babel-preprocessor": "^6.0.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "^1.1.1",
    "karma-junit-reporter": "^1.2.0",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-spec-reporter": "0.0.26",
    "karma-threshold-reporter": "^0.1.15",
    "postcss-pxtorem": "^4.0.1",
    "protractor": "^5.4.2",
    "protractor-helper": "^3.7.0",
    "run-sequence": "^1.2.2"
  }
}

Aucun commentaire:

Enregistrer un commentaire