{"id":15744022,"url":"https://github.com/jvitor83/angularcli-cucumber","last_synced_at":"2026-02-04T06:37:21.302Z","repository":{"id":73061743,"uuid":"145175285","full_name":"jvitor83/angularcli-cucumber","owner":"jvitor83","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-20T15:58:42.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T10:13:46.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jvitor83.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-17T23:40:41.000Z","updated_at":"2018-08-20T15:58:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ff41e16-ca74-41aa-a608-c9dd5c2fb384","html_url":"https://github.com/jvitor83/angularcli-cucumber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvitor83%2Fangularcli-cucumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvitor83%2Fangularcli-cucumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvitor83%2Fangularcli-cucumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvitor83%2Fangularcli-cucumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jvitor83","download_url":"https://codeload.github.com/jvitor83/angularcli-cucumber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423527,"owners_count":20774795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T03:40:26.198Z","updated_at":"2026-02-04T06:37:21.269Z","avatar_url":"https://github.com/jvitor83.png","language":null,"readme":"1) Create Angular App\n    ```sh\n    ng new AngularCucumber\n    ```\n\n1) Install the global tools:\n    ```sh\n    npm install -g protractor cucumber\n    ```\n1) Install the required libraries:\n    ```sh\n    npm install --save-dev cucumber @types/cucumber protractor-cucumber-framework chai @types/chai chai-as-promised @types/chai cucumber-junit globule mkdirp\n    ```\n\n1) Replace the content of `e2e/protractor.conf.js` with:\n    ```js\n    // Protractor configuration file, see link for more information\n    // https://github.com/angular/protractor/blob/master/lib/config.ts\n    const cucumberXmlReport = require('cucumber-junit');\n\n    exports.config = {\n      allScriptsTimeout: 11000,\n      specs: [\n          './src/features/**/*.feature'\n      ],\n      capabilities: {\n          'browserName': 'chrome'\n      },\n      directConnect: true,\n      baseUrl: 'http://localhost:4200/',\n      framework: 'custom',\n      frameworkPath: require.resolve('protractor-cucumber-framework'),\n      cucumberOpts: {\n          compiler: ['ts:ts-node/register'],\n          require: [ './src/features/**/*.e2e-spec.ts' ],\n          tags: [\"~@ignore\"],\n          strict: true,\n          format: 'json:./TestResults/integrationtest/testresults/cucumber_report.json',\n          'dry-run': false\n      },\n      suites: getSuites(),\n      onPrepare() {\n        require('ts-node').register({\n            project: require('path').join(__dirname, './tsconfig.e2e.json')\n        });\n        const dirName = process.cwd() + '/TestResults/integrationtest/testresults';\n        if (!require('fs').existsSync(dirName)) {\n            require('mkdirp').sync(dirName);\n        }\n      },\n      onComplete: () =\u003e {\n        const fs = require('fs');\n        const fileContent = fs.readFileSync('./TestResults/integrationtest/testresults/cucumber_report.json', 'utf8');\n        const junitReportContent = cucumberXmlReport(fileContent, {strict: true});\n        fs.writeFileSync('./TestResults/integrationtest/testresults/cucumber_report.xml', junitReportContent);\n      }\n    };\n\n    function getSuites() {\n      const fileSufix = \".feature\";\n      const globulePathsArray = require(`globule`).find([ `${process.cwd()}/e2e/src/features/**/*${fileSufix}` ]);\n      const suites = { };\n      globulePathsArray.forEach(pathFile =\u003e {\n          const filename = require(\"path\").basename(pathFile);\n          const filenameWithoutSufix = filename.replace(fileSufix, '');\n          suites[filenameWithoutSufix] = pathFile;\n      });\n      return suites;\n    }\n    ```\n\n1) Copy the files of `e2e/src` to `e2e/src/pages`\n1) Delete the file `e2e/src/pages/app.e2e-spec.ts`\n1) Create the directory `e2e/src/features`\n1) Create the file `e2e/src/features/example.feature` with the content:\n    ```gherkin\n    Feature: Home\n\n    Scenario: A first scenario\n        Given I am on the software\n        When i go to the app page\n        Then should display the welcome message \"Welcome to AngularCucumber!\"\n    ```\n1) Create the file `e2e/src/features/example/example.e2e-spec.ts` with the content:\n    ```typescript\n    import { Given, When, Then } from 'cucumber';\n    import * as chai from 'chai';\n    import * as chaiAsPromised from 'chai-as-promised';\n    import { AppPage } from '../../pages/app.po';\n    chai.use(chaiAsPromised);\n    const expect = chai.expect;\n\n\n    let page: AppPage;\n\n    Given(/^I am on the software$/, () =\u003e {\n        page = new AppPage();\n    });\n\n    When(/^i go to the app page$/, () =\u003e {\n        return page.navigateTo();\n    });\n\n    Then(/^should display the welcome message \"(.*?)\"$/, async (expectedTitle: string) =\u003e {\n        return page.getParagraphText().then(paragraphText =\u003e expect(paragraphText).to.be.equal(expectedTitle));\n    });\n    ```\n1) Execute `ng e2e --suite=example`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvitor83%2Fangularcli-cucumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjvitor83%2Fangularcli-cucumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvitor83%2Fangularcli-cucumber/lists"}