{"id":20516205,"url":"https://github.com/aftership/demo-bdd-test-workshop","last_synced_at":"2025-05-09T08:33:10.590Z","repository":{"id":40925840,"uuid":"216379902","full_name":"AfterShip/demo-bdd-test-workshop","owner":"AfterShip","description":"A workshop for bdd test coding by Nodejs","archived":true,"fork":false,"pushed_at":"2023-01-06T02:14:09.000Z","size":444,"stargazers_count":1,"open_issues_count":11,"forks_count":14,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-14T00:40:21.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AfterShip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-20T15:03:18.000Z","updated_at":"2025-03-25T07:33:18.000Z","dependencies_parsed_at":"2023-02-05T02:30:47.107Z","dependency_job_id":null,"html_url":"https://github.com/AfterShip/demo-bdd-test-workshop","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/AfterShip%2Fdemo-bdd-test-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Fdemo-bdd-test-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Fdemo-bdd-test-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Fdemo-bdd-test-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AfterShip","download_url":"https://codeload.github.com/AfterShip/demo-bdd-test-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253217292,"owners_count":21873061,"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-11-15T21:27:25.941Z","updated_at":"2025-05-09T08:33:10.358Z","avatar_url":"https://github.com/AfterShip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# demo-bdd-test-workshop\nA workshop for bdd test coding by Node.js\n\nCoding environment: Node.js\n\n\n## Usage\n\n\n1. [fast download \u0026 install](https://nodejs.org/), skip this if you have installed\n\n1. `git clone git@github.com:AfterShip/demo-bdd-test-workshop.git`\n\n1. `npm install`\n\n1. `npm test`\n\n\n```gherkin\n\nFeature: BDD practices\n\n\tScenario: Launching demo workshop\n\n\t\tGiven I am a cool coder trying to glance more about \"BDD\"\n\n\t\tWhen my computer have installed \"Node.js\"\n\n\t\tAnd I try to do the demo on \"my local environment\"\n\n\t\tThen clone this repo by running: \"git clone git@github.com:AfterShip/demo-bdd-test-workshop.git\"\n\n\t\tThen run \"npm install\"\n\n\n\tScenario: Run the test\n\n\t\tGiven the project has several branches represent to deferent scenarios\n\t\t\t| AvailableBranchesOfScenarios |\n\t\t\t| aftership-login-success      |\n\t\t\t| aftership-login-error        |\n\n\t\tWhen I want to switch to a scenario\n\n\t\tThen just checkout the target branch to see the example by \"git checkout \u003ctarget-branch\u003e\":\n\n\n```\n\n## About step definitions\n\nThese workshop will implement the step definitions by an E2E test tool call `Cypress`\n\nYou can refer following codes to implement the step:\n\nGherkin:\n```gherkin\nGiven I am a cool coder\n```\nCorrespond to:\n```js\nGiven('I am a cool coder', ()=\u003e{\n\t// code something if needed\n})\n```\n\n### Examples of step definitions that may be used in this workshop\n\n#### Visit a page\n\nGherkin:\n```gherkin\nWhen I visit the \"https://www.aftership.com\"\n```\ncorrespond to:\n```js\nWhen(\"I visit the {string}\", url =\u003e {\n\tcy.visit(url)\n})\n```\n\n#### Click a button\n\nGherkin:\n```gherkin\nWhen I click the \"Sign In\" button\n```\ncorrespond to:\n```js\nWhen(\"I click the {string} button\", buttonText =\u003e {\n\tcy.get('button:visible').contains(buttonText).click();\n})\n```\n\n#### Assert the page contains some text\n\nGherkin:\n```gherkin\nThen I can see the \"Welcome!\"\n```\ncorrespond to:\n```js\nThen(\"I can see the {string}\", text =\u003e {\n\tcy.contains(':visible', text);\n})\n```\n#### Select something by a css selector\n\nget a visible element\n```js\ncy.get('button:visible');\n```\n\nget an input field name \"email\"\n```js\ncy.get('input[name=\"email\"]');\n```\n\n#### Type some text in a input field\n\n```js\ncy.get(`input[name=\"email\"]`).type('john@aftership.com');\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftership%2Fdemo-bdd-test-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faftership%2Fdemo-bdd-test-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftership%2Fdemo-bdd-test-workshop/lists"}