Compare commits
8 Commits
pure-cypre
...
master
Author | SHA1 | Date | |
---|---|---|---|
8344311162 | |||
99c36ac5f0 | |||
|
1809f2fa8f | ||
9c49bc2105 | |||
|
61f0a88163 | ||
21167e4b3c | |||
|
e4179787de | ||
|
ed9a550d5e |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,5 +1,6 @@
|
||||
{
|
||||
"conventionalCommits.scopes": [
|
||||
"Cypress"
|
||||
"Cypress",
|
||||
"Cypress-Gherkin"
|
||||
]
|
||||
}
|
16
README.md
16
README.md
@ -1,17 +1,19 @@
|
||||
# Lifen Autotest Hangout with Simon Priet
|
||||
|
||||
This is a branch that does pure cypress code, and don't rely on gherkin and `cypress-cucumber-preprocessor`. It's less stable than the main branch and can be reviewed as extra work. If you did not reviewed the main branch, please inspect it first as it is intented to be the main hang out. I used pure js to code the automation, then refactored it to fit in the gherkin syntax. I found it was simpler for me to code first, then adapt the code to a `feature` file.
|
||||
Please find in this project my hangout of your technical test. The test is performed with `cypress`, and include `cypress-cucumber-preprocessor`. This module process `.feature` files (they carry the test case in Gherkin syntax) and find matching `.js` files to run them by cypress runner. I initially coded cypress to do the part 2 only, but took time to include the part one as well. Now cypress run the api to generate the communication with the document, then connect the user to send the mail.
|
||||
|
||||
Currently, cypress is still challenged with a SMS code, and I have not implemented a workaround. Cypress wait 20 for the operator to put the code in the GUI, then continue. Please feel free to reconfigure your environment with your own phone number to try out. **However**, this automate can't be industrialized into a CI/CD pipeline.
|
||||
Currently, cypress is still challenged with a SMS code, and I have not implemented a workaround. Cypress wait 20 for me to put the code in the GUI, then continue. Please feel free to reconfigure your environment with your own phone number to try out. **However**, this automate can't be industrialized into a CI/CD pipeline.
|
||||
|
||||
I fond 2 tools that can help us more:
|
||||
|
||||
* [`cypress-recurse` 🌐](https://github.com/bahmutov/cypress-recurse) can retry several time a request until a certain condition is meet. This can help us wait for Irène to process the CommunicationRequest (`draft` → `suspended`), before going any further.
|
||||
* [`cypress-mailosaur` 🌐](https://mailosaur.com/docs/frameworks-and-tools/cypress/) is a mail and text provided that can help us read texts content sent by the server to a predefined phone number, and work around the text code challenge.
|
||||
* [`cypress-mailosaur` 🌐](https://mailosaur.com/docs/frameworks-and-tools/cypress/) is a mail and text provider that can help us read texts content sent by the server to a predefined phone number, and work around the text code challenge.
|
||||
|
||||
# Installation
|
||||
Please note the existance of a 'pure cypress' branch on this repo that doesn't rely on BDD.
|
||||
|
||||
The code has been written with VSC in mind, on a Windows 10 machine, so a launch.json is available to help run and debug the softwares. No helpers are available for other IDE.
|
||||
## Installation
|
||||
|
||||
The code has been written with VSC in mind, on a Windows 10 machine, so a `launch.json` configuration file is available to help run and debug the software. No helpers are available for other IDE.
|
||||
|
||||
1. Clone the repo to your local computer. You will need the following requierement:
|
||||
* Node.js 16
|
||||
@ -20,6 +22,4 @@ The code has been written with VSC in mind, on a Windows 10 machine, so a launch
|
||||
2. Purge the `node_module` folder ( `rm -rf ./node_modules/`)
|
||||
3. Run `npm install` to reinstall cypress and it's dependences according to your OS's environment. npm will use the `package.json` to find what to do.
|
||||
2. Type `npm run test` to launch the script. In VS code, run `Test Cypress via NPM` from the *Run and Debug* tab. The `Launch.json` file will trigger the `test` script configured in the `package.json`.
|
||||
6. On the cypress GUI, select
|
||||
* `api` to run test steps against the API,
|
||||
* `inbox` for some tests against the Inbox website.
|
||||
6. On the cypress GUI, select `sendDocument` for the throughout test, and `inbox` for some subtests in the Inbox website.
|
@ -2,5 +2,7 @@
|
||||
"baseUrl": "https://app.post-prod.lifen.fr",
|
||||
"env": {
|
||||
"MAILOSAUR_API_KEY": "your-key-here"
|
||||
}
|
||||
},
|
||||
"testFiles": "**/*.feature",
|
||||
"ignoreTestFiles": "**/*.spec.js"
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"login": "candidature-qa@example.org",
|
||||
"mdp": "kHwWawhH5ADNuFb",
|
||||
"phone": "0643779588"
|
||||
}
|
@ -1,208 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe("it test the api", () => {
|
||||
let jsonWebToken = "";
|
||||
const apiUrl = "https://fhir-api.public.post-prod.lifen.fr";
|
||||
let documentReferenceId, communicationRequestId, patientId = "";
|
||||
|
||||
it("I have a JWT", () => {
|
||||
|
||||
cy.request({
|
||||
url: "https://lifen-post-prod.eu.auth0.com/oauth/token",
|
||||
method: "POST",
|
||||
body: {
|
||||
client_id: 'szVsMPaDPUdwqngGiLoHfXFT5XCYPFcy',
|
||||
client_secret: 'sMp2PB-QWBZupCB4IXJrWDJ-7tlpUl09vQ2tMKdy049He7-g93ofbXz7ESlAc82B',
|
||||
audience: 'post-prod-apis',
|
||||
grant_type: 'client_credentials',
|
||||
}
|
||||
}).its('body').then((body) => {
|
||||
jsonWebToken = body.access_token;
|
||||
//cy.log(json_web_token);
|
||||
expect(jsonWebToken).to.not.be.empty;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it("I have a the document #1615660", () => {
|
||||
cy.request({
|
||||
url:`${apiUrl}/fhir/Binary/1615660`,
|
||||
method:'GET',
|
||||
headers: {
|
||||
"authorization" : `Bearer ${jsonWebToken}`,
|
||||
"Prefer": "return=representation"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/pdf");
|
||||
})
|
||||
});
|
||||
|
||||
it("I prepare the DocumentReference", () => {
|
||||
cy.request({
|
||||
url:`${apiUrl}/fhir/DocumentReference`,
|
||||
method:'POST',
|
||||
headers: {
|
||||
authorization : `Bearer ${jsonWebToken}`,
|
||||
'content-type': 'application/json',
|
||||
"Prefer": "return=representation"
|
||||
},
|
||||
json: true,
|
||||
body: {
|
||||
"status": "current",
|
||||
"docStatus": "final",
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://loinc.org",
|
||||
"code": "34109-9",
|
||||
"display": "Document médical"
|
||||
}
|
||||
]
|
||||
},
|
||||
"indexed": "2021-02-11T09:25:39Z",
|
||||
"description": "aelgain-copiepatient.pdf",
|
||||
"content": [
|
||||
{
|
||||
"attachment": {
|
||||
"contentType": "application/pdf",
|
||||
"url": "Binary/1615660",
|
||||
"title": "aelgain-copiepatient.pdf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"resourceType": "DocumentReference"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(201);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "DocumentReference");
|
||||
expect(response.body).to.have.property('id');
|
||||
documentReferenceId = response.body.id
|
||||
});
|
||||
//cy.log(documentReferenceId);
|
||||
});
|
||||
|
||||
it("I prepare the CommunicationRequest", () => {
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/CommunicationRequest`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`,
|
||||
'content-type': 'application/json',
|
||||
"Prefer": "return=representation"
|
||||
},
|
||||
json: true,
|
||||
body: {
|
||||
"meta": {
|
||||
"tag": [
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/tag/verified/sender",
|
||||
"code": "SENDER_VERIFIED",
|
||||
"display": "Sender is verified and should not be changed."
|
||||
},
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/tag/processing/mode",
|
||||
"code": "IMMEDIATE_MODE",
|
||||
"display": "request should be treated in immediate mode"
|
||||
},
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/CodeSystem/Resource/Tag/PatientAutomaticResending",
|
||||
"code": "NONE",
|
||||
"display": "Patient communication should not be resent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "draft",
|
||||
"category": [
|
||||
{
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/CodeSystem/communication-category",
|
||||
"code": "MEDICAL_REPORT"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"priority": "routine",
|
||||
"payload": [
|
||||
{
|
||||
"contentReference": {
|
||||
"reference": `DocumentReference/${documentReferenceId}`
|
||||
}
|
||||
}
|
||||
],
|
||||
"sender": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://lifen.fr/fhir/StructureDefinition/Resource/Extension/Source",
|
||||
"valueCode": "USER"
|
||||
}
|
||||
],
|
||||
"reference": "Organization/2"
|
||||
},
|
||||
"requester": {
|
||||
"agent": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://lifen.fr/fhir/StructureDefinition/communicationrequest-requester-user-uuid",
|
||||
"valueString": "ea07d7c6-ff4b-43fc-9765-e4235886d30c"
|
||||
}
|
||||
],
|
||||
"reference": "Organization/2"
|
||||
}
|
||||
},
|
||||
"resourceType": "CommunicationRequest"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(201);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "CommunicationRequest");
|
||||
expect(response.body).to.have.property('id');
|
||||
expect(response.body).to.have.property('status', 'draft');
|
||||
communicationRequestId = response.body.id
|
||||
});
|
||||
});
|
||||
|
||||
it("I fetch the CommunicationRequest's PatientId after waiting 10 sec for the IA to process it", () => {
|
||||
cy.wait(10000);
|
||||
// avec cypress-recurse, on surveille jusqu'a ce que l'IA ai finit son traitement ; plutot que d'attendre un temps arbitraire.
|
||||
// import { recurse } from 'cypress-recurse' // a placer en début de fichier.
|
||||
// recurse(() => cy.request(...), (response) => { expect(response.body).to.have.property('status', 'suspended') } ).then((response) => {...})
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/CommunicationRequest/${communicationRequestId}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "CommunicationRequest");
|
||||
expect(response.body).to.have.property('id');
|
||||
expect(response.body).to.have.property('status', 'suspended');
|
||||
expect(response.body).to.have.property('subject');
|
||||
expect(response.body).to.have.property('recipient');
|
||||
expect(response.body.subject).to.have.property('reference');
|
||||
let patient = response.body.subject.reference;
|
||||
patientId = patient.split("/")[1];
|
||||
});
|
||||
});
|
||||
|
||||
it("I get the Patient", () => {
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/Patient/${patientId}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "Patient");
|
||||
expect(response.body).to.have.property('id', patientId);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
15
cypress/integration/inbox.feature
Normal file
15
cypress/integration/inbox.feature
Normal file
@ -0,0 +1,15 @@
|
||||
Feature: Send a document that is ready
|
||||
|
||||
As a practiciant, I can send mails that i have prepared
|
||||
|
||||
Scenario: Send a prepared document
|
||||
Given I am connected to my mailbox
|
||||
And I have a document ready to send
|
||||
When I send the mail
|
||||
Then The mail is sent
|
||||
|
||||
Scenario: Connect to the mailbox
|
||||
Given I log with my credentials
|
||||
And I receive a code by SMS
|
||||
When I put the code
|
||||
Then I am connected
|
@ -1,85 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
context('The login page', () => {
|
||||
|
||||
describe.skip('Test the login page', () => {
|
||||
|
||||
it('Access the webpage', function() {
|
||||
cy.visit('/login');
|
||||
cy.get('#email').should("have.attr", "type", "email");
|
||||
cy.get('#password').should("have.attr", "type", "password");
|
||||
//cy.get('#password').type(mdp);
|
||||
});
|
||||
|
||||
it('Log a malformed email', function() {
|
||||
cy.visit('/login');
|
||||
cy.get('#email').type("not an email");
|
||||
cy.get('#password').type("somepasseword {enter}");
|
||||
cy.url().should('include', 'login?');
|
||||
});
|
||||
|
||||
it('Log an unexisting user', function() {
|
||||
cy.visit('/login');
|
||||
cy.get('#email').type("toto@yopmail.com");
|
||||
cy.get('#password').type("somepasseword {enter}");
|
||||
cy.get('#error-message').should("have.class", "alert alert-danger").should("be.visible");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("It send an SMS", function() {
|
||||
it('Log the candidate user', function(){
|
||||
cy.visit('/');
|
||||
cy.get('#email').type("candidature-qa@example.org");
|
||||
cy.get('#password').type("kHwWawhH5ADNuFb");
|
||||
cy.get('#continueButton').click();
|
||||
|
||||
/*cy.mailosaurGetMessage(serverId, {
|
||||
sentTo: smsNumber
|
||||
}).as('sms'); */
|
||||
|
||||
cy.wait(10000).then(() => {
|
||||
cy.get('#validateButton').click();
|
||||
});
|
||||
|
||||
cy.visit("/request")
|
||||
// should be on the inbox
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
context("The inbox page", function() {
|
||||
describe("It check the inbox content", function() {
|
||||
before(() => {
|
||||
cy.visit('/');
|
||||
cy.get('#email').type("candidature-qa@example.org");
|
||||
cy.get('#password').type("kHwWawhH5ADNuFb");
|
||||
cy.get('#continueButton').click();
|
||||
cy.wait(20000).then(() => {
|
||||
cy.get('#validateButton').click();
|
||||
});
|
||||
cy.get("#account-menu div[title]").should((elm) => {
|
||||
expect(elm).to.contain("candidature-qa@example.org")
|
||||
});
|
||||
});
|
||||
|
||||
it("It load the inbox page of a valid user", ()=> {
|
||||
cy.visit("/request");
|
||||
cy.get("#account-menu div[title]").should((elm) => {
|
||||
expect(elm).to.contain("candidature-qa@example.org")
|
||||
});
|
||||
cy.get("#dashboard-dropzone tr:first-child td").eq(1).click();
|
||||
cy.get("#sending-button").click();
|
||||
});
|
||||
|
||||
it("It checks for messages in the inbox", () => {
|
||||
// to-do
|
||||
});
|
||||
|
||||
it("Open the message for data that has been injected previously", () => {
|
||||
// to-do
|
||||
});
|
||||
|
||||
});
|
||||
});
|
57
cypress/integration/inbox/inbox.js
Normal file
57
cypress/integration/inbox/inbox.js
Normal file
@ -0,0 +1,57 @@
|
||||
/* global Given, When, Then */
|
||||
import { Given, When, Then, And, Before } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
describe("Send a prepared document", () => {
|
||||
|
||||
Given("I am connected to my mailbox", () => {
|
||||
cy.visit('/');
|
||||
cy.get('#email').type("candidature-qa@example.org");
|
||||
cy.get('#password').type("kHwWawhH5ADNuFb");
|
||||
cy.get('#continueButton').click();
|
||||
cy.wait(20000).then(() => {
|
||||
cy.get('#validateButton').click();
|
||||
});
|
||||
cy.visit("/request");
|
||||
|
||||
})
|
||||
|
||||
And("I have a document ready to send", () => {
|
||||
cy.get("#dashboard-dropzone tr:first-child td").eq(1).click();
|
||||
});
|
||||
|
||||
When("I send the mail", () => {
|
||||
cy.get("#sending-button").click();
|
||||
});
|
||||
|
||||
Then("The mail is sent", () => {
|
||||
//?
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Connect to the mailbox", () => {
|
||||
|
||||
Given("I log with my credentials", () => {
|
||||
cy.visit('/');
|
||||
cy.get('#email').type("candidature-qa@example.org");
|
||||
cy.get('#password').type("kHwWawhH5ADNuFb");
|
||||
cy.get('#continueButton').click();
|
||||
});
|
||||
|
||||
And("I receive a code by SMS", () => {
|
||||
cy.get("#challenge_mfa_form_candidate_otp").should("be.visible");
|
||||
});
|
||||
|
||||
When("I put the code", () => {
|
||||
cy.wait(20000).then(() => {
|
||||
cy.get('#validateButton').click();
|
||||
});
|
||||
});
|
||||
|
||||
Then("I am connected", () => {
|
||||
cy.get("#account-menu div[title]").should((elm) => {
|
||||
expect(elm).to.contain("candidature-qa@example.org")
|
||||
});
|
||||
});
|
||||
|
||||
})
|
14
cypress/integration/sendDocument.feature
Normal file
14
cypress/integration/sendDocument.feature
Normal file
@ -0,0 +1,14 @@
|
||||
Feature: Prepare and Send the document #1615660
|
||||
|
||||
As a practiciant, I can prepare a document to send to my colleague and be helped by Irène to fill contextual data.
|
||||
|
||||
Scenario: Send a document
|
||||
Given I use the API
|
||||
And I have the document #1615660
|
||||
And I have a DocumentReference
|
||||
And I have a CommunicationRequest
|
||||
And Irène prepared the CommunicationRequest
|
||||
And I have a Patient
|
||||
And I am connected to my mailbox
|
||||
When I send the mail
|
||||
Then the mail is sent
|
232
cypress/integration/sendDocument/sendDocument.js
Normal file
232
cypress/integration/sendDocument/sendDocument.js
Normal file
@ -0,0 +1,232 @@
|
||||
/* global Given, When, Then */
|
||||
import { Given, When, Then, And, Before } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
describe("Send a document", () => {
|
||||
const apiUrl = "https://fhir-api.public.post-prod.lifen.fr";
|
||||
let jsonWebToken, documentReferenceId, communicationRequestId, patientId = "";
|
||||
|
||||
Given("I use the API", () => {
|
||||
cy.request({
|
||||
url: "https://lifen-post-prod.eu.auth0.com/oauth/token",
|
||||
method: "POST",
|
||||
body: {
|
||||
client_id: 'szVsMPaDPUdwqngGiLoHfXFT5XCYPFcy',
|
||||
client_secret: 'sMp2PB-QWBZupCB4IXJrWDJ-7tlpUl09vQ2tMKdy049He7-g93ofbXz7ESlAc82B',
|
||||
audience: 'post-prod-apis',
|
||||
grant_type: 'client_credentials',
|
||||
}
|
||||
}).its('body').then((body) => {
|
||||
jsonWebToken = body.access_token;
|
||||
//cy.log(json_web_token);
|
||||
expect(jsonWebToken).to.not.be.empty;
|
||||
});
|
||||
})
|
||||
|
||||
And("I have the document #1615660", () => {
|
||||
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/Binary/1615660`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"authorization": `Bearer ${jsonWebToken}`,
|
||||
"Prefer": "return=representation"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/pdf");
|
||||
});
|
||||
});
|
||||
|
||||
And("I have a DocumentReference", () => {
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/DocumentReference`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`,
|
||||
'content-type': 'application/json',
|
||||
"Prefer": "return=representation"
|
||||
},
|
||||
json: true,
|
||||
body: {
|
||||
"status": "current",
|
||||
"docStatus": "final",
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://loinc.org",
|
||||
"code": "34109-9",
|
||||
"display": "Document médical"
|
||||
}
|
||||
]
|
||||
},
|
||||
"indexed": "2021-02-11T09:25:39Z",
|
||||
"description": "aelgain-copiepatient.pdf",
|
||||
"content": [
|
||||
{
|
||||
"attachment": {
|
||||
"contentType": "application/pdf",
|
||||
"url": "Binary/1615660",
|
||||
"title": "aelgain-copiepatient.pdf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"resourceType": "DocumentReference"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(201);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "DocumentReference");
|
||||
expect(response.body).to.have.property('id');
|
||||
documentReferenceId = response.body.id
|
||||
});
|
||||
});
|
||||
|
||||
And("I have a CommunicationRequest", () => {
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/CommunicationRequest`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`,
|
||||
'content-type': 'application/json',
|
||||
"Prefer": "return=representation"
|
||||
},
|
||||
json: true,
|
||||
body: {
|
||||
"meta": {
|
||||
"tag": [
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/tag/verified/sender",
|
||||
"code": "SENDER_VERIFIED",
|
||||
"display": "Sender is verified and should not be changed."
|
||||
},
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/tag/processing/mode",
|
||||
"code": "IMMEDIATE_MODE",
|
||||
"display": "request should be treated in immediate mode"
|
||||
},
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/CodeSystem/Resource/Tag/PatientAutomaticResending",
|
||||
"code": "NONE",
|
||||
"display": "Patient communication should not be resent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "draft",
|
||||
"category": [
|
||||
{
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://lifen.fr/fhir/CodeSystem/communication-category",
|
||||
"code": "MEDICAL_REPORT"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"priority": "routine",
|
||||
"payload": [
|
||||
{
|
||||
"contentReference": {
|
||||
"reference": `DocumentReference/${documentReferenceId}`
|
||||
}
|
||||
}
|
||||
],
|
||||
"sender": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://lifen.fr/fhir/StructureDefinition/Resource/Extension/Source",
|
||||
"valueCode": "USER"
|
||||
}
|
||||
],
|
||||
"reference": "Organization/2"
|
||||
},
|
||||
"requester": {
|
||||
"agent": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://lifen.fr/fhir/StructureDefinition/communicationrequest-requester-user-uuid",
|
||||
"valueString": "ea07d7c6-ff4b-43fc-9765-e4235886d30c"
|
||||
}
|
||||
],
|
||||
"reference": "Organization/2"
|
||||
}
|
||||
},
|
||||
"resourceType": "CommunicationRequest"
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(201);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "CommunicationRequest");
|
||||
expect(response.body).to.have.property('id');
|
||||
expect(response.body).to.have.property('status', 'draft');
|
||||
communicationRequestId = response.body.id
|
||||
});
|
||||
});
|
||||
|
||||
And("Irène prepared the CommunicationRequest", () => {
|
||||
cy.wait(10000);
|
||||
// avec cypress-recurse, on surveille jusqu'a ce que l'IA ai finit son traitement ; plutot que d'attendre un temps arbitraire.
|
||||
// import { recurse } from 'cypress-recurse' // a placer en début de fichier.
|
||||
// recurse(() => cy.request(...), (response) => { expect(response.body).to.have.property('status', 'suspended') } ).then((response) => {...})
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/CommunicationRequest/${communicationRequestId}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "CommunicationRequest");
|
||||
expect(response.body).to.have.property('id');
|
||||
expect(response.body).to.have.property('status', 'suspended');
|
||||
expect(response.body).to.have.property('subject');
|
||||
expect(response.body).to.have.property('recipient');
|
||||
expect(response.body.subject).to.have.property('reference');
|
||||
let patient = response.body.subject.reference;
|
||||
patientId = patient.split("/")[1];
|
||||
});
|
||||
});
|
||||
|
||||
And("I have a Patient", () => {
|
||||
cy.request({
|
||||
url: `${apiUrl}/fhir/Patient/${patientId}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
authorization: `Bearer ${jsonWebToken}`
|
||||
}
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||
expect(response.body).to.have.property("resourceType", "Patient");
|
||||
expect(response.body).to.have.property('id', patientId);
|
||||
});
|
||||
});
|
||||
|
||||
And("I am connected to my mailbox", () => {
|
||||
cy.visit('/');
|
||||
cy.get('#email').type("candidature-qa@example.org");
|
||||
cy.get('#password').type("kHwWawhH5ADNuFb");
|
||||
cy.get('#continueButton').click();
|
||||
cy.wait(20000).then(() => {
|
||||
cy.get('#validateButton').click();
|
||||
});
|
||||
cy.visit("/request");
|
||||
cy.get("#account-menu div[title]").should((elm) => {
|
||||
expect(elm).to.contain("candidature-qa@example.org")
|
||||
});
|
||||
});
|
||||
|
||||
When("I send the mail", () => {
|
||||
// Il n'y a pas de moyen fiable de lier la communicationRequestId que l'on a préparer avec l'une des entrée listée.
|
||||
// Il y a bien un code LT-xxxxxxx, mais il faudrais un moyen d'atteindre de le modèle stoquée dans la vue
|
||||
cy.get("#dashboard-dropzone tr:first-child td").eq(1).click();
|
||||
cy.get("#sending-button").click();
|
||||
});
|
||||
|
||||
Then("the mail is sent", () => {
|
||||
//?
|
||||
// On peux essayer d'attendre une requete de repondre un status
|
||||
// On peux attendre la notification "Envoie du document réussit"
|
||||
});
|
||||
|
||||
});
|
@ -8,6 +8,7 @@
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
const cucumber = require('cypress-cucumber-preprocessor').default
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
@ -19,4 +20,5 @@
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
on('file:preprocessor', cucumber())
|
||||
}
|
||||
|
@ -22,5 +22,4 @@
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
import 'cypress-mailosaur';
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
12
node_modules/cypress-cucumber-preprocessor/.editorconfig
generated
vendored
Normal file
12
node_modules/cypress-cucumber-preprocessor/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
[*.js]
|
||||
indent_size = 2
|
||||
|
||||
[*.feature]
|
||||
indent_size = 2
|
12
node_modules/cypress-cucumber-preprocessor/.eslintrc
generated
vendored
Normal file
12
node_modules/cypress-cucumber-preprocessor/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": ["airbnb-base", "prettier"],
|
||||
"plugins": ["cypress", "prettier"],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"cypress/globals": true,
|
||||
"jest": true
|
||||
},
|
||||
"rules": {
|
||||
"prettier/prettier": "error"
|
||||
}
|
||||
}
|
1
node_modules/cypress-cucumber-preprocessor/.gitattributes
generated
vendored
Normal file
1
node_modules/cypress-cucumber-preprocessor/.gitattributes
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.* js eol=lf
|
28
node_modules/cypress-cucumber-preprocessor/.github/ISSUE_TEMPLATE.md
generated
vendored
Normal file
28
node_modules/cypress-cucumber-preprocessor/.github/ISSUE_TEMPLATE.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<!-- Questions and request for general support may be closed at the maintainers
|
||||
discretion. -->
|
||||
|
||||
<!-- Issue reports that are deemed unrelated to specifically preprocessing will
|
||||
be closed. -->
|
||||
|
||||
### Current behavior
|
||||
|
||||
<!-- A description including screenshots, stack traces, DEBUG logs, etc. -->
|
||||
|
||||
### Desired behavior
|
||||
|
||||
<!-- A clear description of what you want to happen. -->
|
||||
|
||||
### Test code to reproduce
|
||||
|
||||
<!-- Issues without a reproducible example or not enough information will be
|
||||
closed. -->
|
||||
|
||||
<!-- We can only attempt to debug your issue if you provide us with a minimal
|
||||
example to reproduce the problem. This should preferably be another Git
|
||||
repository to be cloned -->
|
||||
|
||||
### Versions
|
||||
|
||||
* **Cypress version**:
|
||||
* **Preprocessor version**:
|
||||
* **Node version**:
|
8
node_modules/cypress-cucumber-preprocessor/.scripts/runOnExample.bash
generated
vendored
Normal file
8
node_modules/cypress-cucumber-preprocessor/.scripts/runOnExample.bash
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
git clone --depth=1 https://github.com/TheBrainFamily/cypress-cucumber-example.git
|
||||
|
||||
cd cypress-cucumber-example
|
||||
npm install
|
||||
rm -rf node_modules/cypress-cucumber-preprocessor
|
||||
npm link cypress-cucumber-preprocessor
|
||||
npm run test:all
|
8
node_modules/cypress-cucumber-preprocessor/.scripts/runOnWebpackTypescriptExample.bash
generated
vendored
Normal file
8
node_modules/cypress-cucumber-preprocessor/.scripts/runOnWebpackTypescriptExample.bash
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
git clone --depth=1 https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example.git
|
||||
|
||||
cd cypress-cucumber-webpack-typescript-example
|
||||
npm install
|
||||
rm -rf node_modules/cypress-cucumber-preprocessor
|
||||
npm link cypress-cucumber-preprocessor
|
||||
npm run test
|
111
node_modules/cypress-cucumber-preprocessor/CHANGELOG.md
generated
vendored
Normal file
111
node_modules/cypress-cucumber-preprocessor/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
# Changelog
|
||||
Starting with version 1.6.0 all the changes will be documented [here](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/releases)
|
||||
|
||||
## [1.6.0] - 2018-10-23
|
||||
### Added
|
||||
Finally! Tagging tests! (#100, #58, #46, #24 - Thanks @GlynnJKW @ChrisBAshton @jlin412 @sawasawasawa @lucetius for all the great work!)
|
||||
|
||||
## [1.5.1] - 2018-09-16
|
||||
|
||||
### Fixed
|
||||
Display variable names in scenario outlines instead of placeholder ( #98 - Thanks @novascreen !)
|
||||
|
||||
## [1.5.0] - 2018-09-06
|
||||
|
||||
### Fixed
|
||||
The return of This! in the step definitions. ( #96 - Thanks for reporting christiansaiki !)
|
||||
|
||||
## [1.4.0] - 2018-08-29
|
||||
|
||||
### Fixed
|
||||
Reload step definitions paths after cypress starts up. This allows for recognizing files created while cypress is running. ( Thanks @cvqprs for letting me know about this, rather alarming, issue! )
|
||||
|
||||
### Chores
|
||||
Watch mode code simplification
|
||||
|
||||
## [1.3.0] - 2018-08-27
|
||||
|
||||
### Fixed
|
||||
Fix output path for bundle directory on windows platform ( #81 - Thanks @agentHoover !)
|
||||
|
||||
### Added
|
||||
Improved TypeScript documentation example ( #92 - thanks @mhogdson ! )
|
||||
|
||||
## [1.2.2] - 2018-07-17
|
||||
### Added
|
||||
Documented example of sharing context between given, when, then steps to README file (#37).
|
||||
|
||||
## [1.2.1] - 2018-07-14
|
||||
### Added
|
||||
Instructions for using TypeScript ( #61 - thanks to @KeithGillette for discovering that it never actually worked, made possible by 1.2.0 with the input from @bensampaio )
|
||||
|
||||
## [1.2.0] - 2018-07-13
|
||||
|
||||
### Fixed
|
||||
Works with Imports/Exports ! ( #52 #20 )
|
||||
This possibly opens the road to using TypeScript as well :-)
|
||||
Thanks to @bensampaio for the dead on suggestion how to get around this problem. :-)
|
||||
|
||||
## [1.1.0] - 2018-07-13
|
||||
|
||||
### Added
|
||||
Custom Parameter types ( #66 - thanks to @oltodo !)
|
||||
Support for WebStorm Step Definitions recognition ( #56 thanks kayvanbree vadimromanyak )
|
||||
|
||||
### Chores
|
||||
Updated dependencies ( Thanks @ryzy )
|
||||
Fixed documentation 404 link ( Thanks ChrisBashton !)
|
||||
Updated documentation to say that TypeScript doesn't work after all :-( ( thanks to @KeithGillette for help with debugging this)
|
||||
|
||||
## [1.0.0] - 2018-04-21
|
||||
|
||||
### Added
|
||||
Regular expressions working in step definitions ( #42 - thanks to @stevepkuo for reporting !)
|
||||
### Changed
|
||||
Scenarios run as single steps now. ( #44 / #43 - thanks so much to @BenoitAverty not only for the PR but for the courage to question the status quo/think outside of the box here :) )
|
||||
This has a downside of less readable/uglier test reports, but allows realistically testing of real-world web applications. We will revisit once Cypress makes necessary adjustments - cypress-io/cypress#686
|
||||
|
||||
## [0.6.0] - 2018-04-09
|
||||
### Added
|
||||
Support for typescript ( #32 - thanks to @StefanNieuwenhuis for the PR !)
|
||||
## [0.5.0] - 2018-04-04
|
||||
|
||||
### Added
|
||||
Support for Background section ( #21 - thanks to @jmozgawa for implementing this! )
|
||||
|
||||
## [0.4.0] - 2018-04-03
|
||||
### Fixed
|
||||
Requiring files ( #30 - reported by @0xR )
|
||||
|
||||
### Changed
|
||||
Given, When, Then are interchangeable now. Also - And/But works as well. ( #31 , #28 - thanks to @GregorD1 @jbbn and @imageica for reporting )
|
||||
fileServerFolder option is not the preferred way to set path to step_definition anymore. We use cosmiconfig now. ( #16 - thanks to @reaktivo @dvelasquez for reporting and discussion )
|
||||
|
||||
## [0.3.0] - 2018-03-14
|
||||
### Changed
|
||||
Scenario will skip steps after the first failing one ( #23 - reported by @reaktivo )
|
||||
|
||||
## [0.2.0] - 2018-02-28
|
||||
### Added
|
||||
Support for Scenario Outlines ( #11 Thanks @mbaranovski !)
|
||||
|
||||
### Tests
|
||||
Wallaby and jest configurations for super nice development experience ( Thanks @mbaranovski !)
|
||||
|
||||
## [0.1.0] - 2018-02-18
|
||||
### Added
|
||||
Support for datatables and docstrings ( #7 Thanks @fcurella !)
|
||||
|
||||
Allow custom dir config ( #5 Thanks @dvelasquez !)
|
||||
|
||||
Tests and CircleCI integration! (@lgandecki)
|
||||
|
||||
Changelog!
|
||||
|
||||
### Changed
|
||||
Readme: fix configuration error (#11 Thanks @alopezsanchez !)
|
||||
|
||||
Updated Readme with TODO
|
||||
|
||||
### Code Style
|
||||
Added and enforced prettier with eslint (@lgandecki)
|
21
node_modules/cypress-cucumber-preprocessor/LICENSE
generated
vendored
Normal file
21
node_modules/cypress-cucumber-preprocessor/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 The Brain Software House
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
641
node_modules/cypress-cucumber-preprocessor/README.md
generated
vendored
Normal file
641
node_modules/cypress-cucumber-preprocessor/README.md
generated
vendored
Normal file
@ -0,0 +1,641 @@
|
||||
[](https://github.com/prettier/prettier)
|
||||
[](https://circleci.com/gh/TheBrainFamily/cypress-cucumber-preprocessor)
|
||||
|
||||
# Run cucumber/gherkin-syntaxed specs with Cypress.io
|
||||
|
||||
The **cypress-cucumber-preprocessor** adds support for using feature files when testing with Cypress.
|
||||
|
||||
You can follow the documentation below, or if you prefer to hack on a working example, take a look at [https://github.com/TheBrainFamily/cypress-cucumber-example](https://github.com/TheBrainFamily/cypress-cucumber-example
|
||||
)
|
||||
|
||||
#### Table of contents
|
||||
|
||||
* [Get started](#get-started)
|
||||
* [Installation](#installation)
|
||||
* [Cypress Configuration](#cypress-configuration)
|
||||
* [Configuration](#configuration)
|
||||
* [How to organize the tests](#how-to-organize-the-tests)
|
||||
* [Single feature files](#single-feature-files)
|
||||
* [Bundled features files](#bundled-features-files)
|
||||
* [Step definitions](#step-definitions)
|
||||
* [Step definitions creation](#step-definitions-creation)
|
||||
* [Reusable step definitions](#reusable-step-definitions)
|
||||
* [How to write tests](#how-to-write-tests)
|
||||
* [Cucumber Expressions](#cucumber-expressions)
|
||||
* [Given/When/Then functions](#cucumber-functions)
|
||||
* [Data table parameters](#data-table-parameters)
|
||||
* [Custom Parameter Type Resolves](#custom-parameter-type-resolves)
|
||||
* [Before and After hooks](#before-and-after-hooks)
|
||||
* [Background section](#background-section)
|
||||
* [Sharing context](#sharing-context)
|
||||
* [Smart tagging](#smart-tagging)
|
||||
* [How to run the tests](#excluding-tests)
|
||||
* [Running tagged tests](#running-tagged-tests)
|
||||
* [Ignoring specific scenarios using tags when executing test runner](#ignoring-specific-scenarios-using-tags-when-executing-test-runner)
|
||||
* [Output](#output)
|
||||
* [IDE support](#ide-support)
|
||||
* [Webstorm](#webstorm)
|
||||
* [Intellij IDEA](#intellij-IDEA)
|
||||
* [Visual Studio Code](#visual-Studio-Code)
|
||||
* [TypeScript Support](#typeScript-support)
|
||||
* [How to contribute](#how-to-contribute)
|
||||
* [Roadmap](#roadmap)
|
||||
* [Credits](#credits)
|
||||
* [Oldschool/Legacy Cucumber style](#legacy)
|
||||
|
||||
## Get started
|
||||
|
||||
### Installation
|
||||
|
||||
Install the plugin by running:
|
||||
|
||||
```shell
|
||||
npm install --save-dev cypress-cucumber-preprocessor
|
||||
```
|
||||
|
||||
### Cypress Configuration
|
||||
|
||||
Add it to your plugins:
|
||||
|
||||
`cypress/plugins/index.js`
|
||||
|
||||
```javascript
|
||||
const cucumber = require('cypress-cucumber-preprocessor').default
|
||||
|
||||
module.exports = (on, config) => {
|
||||
on('file:preprocessor', cucumber())
|
||||
}
|
||||
```
|
||||
|
||||
Add support for feature files to your Cypress configuration
|
||||
|
||||
`cypress.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"testFiles": "**/*.feature"
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Please make use of [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) to create a configuration for the plugin, for example, by adding this section to your package.json:
|
||||
|
||||
```json
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"nonGlobalStepDefinitions": true
|
||||
}
|
||||
```
|
||||
|
||||
*This will become the default option in a future version*
|
||||
|
||||
#### Configuration option
|
||||
|
||||
Option | Default value | Description
|
||||
------------ | ------------- | -------------
|
||||
commonPath | `cypress/integration/common` when `nonGlobalStepDefinitions` is true <br> `cypress/support/step_definitions` when `nonGlobalStepDefinitions` is false <br> `${nonGlobalStepBaseDir}/common` when `nonGlobalStepBaseDir` is defined | Define the path to a folder containing all common step definitions of your tests. When `nonGlobalStepBaseDir` is defined this path is defined from that base location. e.g `${nonGlobalStepBaseDir}/${commonPath}`.
|
||||
nonGlobalStepDefinitions | false | If true use the Cypress Cucumber Preprocessor Style pattern for placing step definitions files. If false, we will use the "oldschool" (everything is global) Cucumber style.
|
||||
nonGlobalStepBaseDir| undefined | If defined and `nonGlobalStepDefinitions` is also true then step definition searches for folders with the features name will start from the directory provided here. The cwd is already taken into account. e.g `test/step_definitions`.
|
||||
stepDefinitions | `cypress/integration` when `nonGlobalStepDefinitions` is true <br> `cypress/support/step_definitions` when `nonGlobalStepDefinitions` is false | Path to the folder containing our step definitions.
|
||||
|
||||
## How to organize the tests
|
||||
|
||||
### Single feature files
|
||||
|
||||
Put your feature files in `cypress/integration/`
|
||||
|
||||
Example: cypress/integration/Google.feature
|
||||
|
||||
```gherkin
|
||||
Feature: Google Main Page
|
||||
|
||||
I want to open a search engine
|
||||
|
||||
@focus
|
||||
Scenario: Opening a search engine page
|
||||
Given I open Google page
|
||||
Then I see "Google" in the title
|
||||
```
|
||||
|
||||
*The @focus tag is not necessary, but we want to you to notice it so you look it up below. **It will speed up your workflow significantly**!*
|
||||
|
||||
### Bundled features files
|
||||
|
||||
When running Cypress tests in a headless mode, the execution time can get pretty bloated, this happens because by default Cypress will relaunch the browser between every feature file.
|
||||
The **cypress-cucumber-preprocessor** gives you the option to bundle all feature files before running the tests, therefore reducing the execution time.
|
||||
|
||||
You can take advantage of this by creating `.features` files. You choose to have only one in the root of the directory `cypress/integrations` or per directory.
|
||||
|
||||
You also have to add support for `.features` files to your Cypress configuration
|
||||
|
||||
`cypress.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"testFiles": "**/*.{feature,features}"
|
||||
}
|
||||
```
|
||||
|
||||
To run the bundled tests:
|
||||
|
||||
```shell
|
||||
cypress run --spec **/*.features
|
||||
```
|
||||
|
||||
### Step definitions
|
||||
|
||||
**This is the RECOMMENDED way**
|
||||
|
||||
#### Step definitions creation
|
||||
|
||||
The `.feature` file will use steps definitions from a directory with the same name as your `.feature` file. The javascript files containing the step definitions can have other names if you want to break them into different concerns.
|
||||
|
||||
Easier to show than to explain, so, assuming the feature file is in `cypress/integration/Google.feature` , as proposed above, the preprocessor will read all the files inside `cypress/integration/Google/`, so:
|
||||
|
||||
`cypress/integration/Google/google.js` (or any other .js file in the same path)
|
||||
|
||||
```javascript
|
||||
import { Given } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
const url = 'https://google.com'
|
||||
Given('I open Google page', () => {
|
||||
cy.visit(url)
|
||||
})
|
||||
```
|
||||
|
||||
This is a good place to put *before/beforeEach/after/afterEach* hooks related to **that particular feature**. This is incredibly hard to get right with pure cucumber.
|
||||
|
||||
#### Reusable step definitions
|
||||
|
||||
We also have a way to create reusable step definitions. Put them in `cypress/integration/common/`
|
||||
|
||||
Example:
|
||||
cypress/integration/common/i_see_string_in_the_title.js
|
||||
|
||||
```javascript
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then(`I see {string} in the title`, (title) => {
|
||||
cy.title().should('include', title)
|
||||
})
|
||||
```
|
||||
|
||||
This is a good place to put global *before/beforeEach/after/afterEach* hooks.
|
||||
|
||||
## How to write tests
|
||||
|
||||
### Cucumber Expressions
|
||||
|
||||
We use <https://docs.cucumber.io/cucumber/cucumber-expressions/> to parse your .feature file, please use that document as your reference
|
||||
|
||||
<a name="cucumber-functions"></a>
|
||||
|
||||
### Given/When/Then functions
|
||||
|
||||
Since Given/When/Then are on global scope please use
|
||||
|
||||
```javascript
|
||||
/* global Given, When, Then */
|
||||
```
|
||||
|
||||
to make IDE/linter happy or import them directly as shown in the above examples.
|
||||
|
||||
### Data table parameters
|
||||
|
||||
To create steps that use gherkin data tables, the step definition needs to take an object and handle it like in these examples: [Example Feature](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/cypress/integration/DataTable.feature), [Example Step Definition](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/cypress/support/step_definitions/dataTable.js).
|
||||
|
||||
### Custom Parameter Type Resolves
|
||||
|
||||
Thanks to @Oltodo we can now use Custom Parameter Type Resolves.
|
||||
Here is an [example](cypress/support/step_definitions/customParameterTypes.js) with related [.feature file](cypress/integration/CustomParameterTypes.feature)
|
||||
|
||||
### Before and After hooks
|
||||
|
||||
The **cypress-cucumber-preprocessor** supports both Mocha's `before/beforeEach/after/afterEach` hooks and Cucumber's `Before` and `After` hooks.
|
||||
|
||||
The Cucumber hooks implementation fully supports tagging as described in [the cucumber js documentation](https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md). So they can be conditionally selected based on the tags applied to the Scenario. This is not possible with Mocha hooks.
|
||||
|
||||
Cucumber Before hooks run after all Mocha before and beforeEach hooks have completed and the Cucumber After hooks run before all the Mocha afterEach and after hooks.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
const {
|
||||
Before,
|
||||
After,
|
||||
Given,
|
||||
Then
|
||||
} = require("cypress-cucumber-preprocessor/steps");
|
||||
|
||||
// this will get called before each scenario
|
||||
Before(() => {
|
||||
beforeCounter += 1;
|
||||
beforeWithTagCounter = 0;
|
||||
});
|
||||
|
||||
// this will only get called before scenarios tagged with @foo
|
||||
Before({ tags: "@foo" }, () => {
|
||||
beforeWithTagCounter += 1;
|
||||
});
|
||||
|
||||
Given("My Step Definition", () => {
|
||||
// ...test code here
|
||||
})
|
||||
```
|
||||
|
||||
Note: to avoid confusion with the similarly named Mocha before and after hooks, the Cucumber hooks are not exported onto global scope. So they need explicitly importing as shown above.
|
||||
|
||||
### Background section
|
||||
|
||||
Adding a background section to your feature will enable you to run steps before every scenario. For example, we have a counter that needs to be reset before each scenario. We can create a given step for resetting the counter.
|
||||
|
||||
```javascript
|
||||
let counter = 0;
|
||||
|
||||
Given("counter has been reset", () => {
|
||||
counter = 0;
|
||||
});
|
||||
|
||||
When("counter is incremented", () => {
|
||||
counter += 1;
|
||||
});
|
||||
|
||||
Then("counter equals {int}", value => {
|
||||
expect(counter).to.equal(value);
|
||||
});
|
||||
```
|
||||
|
||||
```gherkin
|
||||
Feature: Background Section
|
||||
|
||||
Background:
|
||||
Given counter has been reset
|
||||
|
||||
Scenario: Basic example #1
|
||||
When counter is incremented
|
||||
Then counter equals 1
|
||||
|
||||
Scenario: Basic example #2
|
||||
When counter is incremented
|
||||
When counter is incremented
|
||||
Then counter equals 2
|
||||
```
|
||||
|
||||
### Sharing context
|
||||
|
||||
You can share context between step definitions using `cy.as()` alias.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
Given('I go to the add new item page', () => {
|
||||
cy.visit('/addItem');
|
||||
});
|
||||
|
||||
When('I add a new item', () => {
|
||||
cy.get('input[name="addNewItem"]').as('addNewItemInput');
|
||||
cy.get('@addNewItemInput').type('My item');
|
||||
cy.get('button[name="submitItem"]').click();
|
||||
})
|
||||
|
||||
Then('I see new item added', () => {
|
||||
cy.get('td:contains("My item")');
|
||||
});
|
||||
|
||||
Then('I can add another item', () => {
|
||||
expect(cy.get('@addNewItemInput').should('be.empty');
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
For more information please visit: <https://docs.cypress.io/api/commands/as.html>
|
||||
|
||||
### Smart tagging
|
||||
|
||||
Start your tests without setting any tags. And then put a @focus on the scenario (or scenarios) you want to focus on while development or bug fixing.
|
||||
|
||||
For example:
|
||||
|
||||
```gherkin
|
||||
Feature: Smart Tagging
|
||||
|
||||
As a cucumber cypress plugin which handles Tags
|
||||
I want to allow people to select tests to run if focused
|
||||
So they can work more efficiently and have a shorter feedback loop
|
||||
|
||||
Scenario: This scenario should not run if @focus is on another scenario
|
||||
Then this unfocused scenario should not run
|
||||
|
||||
@focus
|
||||
Scenario: This scenario is focused and should run
|
||||
Then this focused scenario should run
|
||||
|
||||
@this-tag-affects-nothing
|
||||
Scenario: This scenario should also not run
|
||||
Then this unfocused scenario should not run
|
||||
|
||||
@focus
|
||||
Scenario: This scenario is also focused and also should run
|
||||
Then this focused scenario should run
|
||||
```
|
||||
|
||||
## How to run the tests
|
||||
|
||||
Run your Cypress Launcher the way you would usually do, for example:
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/cypress open
|
||||
```
|
||||
|
||||
click on a `.feature` file on the list of specs, and see the magic happening!
|
||||
|
||||
### Running tagged tests
|
||||
|
||||
You can use tags to select which test should run using [cucumber's tag expressions](https://github.com/cucumber/cucumber/tree/master/tag-expressions).
|
||||
Keep in mind we are using newer syntax, eg. `'not @foo and (@bar or @zap)'`.
|
||||
In order to initialize tests using tags you will have to run cypress and pass TAGS environment variable.
|
||||
|
||||
Example:
|
||||
|
||||
```shell
|
||||
./node_modules/.bin/cypress-tags run -e TAGS='not @foo and (@bar or @zap)'
|
||||
```
|
||||
|
||||
Please note - we use our own cypress-tags wrapper to speed things up.
|
||||
This wrapper calls the cypress executable from local modules and if not found it falls back to the globally installed one.
|
||||
For more details and examples please take a look to the [example repo](https://github.com/TheBrainFamily/cypress-cucumber-example).
|
||||
|
||||
### Ignoring specific scenarios using tags when executing test runner
|
||||
|
||||
You can also use tags to skip or ignore specific tests/scenarios when running cypress test runner (where you don't have the abilitiy to pass parameters like in the examples above for the execution)
|
||||
|
||||
The trick consists in adding the "env" property with the "TAGS" subproperty in the cypress.json configuration file. It would look something like this:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"env": {
|
||||
"TAGS": "not @ignore"
|
||||
},
|
||||
//rest of configuration options
|
||||
"baseUrl": "yourBaseUrl",
|
||||
"ignoreTestFiles": "*.js",
|
||||
//etc
|
||||
}
|
||||
```
|
||||
|
||||
Then, any scenarios tagged with @ignore will be skipped when running the tests using the cypress test runner
|
||||
|
||||
### Limiting to a subset of feature files
|
||||
|
||||
You can use a glob expression to select which feature files should be included.
|
||||
|
||||
Example:
|
||||
|
||||
```shell
|
||||
./node_modules/.bin/cypress-tags run -g 'cypress/integration/**/*.feature'
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
./node_modules/.bin/cypress-tags run --glob 'cypress/integration/**/*.feature'
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
<span style="color:orange">*DEPRECATED*</span>
|
||||
|
||||
This will not work if your glob pattern contains commas since Cypress expects comma delimited string of env variables.
|
||||
|
||||
```shell
|
||||
./node_modules/.bin/cypress-tags run -e GLOB='cypress/integration/**/*.feature'
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
The **cypress-cucumber-preprocessor** can generate a `cucumber.json` file output as it runs the features files. This is separate from, and in addition to, any Mocha reporter configured in Cypress.
|
||||
|
||||
These files are intended to be used with one of the many available Cucumber report generator packages.
|
||||
Seems to work fine with both <https://github.com/jenkinsci/cucumber-reports-plugin> and <https://github.com/wswebcreation/multiple-cucumber-html-reporter>
|
||||
|
||||
Output, by default, is written to the folder `cypress/cucumber-json`, and one file is generated per feature.
|
||||
|
||||
This behaviour is configurable. Use [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) to create a configuration for the plugin, see step definition discussion above and add the following to the cypress-cucumber-preprocessor section in package.json to turn it off or change the defaults:
|
||||
|
||||
```
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"cucumberJson": {
|
||||
"generate": true,
|
||||
"outputFolder": "cypress/cucumber-json",
|
||||
"filePrefix": "",
|
||||
"fileSuffix": ".cucumber"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Cucumber.json options
|
||||
|
||||
Option | Default value | Description
|
||||
------------ | ------------- | -------------
|
||||
outputFolder | `cypress/cucumber-json` | The folder to write the files to
|
||||
filePrefix | `''` *(no prefix)* | A separate json file is generated for each feature based on the name of the feature file. All generated file names will be prefixed with this option if specified
|
||||
fileSuffix | `.cucumber` | A suffix to add to each generated filename
|
||||
generate | `false` | Flag to output cucumber.json or not
|
||||
|
||||
## IDE support
|
||||
|
||||
### WebStorm
|
||||
|
||||
Note, only WebStorm 2019.2 and later versions are able to [resolve steps located outside of a step_definitions folder](https://youtrack.jetbrains.com/issue/WEB-11505)
|
||||
|
||||
### Intellij IDEA
|
||||
|
||||
Intellij IDEA Community Edition does not support cucumber in javascript, but the Ultimate Edition can provide the same level support for step resolution as WebStorm.
|
||||
|
||||
To enable cucumber step resolution in Intellij IDEA Ulimate edition you will need to download and enable the JetBrains [Cucumber JS plugin](https://plugins.jetbrains.com/plugin/7418-cucumber-js/). In WebStorm this plugin is already bundled into the distribution.
|
||||
|
||||
### Visual Studio Code
|
||||
|
||||
To get vscode to resolve your steps, install the [Cucumber (Gherkin) Full Support](https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete) extension from the marketplace.
|
||||
|
||||
You will also need to tell the extension the locations of your feature and step definition files [as described here](https://github.com/alexkrechik/VSCucumberAutoComplete#settings-example).
|
||||
|
||||
Note, that unlike WebStorm which will correctly identify multiple implementations of matching steps, the vscode extension currently resolves to the first matching occurence it finds on its path.
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
### Install
|
||||
|
||||
Install the plug-in type definitions:
|
||||
|
||||
```shell
|
||||
npm install --save-dev @types/cypress-cucumber-preprocessor
|
||||
```
|
||||
|
||||
### With out-of-the-box support
|
||||
|
||||
As of [Cypress
|
||||
v4.4.0](https://github.com/cypress-io/cypress/releases/tag/v4.4.0), TypeScript
|
||||
is supported out-of-the-box. To use it, add this to your `plugins/index.js`:
|
||||
|
||||
```javascript
|
||||
const browserify = require('@cypress/browserify-preprocessor');
|
||||
const cucumber = require('cypress-cucumber-preprocessor').default;
|
||||
const resolve = require('resolve');
|
||||
|
||||
module.exports = (on, config) => {
|
||||
const options = {
|
||||
...browserify.defaultOptions,
|
||||
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
|
||||
};
|
||||
|
||||
on('file:preprocessor', cucumber(options));
|
||||
};
|
||||
```
|
||||
|
||||
### With Webpack
|
||||
|
||||
You can also use a Webpack loader to process feature files (TypeScript supported). To see how it is done please take
|
||||
a look here: [cypress-cucumber-webpack-typescript-example](https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example)
|
||||
|
||||
### Without Webpack
|
||||
|
||||
If you want to use TypeScript, add this to your plugins/index.js:
|
||||
|
||||
```javascript
|
||||
const cucumber = require("cypress-cucumber-preprocessor").default;
|
||||
const browserify = require("@cypress/browserify-preprocessor");
|
||||
|
||||
module.exports = (on) => {
|
||||
const options = browserify.defaultOptions;
|
||||
|
||||
options.browserifyOptions.plugin.unshift(['tsify']);
|
||||
// Or, if you need a custom tsconfig.json for your test files:
|
||||
// options.browserifyOptions.plugin.unshift(['tsify', {project: 'path/to/other/tsconfig.json'}]);
|
||||
|
||||
on("file:preprocessor", cucumber(options));
|
||||
};
|
||||
```
|
||||
|
||||
...and install *tsify*. I'm assuming you already have typescript installed. :-)
|
||||
|
||||
```bash
|
||||
npm install tsify
|
||||
```
|
||||
|
||||
Then in your .ts files you need to make sure you either require/import the functions defining step definitions, or declare them as global:
|
||||
|
||||
```typescript
|
||||
declare const Given, When, Then;
|
||||
// OR
|
||||
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
|
||||
```
|
||||
|
||||
To see an example take a look here: [https://github.com/TheBrainFamily/cypress-cucumber-typescript-example/](https://github.com/TheBrainFamily/cypress-cucumber-typescript-example/)
|
||||
|
||||
<a name="legacy"></a>
|
||||
|
||||
## How to contribute
|
||||
|
||||
Install all dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Link the package:
|
||||
|
||||
```bash
|
||||
npm link
|
||||
npm link cypress-cucumber-preprocessor
|
||||
```
|
||||
|
||||
Run tests:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
### Submitting your PR
|
||||
|
||||
This repo uses [commitizen](https://github.com/commitizen/cz-cli) to manage commits messages and [semantic-release](https://github.com/semantic-release/semantic-release) to use those commit messages to automatically release this package with proper release version.
|
||||
|
||||
If you are confused please ask questions or/and read the documentation of these two fantastic tools! As far as the development goes, you should just do git commit from the command line, and commitizen will guide you through creating a proper commit message.
|
||||
|
||||
### Issues
|
||||
|
||||
Please let me know if you find any issues or have suggestions for improvements by opening a new issue.
|
||||
|
||||
## Roadmap
|
||||
|
||||
- (Under discussion) Add option to customize mocha template [#3](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues/3)
|
||||
|
||||
<a name="credits"></a>
|
||||
|
||||
## Credit where it's due
|
||||
|
||||
Based/inspired by the great work from [gherkin-testcafe](https://github.com/sitegeist/gherkin-testcafe), although, with this package we don't have to run Cypress programmatically - with an external runner, we can use Cypress as we are used to :)
|
||||
|
||||
Thanks to the Cypress team for the fantastic work and very exciting tool! :-)
|
||||
|
||||
Thanks to @fcurella for fantastic work with making the **cypress-cucumber-preprocessor** reactive to file changes. :-)
|
||||
|
||||
___
|
||||
|
||||
## Oldschool/Legacy Cucumber style
|
||||
|
||||
**Not recommended. Please let us know if you decide to use it!**
|
||||
|
||||
### Why avoid it
|
||||
|
||||
The problem with the legacy structure is that everything is global. This is problematic for multiple reasons.
|
||||
|
||||
- It makes it harder to create `.feature` files that read nicely - you have to make sure you are not stepping on toes of already existing step definitions. You should be able to write your tests without worrying about reusability, complex regexp matches, or anything like that. Just write a story. Explain what you want to see without getting into the details. Reuse in the .js files, not in something you should consider an always up-to-date, human-readable documentation.
|
||||
- The startup times get much worse - because we have to analyze all the different step definitions so we can match the .feature files to the test.
|
||||
- Hooks are problematic. If you put before() in a step definition file, you might think that it will run only for the .feature file related to that step definition. You try the feature you work on, everything seems fine and you push the code. Here comes a surprise - it will run for ALL .feature files in your whole project. Very unintuitive. And good luck debugging problems caused by that! This problem was not unique to this plugin, but to the way cucumberjs operates.
|
||||
|
||||
Let's look how this differs with the proposed structure. Assuming you want to have a hook before ./Google.feature file, just create a ./Google/before.js and put the hook there. This should take care of long requested feature - [https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues/25](#25)
|
||||
|
||||
If you have a few tests the "oldschool" style is completely fine. But for a large enterprise-grade application, with hundreds or sometimes thousands of .feature files, the fact that everything is global becomes a maintainability nightmare.
|
||||
|
||||
We suggest to put:
|
||||
|
||||
```json
|
||||
"ignoreTestFiles": "*.js"
|
||||
```
|
||||
|
||||
in your cypress.json to have a clean view of your tests in the cypress dashbord, and also so cypress doesn't try to run your step definition files as tests in CI.
|
||||
|
||||
### Step Definition location configuration
|
||||
|
||||
Step definition files are by default in: `cypress/support/step_definitions`. If you want to put them somewhere please use [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) format. For example, add to your package.json :
|
||||
|
||||
```javascript
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"step_definitions": "cypress/support/step_definitions/"
|
||||
}
|
||||
```
|
||||
|
||||
Follow your configuration or use the defaults and put your step definitions in `cypress/support/step_definitions`
|
||||
|
||||
Examples:
|
||||
cypress/support/step_definitions/google.js
|
||||
|
||||
```javascript
|
||||
import { Given } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
const url = 'https://google.com'
|
||||
Given('I open Google page', () => {
|
||||
cy.visit(url)
|
||||
})
|
||||
```
|
||||
|
||||
cypress/support/step_definitions/shared.js
|
||||
|
||||
```javascript
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then(`I see {string} in the title`, (title) => {
|
||||
cy.title().should('include', title)
|
||||
})
|
||||
```
|
31
node_modules/cypress-cucumber-preprocessor/circle.yml
generated
vendored
Normal file
31
node_modules/cypress-cucumber-preprocessor/circle.yml
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cypress/base:12
|
||||
working_directory: ~/cypress-cucumber-preprocessor
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: npm install
|
||||
command: npm install
|
||||
- run:
|
||||
name: link the package
|
||||
command: |
|
||||
npm link
|
||||
npm link cypress-cucumber-preprocessor
|
||||
- run:
|
||||
name: run tests
|
||||
command: npm test
|
||||
- run:
|
||||
name: slow test run, for sanity
|
||||
command: npm run test:each
|
||||
- run:
|
||||
name: Run on cypress-cucumber-example
|
||||
command: bash ./.scripts/runOnExample.bash
|
||||
- run:
|
||||
name: Run on cypress-cucumber-webpack-typescript-example
|
||||
command: bash ./.scripts/runOnWebpackTypescriptExample.bash
|
||||
- run:
|
||||
name: release
|
||||
command: npm run semantic-release || true
|
128
node_modules/cypress-cucumber-preprocessor/cypress-tags.js
generated
vendored
Executable file
128
node_modules/cypress-cucumber-preprocessor/cypress-tags.js
generated
vendored
Executable file
@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { Parser } = require("gherkin");
|
||||
const glob = require("glob");
|
||||
const fs = require("fs");
|
||||
const { execFileSync } = require("child_process");
|
||||
const {
|
||||
parseArgsOrDefault,
|
||||
stripCLIArguments,
|
||||
getGlobArg,
|
||||
} = require("./lib/cypressTagsHelpers");
|
||||
|
||||
const { shouldProceedCurrentStep } = require("./lib/tagsHelper");
|
||||
|
||||
const debug = (message, ...rest) =>
|
||||
process.env.DEBUG
|
||||
? // eslint-disable-next-line no-console
|
||||
console.log(`DEBUG: ${message}`, rest.length ? rest : "")
|
||||
: null;
|
||||
|
||||
const envGlob = getGlobArg();
|
||||
const envTags = parseArgsOrDefault("TAGS", "");
|
||||
|
||||
let specGlob = envGlob || "cypress/integration/**/*.feature";
|
||||
let ignoreGlob = "";
|
||||
let usingCypressConf = false;
|
||||
|
||||
if (!envGlob) {
|
||||
try {
|
||||
// TODO : curently we don't allow the override of the cypress.json path
|
||||
// maybe we can set this path in the plugin conf (package.json : "cypressConf": "test/cypress.json")
|
||||
// eslint-disable-next-line import/no-unresolved,global-require
|
||||
const cypressConf = require("../../cypress.json");
|
||||
const integrationFolder =
|
||||
cypressConf && cypressConf.integrationFolder
|
||||
? cypressConf.integrationFolder.replace(/\/$/, "")
|
||||
: "cypress/integration";
|
||||
|
||||
if (cypressConf && cypressConf.ignoreTestFiles) {
|
||||
ignoreGlob = cypressConf.ignoreTestFiles;
|
||||
}
|
||||
|
||||
if (cypressConf && cypressConf.testFiles) {
|
||||
let testFiles = !Array.isArray(cypressConf.testFiles)
|
||||
? cypressConf.testFiles.split(",")
|
||||
: cypressConf.testFiles;
|
||||
testFiles = testFiles.map((pattern) => `${integrationFolder}/${pattern}`);
|
||||
specGlob =
|
||||
testFiles.length > 1 ? `{${testFiles.join(",")}}` : testFiles[0];
|
||||
} else {
|
||||
specGlob = `${integrationFolder}/**/*.feature`;
|
||||
}
|
||||
console.log("Using cypress.json configuration:");
|
||||
console.log("Spec files: ", specGlob);
|
||||
if (ignoreGlob) console.log("Ignored files: ", ignoreGlob);
|
||||
} catch (err) {
|
||||
usingCypressConf = false;
|
||||
specGlob = "cypress/integration/**/*.feature";
|
||||
console.log("Failed to read cypress.json, using default configuration");
|
||||
console.log("Spec files: ", specGlob);
|
||||
}
|
||||
}
|
||||
|
||||
debug("Found glob", specGlob);
|
||||
debug("Found tag expression", envTags);
|
||||
|
||||
const paths = glob
|
||||
.sync(specGlob, {
|
||||
nodir: true,
|
||||
ignore: usingCypressConf ? ignoreGlob : "",
|
||||
})
|
||||
.filter((pathName) => pathName.endsWith(".feature"));
|
||||
|
||||
const featuresToRun = [];
|
||||
|
||||
paths.forEach((featurePath) => {
|
||||
const spec = `${fs.readFileSync(featurePath)}`;
|
||||
const parsedFeature = new Parser().parse(spec);
|
||||
|
||||
if (!parsedFeature.feature) {
|
||||
debug(`Feature: ${featurePath} is empty`);
|
||||
return;
|
||||
}
|
||||
|
||||
const featureTags = parsedFeature.feature.tags;
|
||||
const featureShouldRun = shouldProceedCurrentStep(featureTags, envTags);
|
||||
const taggedScenarioShouldRun = parsedFeature.feature.children.some(
|
||||
(section) =>
|
||||
section.tags &&
|
||||
section.tags.length &&
|
||||
shouldProceedCurrentStep(section.tags.concat(featureTags), envTags)
|
||||
);
|
||||
debug(
|
||||
`Feature: ${featurePath}, featureShouldRun: ${featureShouldRun}, taggedScenarioShouldRun: ${taggedScenarioShouldRun}`
|
||||
);
|
||||
if (featureShouldRun || taggedScenarioShouldRun) {
|
||||
featuresToRun.push(featurePath);
|
||||
}
|
||||
});
|
||||
|
||||
function getOsSpecificExecutable(command) {
|
||||
return process.platform === "win32" ? `${command}.cmd` : command;
|
||||
}
|
||||
|
||||
function getCypressExecutable() {
|
||||
const command = getOsSpecificExecutable(`${__dirname}/../.bin/cypress`);
|
||||
// fallback to the globally installed cypress instead
|
||||
return fs.existsSync(command) ? command : getOsSpecificExecutable("cypress");
|
||||
}
|
||||
|
||||
try {
|
||||
if (featuresToRun.length || envTags === "") {
|
||||
execFileSync(
|
||||
getCypressExecutable(),
|
||||
[...stripCLIArguments(["g", "glob"]), "--spec", featuresToRun.join(",")],
|
||||
{
|
||||
stdio: [process.stdin, process.stdout, process.stderr],
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("No matching tags found");
|
||||
process.exit(0);
|
||||
}
|
||||
} catch (e) {
|
||||
debug("Error while running cypress (or just a test failure)", e);
|
||||
process.exit(1);
|
||||
}
|
191
node_modules/cypress-cucumber-preprocessor/lib/createTestFromScenario.js
generated
vendored
Normal file
191
node_modules/cypress-cucumber-preprocessor/lib/createTestFromScenario.js
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
/* eslint-disable prefer-template */
|
||||
const statuses = require("cucumber/lib/status").default;
|
||||
const {
|
||||
resolveStepDefinition,
|
||||
resolveAndRunStepDefinition,
|
||||
resolveAndRunBeforeHooks,
|
||||
resolveAndRunAfterHooks,
|
||||
} = require("./resolveStepDefinition");
|
||||
const { generateCucumberJson } = require("./cukejson/generateCucumberJson");
|
||||
const { shouldProceedCurrentStep, getEnvTags } = require("./tagsHelper");
|
||||
|
||||
const replaceParameterTags = (rowData, text) =>
|
||||
Object.keys(rowData).reduce(
|
||||
(value, key) => value.replace(new RegExp(`<${key}>`, "g"), rowData[key]),
|
||||
text
|
||||
);
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
const stepTest = function (state, stepDetails, exampleRowData) {
|
||||
const step = resolveStepDefinition.call(
|
||||
this,
|
||||
stepDetails,
|
||||
state.feature.name
|
||||
);
|
||||
cy.then(() => state.onStartStep(stepDetails))
|
||||
.then((step && step.config) || {}, () =>
|
||||
resolveAndRunStepDefinition.call(
|
||||
this,
|
||||
stepDetails,
|
||||
replaceParameterTags,
|
||||
exampleRowData,
|
||||
state.feature.name
|
||||
)
|
||||
)
|
||||
.then(() => state.onFinishStep(stepDetails, statuses.PASSED));
|
||||
};
|
||||
|
||||
const runTest = (scenario, stepsToRun, rowData) => {
|
||||
const indexedSteps = stepsToRun.map((step, index) => ({ ...step, index }));
|
||||
|
||||
// should we actually run this scenario
|
||||
// or just mark it as skipped
|
||||
if (scenario.shouldRun) {
|
||||
// eslint-disable-next-line func-names
|
||||
it(scenario.name, function () {
|
||||
const state = window.testState;
|
||||
return cy
|
||||
.then(() => state.onStartScenario(scenario, indexedSteps))
|
||||
.then(() =>
|
||||
resolveAndRunBeforeHooks.call(this, scenario.tags, state.feature.name)
|
||||
)
|
||||
.then(() =>
|
||||
indexedSteps.forEach((step) =>
|
||||
stepTest.call(this, state, step, rowData)
|
||||
)
|
||||
)
|
||||
.then(() => state.onFinishScenario(scenario));
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line func-names,prefer-arrow-callback
|
||||
it(scenario.name, function () {
|
||||
// register this scenario with the cucumber data collector
|
||||
// but don't run it
|
||||
// Tell mocha this is a skipped test so it also shows correctly in Cypress
|
||||
const state = window.testState;
|
||||
cy.then(() => state.onStartScenario(scenario, indexedSteps))
|
||||
.then(() => state.onFinishScenario(scenario))
|
||||
// eslint-disable-next-line func-names
|
||||
.then(function () {
|
||||
return this.skip();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const cleanupFilename = (s) => s.split(".")[0];
|
||||
|
||||
const writeCucumberJsonFile = (json) => {
|
||||
const outputFolder =
|
||||
window.cucumberJson.outputFolder || "cypress/cucumber-json";
|
||||
const outputPrefix = window.cucumberJson.filePrefix || "";
|
||||
const outputSuffix = window.cucumberJson.fileSuffix || ".cucumber";
|
||||
const fileName = json[0] ? cleanupFilename(json[0].uri) : "empty";
|
||||
const outFile = `${outputFolder}/${outputPrefix}${fileName}${outputSuffix}.json`;
|
||||
cy.writeFile(outFile, json, { log: false });
|
||||
};
|
||||
|
||||
const createTestFromScenarios = (
|
||||
allScenarios,
|
||||
backgroundSection,
|
||||
testState
|
||||
) => {
|
||||
// eslint-disable-next-line func-names, prefer-arrow-callback
|
||||
before(function () {
|
||||
cy.then(() => testState.onStartTest());
|
||||
});
|
||||
|
||||
// ctx is cleared between each 'it'
|
||||
// eslint-disable-next-line func-names, prefer-arrow-callback
|
||||
beforeEach(function () {
|
||||
window.testState = testState;
|
||||
|
||||
const failHandler = (_, err) => {
|
||||
testState.onFail(err);
|
||||
};
|
||||
|
||||
Cypress.mocha.getRunner().on("fail", failHandler);
|
||||
});
|
||||
|
||||
allScenarios.forEach((section) => {
|
||||
if (section.examples) {
|
||||
const hasEnvTags = !!getEnvTags();
|
||||
section.examples.forEach((example) => {
|
||||
const exampleValues = [];
|
||||
const exampleLocations = [];
|
||||
const shouldRunExamples =
|
||||
!hasEnvTags ||
|
||||
shouldProceedCurrentStep(example.tags.concat(section.tags));
|
||||
|
||||
example.tableBody.forEach((row, rowIndex) => {
|
||||
exampleLocations[rowIndex] = row.location;
|
||||
example.tableHeader.cells.forEach((header, headerIndex) => {
|
||||
exampleValues[rowIndex] = {
|
||||
...exampleValues[rowIndex],
|
||||
[header.value]: row.cells[headerIndex].value,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
exampleValues.forEach((rowData, index) => {
|
||||
// eslint-disable-next-line prefer-arrow-callback
|
||||
const scenarioName = replaceParameterTags(rowData, section.name);
|
||||
const uniqueScenarioName = `${scenarioName} (example #${index + 1})`;
|
||||
const exampleSteps = section.steps.map((step) => {
|
||||
const newStep = { ...step };
|
||||
newStep.text = replaceParameterTags(rowData, newStep.text);
|
||||
return newStep;
|
||||
});
|
||||
|
||||
const stepsToRun = backgroundSection
|
||||
? backgroundSection.steps.concat(exampleSteps)
|
||||
: exampleSteps;
|
||||
|
||||
const scenarioExample = {
|
||||
...section,
|
||||
// tags on scenario's should be inherited by examples (https://cucumber.io/docs/cucumber/api/#tags)
|
||||
tags: example.tags.concat(section.tags),
|
||||
shouldRun: shouldRunExamples,
|
||||
name: uniqueScenarioName,
|
||||
example: exampleLocations[index],
|
||||
};
|
||||
|
||||
runTest.call(this, scenarioExample, stepsToRun, rowData);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const stepsToRun = backgroundSection
|
||||
? backgroundSection.steps.concat(section.steps)
|
||||
: section.steps;
|
||||
|
||||
runTest.call(this, section, stepsToRun);
|
||||
}
|
||||
});
|
||||
|
||||
// eslint-disable-next-line func-names, prefer-arrow-callback
|
||||
after(function () {
|
||||
cy.then(() => testState.onFinishTest()).then(() => {
|
||||
if (window.cucumberJson && window.cucumberJson.generate) {
|
||||
const json = generateCucumberJson(testState);
|
||||
writeCucumberJsonFile(json);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line func-names, prefer-arrow-callback
|
||||
afterEach(function () {
|
||||
if (testState.currentScenario && testState.currentScenario.shouldRun) {
|
||||
cy.then(() =>
|
||||
resolveAndRunAfterHooks.call(
|
||||
this,
|
||||
testState.currentScenario.tags,
|
||||
testState.feature.name
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
createTestFromScenarios,
|
||||
};
|
48
node_modules/cypress-cucumber-preprocessor/lib/createTestsFromFeature.js
generated
vendored
Normal file
48
node_modules/cypress-cucumber-preprocessor/lib/createTestsFromFeature.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
const { CucumberDataCollector } = require("./cukejson/cucumberDataCollector");
|
||||
const { createTestFromScenarios } = require("./createTestFromScenario");
|
||||
const { shouldProceedCurrentStep, getEnvTags } = require("./tagsHelper");
|
||||
|
||||
const createTestsFromFeature = (filePath, spec) => {
|
||||
const testState = new CucumberDataCollector(filePath, spec);
|
||||
const featureTags = testState.feature.tags;
|
||||
const hasEnvTags = !!getEnvTags();
|
||||
const anyFocused =
|
||||
testState.feature.children.filter(
|
||||
(section) => section.tags && section.tags.find((t) => t.name === "@focus")
|
||||
).length > 0;
|
||||
const backgroundSection = testState.feature.children.find(
|
||||
(section) => section.type === "Background"
|
||||
);
|
||||
const allScenarios = testState.feature.children.filter(
|
||||
(section) => section.type !== "Background"
|
||||
);
|
||||
|
||||
// tags on features should be inherited by scenario's (https://cucumber.io/docs/cucumber/api/#tags)
|
||||
allScenarios.forEach((section) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
section.tags = section.tags.concat(featureTags);
|
||||
});
|
||||
|
||||
const scenariosToRun = allScenarios.filter((section) => {
|
||||
let shouldRun;
|
||||
// only just run focused if no env tags set
|
||||
// https://github.com/TheBrainFamily/cypress-cucumber-example#smart-tagging
|
||||
if (!hasEnvTags && anyFocused) {
|
||||
shouldRun = section.tags.find((t) => t.name === "@focus");
|
||||
} else {
|
||||
shouldRun = !hasEnvTags || shouldProceedCurrentStep(section.tags);
|
||||
}
|
||||
return shouldRun;
|
||||
});
|
||||
// create tests for all the scenarios
|
||||
// but flag only the ones that should be run
|
||||
scenariosToRun.forEach((section) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
section.shouldRun = true;
|
||||
});
|
||||
createTestFromScenarios(allScenarios, backgroundSection, testState);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
createTestsFromFeature,
|
||||
};
|
36
node_modules/cypress-cucumber-preprocessor/lib/cucumberTemplate.js
generated
vendored
Normal file
36
node_modules/cypress-cucumber-preprocessor/lib/cucumberTemplate.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
|
||||
const getPathFor = (file) => {
|
||||
if (os.platform() === "win32") {
|
||||
return path
|
||||
.join(__dirname.replace(/\\/g, "\\\\"), file)
|
||||
.replace(/\\/g, "\\\\");
|
||||
}
|
||||
return `${__dirname}/${file}`;
|
||||
};
|
||||
|
||||
exports.cucumberTemplate = `
|
||||
const {
|
||||
resolveAndRunStepDefinition,
|
||||
defineParameterType,
|
||||
Given,
|
||||
When,
|
||||
Then,
|
||||
And,
|
||||
But,
|
||||
Before,
|
||||
After,
|
||||
defineStep
|
||||
} = require("${getPathFor("resolveStepDefinition")}");
|
||||
window.Given = Given;
|
||||
window.When = When;
|
||||
window.Then = Then;
|
||||
window.And = And;
|
||||
window.But = But;
|
||||
window.defineParameterType = defineParameterType;
|
||||
window.defineStep = defineStep;
|
||||
const {
|
||||
createTestsFromFeature
|
||||
} = require("${getPathFor("createTestsFromFeature")}");
|
||||
`;
|
165
node_modules/cypress-cucumber-preprocessor/lib/cukejson/cucumberDataCollector.js
generated
vendored
Normal file
165
node_modules/cypress-cucumber-preprocessor/lib/cukejson/cucumberDataCollector.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
const { Parser } = require("gherkin");
|
||||
const statuses = require("cucumber/lib/status").default;
|
||||
|
||||
class CucumberDataCollector {
|
||||
constructor(uri, spec) {
|
||||
this.feature = new Parser().parse(spec.toString()).feature;
|
||||
this.scenarioSteps = {};
|
||||
this.runScenarios = {};
|
||||
this.runTests = {};
|
||||
this.stepResults = {};
|
||||
this.testError = null;
|
||||
this.uri = uri;
|
||||
this.spec = spec;
|
||||
|
||||
this.currentScenario = null;
|
||||
this.currentStep = 0;
|
||||
|
||||
this.timer = Date.now();
|
||||
|
||||
this.logStep = (step) => {
|
||||
Cypress.log({
|
||||
name: "step",
|
||||
displayName: step.keyword,
|
||||
message: `**${step.text}**`,
|
||||
consoleProps: () => ({ feature: this.uri, step }),
|
||||
});
|
||||
};
|
||||
|
||||
this.onStartTest = () => {};
|
||||
|
||||
this.onFinishTest = () => {
|
||||
if (this.testError) {
|
||||
this.attachErrorToFailingStep();
|
||||
}
|
||||
};
|
||||
|
||||
this.onStartScenario = (scenario, stepsToRun) => {
|
||||
this.currentScenario = scenario;
|
||||
this.currentStep = 0;
|
||||
this.stepResults = {};
|
||||
this.scenarioSteps[scenario.name] = stepsToRun;
|
||||
this.testError = null;
|
||||
|
||||
stepsToRun.forEach((step) => {
|
||||
this.stepResults[step.index] = { status: statuses.PENDING };
|
||||
});
|
||||
this.runScenarios[scenario.name] = scenario;
|
||||
};
|
||||
|
||||
this.onFinishScenario = (scenario) => {
|
||||
this.markStillPendingStepsAsSkipped(scenario);
|
||||
this.recordScenarioResult(scenario);
|
||||
};
|
||||
|
||||
this.onStartStep = (step) => {
|
||||
this.currentStep = step.index;
|
||||
this.setStepToPending(step);
|
||||
this.logStep(step);
|
||||
};
|
||||
|
||||
this.onFinishStep = (step, result) => {
|
||||
this.recordStepResult(step, result);
|
||||
};
|
||||
|
||||
this.onFail = (err) => {
|
||||
this.testError = err;
|
||||
if (
|
||||
err.message &&
|
||||
err.message.indexOf("Step implementation missing for") > -1
|
||||
) {
|
||||
this.stepResults[this.currentStep] = {
|
||||
status: statuses.UNDEFINED,
|
||||
duration: this.timeTaken(),
|
||||
};
|
||||
} else if (err.constructor.name === "Pending") {
|
||||
// cypress marks skipped mocha tests as pending
|
||||
// https://github.com/cypress-io/cypress/issues/3092
|
||||
// don't record this error and mark the step as skipped
|
||||
this.stepResults[this.currentStep] = {
|
||||
status: statuses.SKIPPED,
|
||||
duration: this.timeTaken(),
|
||||
};
|
||||
} else {
|
||||
this.stepResults[this.currentStep] = {
|
||||
status: statuses.FAILED,
|
||||
duration: this.timeTaken(),
|
||||
exception: this.testError,
|
||||
};
|
||||
}
|
||||
this.onFinishScenario(this.currentScenario);
|
||||
};
|
||||
|
||||
this.timeTaken = () => {
|
||||
const now = Date.now();
|
||||
const duration = now - this.timer;
|
||||
this.timer = now;
|
||||
return duration;
|
||||
};
|
||||
|
||||
this.formatTestCase = (scenario) => {
|
||||
const line = scenario.example
|
||||
? scenario.example.line
|
||||
: scenario.location.line;
|
||||
return {
|
||||
sourceLocation: { uri, line },
|
||||
};
|
||||
};
|
||||
|
||||
this.attachErrorToFailingStep = () => {
|
||||
Object.keys(this.runTests).forEach((test) => {
|
||||
const stepResults = this.runTests[test];
|
||||
Object.keys(stepResults).forEach((stepIdx) => {
|
||||
const stepResult = stepResults[stepIdx];
|
||||
if (stepResult.result === statuses.FAILED) {
|
||||
stepResult.exception = this.testError;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.markStillPendingStepsAsSkipped = (scenario) => {
|
||||
this.runTests[scenario.name] = Object.keys(this.stepResults).map(
|
||||
(key) => {
|
||||
const result = this.stepResults[key];
|
||||
return {
|
||||
...result,
|
||||
status:
|
||||
result.status === statuses.PENDING
|
||||
? statuses.SKIPPED
|
||||
: result.status,
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
this.recordScenarioResult = (scenario) => {
|
||||
const allSkipped = this.areAllStepsSkipped(scenario.name);
|
||||
const anyFailed = this.anyStepsHaveFailed(scenario.name);
|
||||
if (allSkipped) this.runTests[scenario.name].result = statuses.SKIPPED;
|
||||
else
|
||||
this.runTests[scenario.name].result = anyFailed
|
||||
? statuses.FAILED
|
||||
: statuses.PASSED;
|
||||
};
|
||||
|
||||
this.setStepToPending = (step) => {
|
||||
this.stepResults[step.index] = { status: statuses.PENDING };
|
||||
};
|
||||
|
||||
this.recordStepResult = (step, result) => {
|
||||
this.stepResults[step.index] = {
|
||||
status: result,
|
||||
duration: this.timeTaken(),
|
||||
};
|
||||
};
|
||||
|
||||
this.areAllStepsSkipped = (name) =>
|
||||
this.runTests[name].every((e) => e.status === statuses.SKIPPED);
|
||||
|
||||
this.anyStepsHaveFailed = (name) =>
|
||||
this.runTests[name].find((e) => e.status === statuses.FAILED) !==
|
||||
undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { CucumberDataCollector };
|
160
node_modules/cypress-cucumber-preprocessor/lib/cukejson/cucumberDataCollector.test.js
generated
vendored
Normal file
160
node_modules/cypress-cucumber-preprocessor/lib/cukejson/cucumberDataCollector.test.js
generated
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
const fs = require("fs");
|
||||
const statuses = require("cucumber/lib/status").default;
|
||||
const { CucumberDataCollector } = require("./cucumberDataCollector");
|
||||
const { generateCucumberJson } = require("./generateCucumberJson");
|
||||
|
||||
window.cucumberJson = { generate: true };
|
||||
|
||||
const assertCucumberJson = (json, expectedResults) => {
|
||||
expect(json).to.have.length(1);
|
||||
expect(json[0].keyword).to.eql("Feature");
|
||||
expect(json[0].name).to.eql("Being a plugin");
|
||||
expect(json[0].elements).to.have.length(1);
|
||||
expect(json[0].elements[0].keyword).to.eql("Scenario");
|
||||
expect(json[0].elements[0].name).to.eql("Basic example");
|
||||
expect(json[0].elements[0].steps).to.have.length(3);
|
||||
expect(json[0].elements[0].steps[0].keyword).to.equal("Given ");
|
||||
expect(json[0].elements[0].steps[0].name).to.equal(
|
||||
"a feature and a matching step definition file"
|
||||
);
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
expect(json[0].elements[0].steps[0].result).to.be.not.null;
|
||||
expect(json[0].elements[0].steps[0].result.status).to.eql(expectedResults[0]);
|
||||
expect(json[0].elements[0].steps[1].keyword).to.equal("When ");
|
||||
expect(json[0].elements[0].steps[1].name).to.equal("I run cypress tests");
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
expect(json[0].elements[0].steps[1].result).to.be.not.null;
|
||||
expect(json[0].elements[0].steps[1].result.status).to.eql(expectedResults[1]);
|
||||
expect(json[0].elements[0].steps[2].keyword).to.equal("Then ");
|
||||
expect(json[0].elements[0].steps[2].name).to.equal("they run properly");
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
expect(json[0].elements[0].steps[2].result).to.be.not.null;
|
||||
expect(json[0].elements[0].steps[2].result.status).to.eql(expectedResults[2]);
|
||||
};
|
||||
describe("Cucumber Data Collector", () => {
|
||||
const scenario = {
|
||||
type: "Scenario",
|
||||
tags: [],
|
||||
location: { line: 7, column: 3 },
|
||||
keyword: "Scenario",
|
||||
name: "Basic example",
|
||||
steps: [
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 8, column: 5 },
|
||||
keyword: "Given ",
|
||||
text: "a feature and a matching step definition file",
|
||||
},
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 9, column: 5 },
|
||||
keyword: "When ",
|
||||
text: "I run cypress tests",
|
||||
},
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 10, column: 5 },
|
||||
keyword: "Then ",
|
||||
text: "they run properly",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const stepsToRun = [
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 8, column: 5 },
|
||||
keyword: "Given ",
|
||||
text: "a feature and a matching step definition file",
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 9, column: 5 },
|
||||
keyword: "When ",
|
||||
text: "I run cypress tests",
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
type: "Step",
|
||||
location: { line: 10, column: 5 },
|
||||
keyword: "Then ",
|
||||
text: "they run properly",
|
||||
index: 2,
|
||||
},
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
const filePath = "./cypress/integration/Plugin.feature";
|
||||
const spec = fs.readFileSync(filePath);
|
||||
this.testState = new CucumberDataCollector(filePath, spec);
|
||||
this.testState.onStartTest();
|
||||
});
|
||||
|
||||
it("runs", () => {
|
||||
this.testState.onFinishTest();
|
||||
const json = generateCucumberJson(this.testState);
|
||||
expect(json).to.have.length(0);
|
||||
});
|
||||
|
||||
it("records pending scenarios", () => {
|
||||
this.testState.onStartScenario(scenario, stepsToRun);
|
||||
this.testState.onFinishScenario(scenario);
|
||||
this.testState.onFinishTest();
|
||||
const json = generateCucumberJson(this.testState);
|
||||
assertCucumberJson(json, [
|
||||
statuses.SKIPPED,
|
||||
statuses.SKIPPED,
|
||||
statuses.SKIPPED,
|
||||
]);
|
||||
});
|
||||
it("records passed scenarios", () => {
|
||||
this.testState.onStartScenario(scenario, stepsToRun);
|
||||
this.testState.onStartStep(stepsToRun[0]);
|
||||
this.testState.onFinishStep(stepsToRun[0], statuses.PASSED);
|
||||
this.testState.onStartStep(stepsToRun[1]);
|
||||
this.testState.onFinishStep(stepsToRun[1], statuses.PASSED);
|
||||
this.testState.onStartStep(stepsToRun[2]);
|
||||
this.testState.onFinishStep(stepsToRun[2], statuses.PASSED);
|
||||
this.testState.onFinishScenario(scenario);
|
||||
this.testState.onFinishTest();
|
||||
const json = generateCucumberJson(this.testState);
|
||||
assertCucumberJson(json, [
|
||||
statuses.PASSED,
|
||||
statuses.PASSED,
|
||||
statuses.PASSED,
|
||||
]);
|
||||
});
|
||||
|
||||
it("records failed scenarios", () => {
|
||||
this.testState.onStartScenario(scenario, stepsToRun);
|
||||
this.testState.onStartStep(stepsToRun[0]);
|
||||
this.testState.onFinishStep(stepsToRun[0], statuses.PASSED);
|
||||
this.testState.onStartStep(stepsToRun[1]);
|
||||
this.testState.onFinishStep(stepsToRun[1], statuses.FAILED);
|
||||
this.testState.onFinishScenario(scenario);
|
||||
this.testState.onFinishTest();
|
||||
const json = generateCucumberJson(this.testState);
|
||||
assertCucumberJson(json, [
|
||||
statuses.PASSED,
|
||||
statuses.FAILED,
|
||||
statuses.SKIPPED,
|
||||
]);
|
||||
});
|
||||
|
||||
it("handles missing steps", () => {
|
||||
this.testState.onStartScenario(scenario, stepsToRun);
|
||||
this.testState.onStartStep(stepsToRun[0]);
|
||||
this.testState.onFinishStep(stepsToRun[0], statuses.PASSED);
|
||||
this.testState.onStartStep(stepsToRun[1]);
|
||||
this.testState.onFinishStep(stepsToRun[1], statuses.UNDEFINED);
|
||||
this.testState.onFinishScenario(scenario);
|
||||
this.testState.onFinishTest();
|
||||
const json = generateCucumberJson(this.testState);
|
||||
assertCucumberJson(json, [
|
||||
statuses.PASSED,
|
||||
statuses.UNDEFINED,
|
||||
statuses.SKIPPED,
|
||||
]);
|
||||
});
|
||||
});
|
72
node_modules/cypress-cucumber-preprocessor/lib/cukejson/generateCucumberJson.js
generated
vendored
Normal file
72
node_modules/cypress-cucumber-preprocessor/lib/cukejson/generateCucumberJson.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
const { EventEmitter } = require("events");
|
||||
const { generateEvents } = require("gherkin");
|
||||
const JsonFormatter = require("cucumber/lib/formatter/json_formatter").default;
|
||||
const formatterHelpers = require("cucumber/lib/formatter/helpers");
|
||||
|
||||
function generateCucumberJson(state) {
|
||||
let output = "";
|
||||
const logFn = (data) => {
|
||||
output += data;
|
||||
};
|
||||
|
||||
const eventBroadcaster = new EventEmitter();
|
||||
|
||||
function storePickle({ pickle, uri }) {
|
||||
eventBroadcaster.emit("pickle-accepted", { pickle, uri });
|
||||
}
|
||||
|
||||
eventBroadcaster.on("pickle", storePickle);
|
||||
|
||||
// eslint-disable-next-line no-new
|
||||
new JsonFormatter({
|
||||
eventBroadcaster,
|
||||
eventDataCollector: new formatterHelpers.EventDataCollector(
|
||||
eventBroadcaster
|
||||
),
|
||||
log: logFn,
|
||||
});
|
||||
|
||||
// Start feeding the recorded test run into the JsonFormatter
|
||||
|
||||
// Feed in the static test structure
|
||||
generateEvents(state.spec.toString(), state.uri).forEach((event) => {
|
||||
eventBroadcaster.emit(event.type, event);
|
||||
});
|
||||
|
||||
// Feed in the results from the recorded scenarios and steps
|
||||
Object.keys(state.runTests).forEach((test) => {
|
||||
const scenario = state.runScenarios[test];
|
||||
const stepResults = state.runTests[test];
|
||||
const stepsToRun = state.scenarioSteps[test];
|
||||
const steps = stepsToRun.map((step) => ({
|
||||
sourceLocation: { uri: state.uri, line: step.location.line },
|
||||
}));
|
||||
eventBroadcaster.emit("test-case-prepared", {
|
||||
sourceLocation: state.formatTestCase(scenario).sourceLocation,
|
||||
steps,
|
||||
});
|
||||
stepResults.forEach((stepResult, stepIdx) => {
|
||||
eventBroadcaster.emit("test-step-prepared", {
|
||||
index: stepIdx,
|
||||
testCase: state.formatTestCase(scenario),
|
||||
});
|
||||
eventBroadcaster.emit("test-step-finished", {
|
||||
index: stepIdx,
|
||||
testCase: state.formatTestCase(scenario),
|
||||
result: stepResult,
|
||||
});
|
||||
if (stepResult.attachment) {
|
||||
eventBroadcaster.emit("test-step-attachment", stepResult.attachment);
|
||||
}
|
||||
});
|
||||
eventBroadcaster.emit("test-case-finished", {
|
||||
sourceLocation: state.formatTestCase(scenario).sourceLocation,
|
||||
result: state.runTests[scenario.name].result,
|
||||
});
|
||||
});
|
||||
eventBroadcaster.emit("test-run-finished", {});
|
||||
|
||||
return JSON.parse(output);
|
||||
}
|
||||
|
||||
module.exports = { generateCucumberJson };
|
0
node_modules/cypress-cucumber-preprocessor/lib/cypressExecutionInstance.js
generated
vendored
Normal file
0
node_modules/cypress-cucumber-preprocessor/lib/cypressExecutionInstance.js
generated
vendored
Normal file
59
node_modules/cypress-cucumber-preprocessor/lib/cypressTagsHelpers.js
generated
vendored
Normal file
59
node_modules/cypress-cucumber-preprocessor/lib/cypressTagsHelpers.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
const minimist = require("minimist");
|
||||
const dargs = require("dargs");
|
||||
|
||||
const minimistConfig = {
|
||||
alias: { g: "glob" },
|
||||
string: ["g"],
|
||||
};
|
||||
|
||||
function stripCLIArguments(argsToRemove = []) {
|
||||
const command = process.argv[2];
|
||||
const userOptions = process.argv.slice(3);
|
||||
|
||||
const minimistArgs = minimist(userOptions);
|
||||
const argsAndAliasesToExclude =
|
||||
argsToRemove.length > 0
|
||||
? Object.entries(minimistConfig.alias)
|
||||
.map(([key, value]) => [key, value].flat())
|
||||
.filter((aliasedOption) =>
|
||||
aliasedOption.some((option) => argsToRemove.includes(option))
|
||||
)
|
||||
.flat()
|
||||
: [];
|
||||
|
||||
return [
|
||||
command,
|
||||
...dargs(minimistArgs, {
|
||||
excludes: [...new Set([...argsAndAliasesToExclude, ...argsToRemove])],
|
||||
useEquals: false,
|
||||
}),
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Users will be expected to pass args by --glob/-g to avoid issues related to commas in those parameters.
|
||||
*/
|
||||
function parseArgsOrDefault(argPrefix, defaultValue) {
|
||||
const matchedArg = process.argv
|
||||
.slice(2)
|
||||
.find((arg) => arg.includes(`${argPrefix}=`));
|
||||
|
||||
// Cypress requires env vars to be passed as comma separated list
|
||||
// otherwise it only accepts the last provided variable,
|
||||
// the way we replace here accomodates for that.
|
||||
const argValue = matchedArg
|
||||
? matchedArg.replace(new RegExp(`.*${argPrefix}=`), "").replace(/,.*/, "")
|
||||
: "";
|
||||
|
||||
return argValue !== "" ? argValue : defaultValue;
|
||||
}
|
||||
|
||||
function getGlobArg() {
|
||||
const args = minimist(process.argv.slice(2), minimistConfig);
|
||||
return args.g || parseArgsOrDefault("GLOB", false);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
stripCLIArguments,
|
||||
parseArgsOrDefault,
|
||||
getGlobArg,
|
||||
};
|
82
node_modules/cypress-cucumber-preprocessor/lib/cypressTagsHelpers.test.js
generated
vendored
Normal file
82
node_modules/cypress-cucumber-preprocessor/lib/cypressTagsHelpers.test.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
const { stripCLIArguments, getGlobArg } = require("./cypressTagsHelpers");
|
||||
|
||||
const processArgv = process.argv;
|
||||
|
||||
describe("stripCLIArguments function should return correct args array", () => {
|
||||
beforeEach(() => {
|
||||
process.argv = ["path/to/node", "path/to/file", "run"];
|
||||
});
|
||||
|
||||
test("when only target option is present", () => {
|
||||
process.argv.push(...["-g", "cypress/integration/**/*.feature"]);
|
||||
expect(stripCLIArguments(["g"])).to.eql(["run"]);
|
||||
});
|
||||
|
||||
test("when target option is a word", () => {
|
||||
process.argv.push(...["--glob", "cypress/integration/**/*.feature"]);
|
||||
expect(stripCLIArguments(["glob"])).to.eql(["run"]);
|
||||
});
|
||||
|
||||
test("when option doesn't have a value tied to it", () => {
|
||||
process.argv.push(...["-g"]);
|
||||
expect(stripCLIArguments(["g"])).to.eql(["run"]);
|
||||
});
|
||||
|
||||
test("when there are multiple options but only one is target for removal", () => {
|
||||
process.argv.push(...["-g", "-t"]);
|
||||
expect(stripCLIArguments(["g"])).to.eql(["run", "-t"]);
|
||||
});
|
||||
|
||||
test("when there are multiple options to remove", () => {
|
||||
process.argv.push(...["-g", "-t", "cypress tags string"]);
|
||||
expect(stripCLIArguments(["g", "t"])).to.eql(["run"]);
|
||||
});
|
||||
|
||||
test("when option is coupled with other ones like -tg", () => {
|
||||
process.argv.push(...["-tg", "cypress/integration/**/*.feature"]);
|
||||
expect(stripCLIArguments(["t"])).to.eql([
|
||||
"run",
|
||||
"-g",
|
||||
"cypress/integration/**/*.feature",
|
||||
]);
|
||||
});
|
||||
|
||||
test("when option is coupled with other ones like -gt where t has a value", () => {
|
||||
process.argv.push(...["-gt", "cypress tags string"]);
|
||||
expect(stripCLIArguments(["t"])).to.eql(["run", "-g"]);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.argv = processArgv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("getGlobArg function should return", () => {
|
||||
beforeEach(() => {
|
||||
process.argv = ["path/to/node", "path/to/file", "run"];
|
||||
});
|
||||
|
||||
test("glob pattern when using -g or --glob option", () => {
|
||||
process.argv.push(...["-g", "cypress/integration/**/*.feature"]);
|
||||
expect(getGlobArg()).to.equal("cypress/integration/**/*.feature");
|
||||
});
|
||||
|
||||
test("glob pattern containing commas when using -g option", () => {
|
||||
process.argv.push(...["-g", "cypress/integration/**/1,2*.feature"]);
|
||||
expect(getGlobArg()).to.equal("cypress/integration/**/1,2*.feature");
|
||||
});
|
||||
|
||||
test("glob pattern containing braced sections when using -g option", () => {
|
||||
process.argv.push(...["-g", "cypress/integration/**/{1,2}*.feature"]);
|
||||
expect(getGlobArg()).to.equal("cypress/integration/**/{1,2}*.feature");
|
||||
});
|
||||
|
||||
test("glob pattern when using env variables GLOB=", () => {
|
||||
process.argv.push(...["-e", "GLOB=cypress/integration/**/*.feature"]);
|
||||
expect(getGlobArg()).to.equal("cypress/integration/**/*.feature");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.argv = processArgv;
|
||||
});
|
||||
});
|
123
node_modules/cypress-cucumber-preprocessor/lib/featuresLoader.js
generated
vendored
Normal file
123
node_modules/cypress-cucumber-preprocessor/lib/featuresLoader.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
const glob = require("glob");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { Parser } = require("gherkin");
|
||||
const log = require("debug")("cypress:cucumber");
|
||||
const jsStringEscape = require("js-string-escape");
|
||||
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
const { cucumberTemplate } = require("./cucumberTemplate");
|
||||
const { getCucumberJsonConfig } = require("./getCucumberJsonConfig");
|
||||
const {
|
||||
isNonGlobalStepDefinitionsMode,
|
||||
} = require("./isNonGlobalStepDefinitionsMode");
|
||||
|
||||
const createCucumber = (
|
||||
specs,
|
||||
globalToRequire,
|
||||
nonGlobalToRequire,
|
||||
cucumberJson
|
||||
) =>
|
||||
`
|
||||
${cucumberTemplate}
|
||||
window.cucumberJson = ${JSON.stringify(cucumberJson)};
|
||||
|
||||
var moduleCache = arguments[5];
|
||||
|
||||
function clearFromCache(moduleId, instance){
|
||||
if(isWebpack()){
|
||||
delete require.cache[moduleId];
|
||||
} else {
|
||||
clearFromCacheBrowserify(instance);
|
||||
}
|
||||
}
|
||||
|
||||
function isWebpack(){
|
||||
return !!require.cache
|
||||
}
|
||||
|
||||
// Stolen from https://github.com/browserify/browserify/issues/1444
|
||||
function clearFromCacheBrowserify(instance) {
|
||||
for(const key in moduleCache)
|
||||
{
|
||||
if(moduleCache[key].exports == instance)
|
||||
{
|
||||
delete moduleCache[key];
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error("could not clear instance from browserify module cache");
|
||||
}
|
||||
|
||||
${globalToRequire.join("\n")}
|
||||
|
||||
${specs
|
||||
.map(
|
||||
({ spec, filePath, name }) => `
|
||||
describe(\`${name}\`, function() {
|
||||
window.currentFeatureName = \`${name}\`
|
||||
${
|
||||
nonGlobalToRequire &&
|
||||
nonGlobalToRequire
|
||||
.find((fileSteps) => fileSteps[filePath])
|
||||
[filePath].join("\n")
|
||||
}
|
||||
|
||||
createTestsFromFeature('${path.basename(filePath)}', '${jsStringEscape(
|
||||
spec
|
||||
)}');
|
||||
})
|
||||
`
|
||||
)
|
||||
.join("\n")}
|
||||
`;
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
module.exports = function (_, filePath = this.resourcePath) {
|
||||
log("compiling", filePath);
|
||||
|
||||
const features = glob.sync(`${path.dirname(filePath)}/**/*.feature`);
|
||||
|
||||
let globalStepDefinitionsToRequire = [];
|
||||
let nonGlobalStepDefinitionsToRequire;
|
||||
|
||||
if (isNonGlobalStepDefinitionsMode()) {
|
||||
nonGlobalStepDefinitionsToRequire = features.map((featurePath) => ({
|
||||
[featurePath]: getStepDefinitionsPaths(featurePath).map(
|
||||
(sdPath) =>
|
||||
`clearFromCache(require.resolve && require.resolve('${sdPath}'), require('${sdPath}'))`
|
||||
),
|
||||
}));
|
||||
} else {
|
||||
globalStepDefinitionsToRequire = [
|
||||
...new Set(
|
||||
features.reduce(
|
||||
(requires) =>
|
||||
requires.concat(
|
||||
getStepDefinitionsPaths(filePath).map(
|
||||
(sdPath) => `require('${sdPath}')`
|
||||
)
|
||||
),
|
||||
[]
|
||||
)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
const specs = features
|
||||
.map((featurePath) => ({
|
||||
spec: fs.readFileSync(featurePath).toString(),
|
||||
filePath: featurePath,
|
||||
}))
|
||||
.map((feature) => ({
|
||||
...feature,
|
||||
name: new Parser().parse(feature.spec.toString()).feature.name,
|
||||
}));
|
||||
|
||||
return createCucumber(
|
||||
specs,
|
||||
globalStepDefinitionsToRequire,
|
||||
nonGlobalStepDefinitionsToRequire,
|
||||
getCucumberJsonConfig()
|
||||
);
|
||||
};
|
15
node_modules/cypress-cucumber-preprocessor/lib/getConfig.js
generated
vendored
Normal file
15
node_modules/cypress-cucumber-preprocessor/lib/getConfig.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
const cosmiconfig = require("cosmiconfig");
|
||||
|
||||
let explorer;
|
||||
|
||||
exports.getConfig = () => {
|
||||
if (!explorer) {
|
||||
explorer = cosmiconfig("cypress-cucumber-preprocessor", {
|
||||
sync: true,
|
||||
rcExtensions: true,
|
||||
});
|
||||
}
|
||||
|
||||
const loaded = explorer.load();
|
||||
return loaded && loaded.config;
|
||||
};
|
11
node_modules/cypress-cucumber-preprocessor/lib/getCucumberJsonConfig.js
generated
vendored
Normal file
11
node_modules/cypress-cucumber-preprocessor/lib/getCucumberJsonConfig.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
const log = require("debug")("cypress:cucumber");
|
||||
const { getConfig } = require("./getConfig");
|
||||
|
||||
exports.getCucumberJsonConfig = () => {
|
||||
const config = getConfig();
|
||||
const cucumberJson =
|
||||
config && config.cucumberJson ? config.cucumberJson : { generate: false };
|
||||
log("cucumber.json", JSON.stringify(cucumberJson));
|
||||
|
||||
return cucumberJson;
|
||||
};
|
6
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionPathsFrom.js
generated
vendored
Normal file
6
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionPathsFrom.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
getStepDefinitionPathsFrom: (filePath) =>
|
||||
filePath.replace(path.extname(filePath), ""),
|
||||
};
|
7
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionPathsFrom.test.js
generated
vendored
Normal file
7
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionPathsFrom.test.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const { getStepDefinitionPathsFrom } = require("./getStepDefinitionPathsFrom");
|
||||
|
||||
test("getStepDefinitionPathsFrom", () => {
|
||||
expect(
|
||||
getStepDefinitionPathsFrom("/home/lgandecki/someComplex_.feature")
|
||||
).equal("/home/lgandecki/someComplex_");
|
||||
});
|
40
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionsPaths.js
generated
vendored
Normal file
40
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionsPaths.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
const path = require("path");
|
||||
const glob = require("glob");
|
||||
const process = require("process");
|
||||
const { getConfig } = require("./getConfig");
|
||||
const stepDefinitionPath = require("./stepDefinitionPath.js");
|
||||
const { getStepDefinitionPathsFrom } = require("./getStepDefinitionPathsFrom");
|
||||
|
||||
const getStepDefinitionsPaths = (filePath) => {
|
||||
const appRoot = process.cwd();
|
||||
let paths = [];
|
||||
const config = getConfig();
|
||||
if (config && config.nonGlobalStepDefinitions) {
|
||||
let nonGlobalPath = getStepDefinitionPathsFrom(filePath);
|
||||
let commonPath = config.commonPath || `${stepDefinitionPath()}/common/`;
|
||||
|
||||
if (config.commonPath) {
|
||||
commonPath = `${path.resolve(appRoot, commonPath)}/`;
|
||||
}
|
||||
|
||||
if (config.nonGlobalStepBaseDir) {
|
||||
const stepBase = `${appRoot}/${config.nonGlobalStepBaseDir}`;
|
||||
nonGlobalPath = nonGlobalPath.replace(stepDefinitionPath(), stepBase);
|
||||
commonPath = `${stepBase}/${config.commonPath || "common/"}`;
|
||||
}
|
||||
|
||||
const nonGlobalPattern = `${nonGlobalPath}/**/*.+(js|ts|tsx)`;
|
||||
|
||||
const commonDefinitionsPattern = `${commonPath}**/*.+(js|ts|tsx)`;
|
||||
paths = paths.concat(
|
||||
glob.sync(nonGlobalPattern),
|
||||
glob.sync(commonDefinitionsPattern)
|
||||
);
|
||||
} else {
|
||||
const pattern = `${stepDefinitionPath()}/**/*.+(js|ts|tsx)`;
|
||||
paths = paths.concat(glob.sync(pattern));
|
||||
}
|
||||
return paths;
|
||||
};
|
||||
|
||||
module.exports = { getStepDefinitionsPaths };
|
99
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionsPaths.test.js
generated
vendored
Normal file
99
node_modules/cypress-cucumber-preprocessor/lib/getStepDefinitionsPaths.test.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
// file.only
|
||||
/* eslint-disable global-require */
|
||||
jest.mock("./stepDefinitionPath.js", () => () => "stepDefinitionPath");
|
||||
jest.mock("glob", () => ({
|
||||
sync(pattern) {
|
||||
return pattern;
|
||||
},
|
||||
}));
|
||||
|
||||
let getConfig;
|
||||
|
||||
describe("getStepDefinitionsPaths", () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
({ getConfig } = require("./getConfig"));
|
||||
jest.unmock("path");
|
||||
jest.mock("./getConfig");
|
||||
});
|
||||
it("should return the default common folder", () => {
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
});
|
||||
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
|
||||
const actual = getStepDefinitionsPaths("/path");
|
||||
const expected = "stepDefinitionPath/common/**/*.+(js|ts|tsx)";
|
||||
expect(actual).to.include(expected);
|
||||
});
|
||||
|
||||
it("should return the common folder defined by the developer", () => {
|
||||
jest.spyOn(process, "cwd").mockImplementation(() => "/cwd/");
|
||||
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
commonPath: "myPath/",
|
||||
});
|
||||
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
|
||||
const actual = getStepDefinitionsPaths("/path");
|
||||
const expected = "/cwd/myPath/**/*.+(js|ts|tsx)";
|
||||
expect(actual).to.include(expected);
|
||||
});
|
||||
it("should return the default non global step definition pattern", () => {
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
});
|
||||
// eslint-disable-next-line global-require
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
const path = "stepDefinitionPath/test.feature";
|
||||
const actual = getStepDefinitionsPaths(path);
|
||||
const expected = "stepDefinitionPath/test/**/*.+(js|ts|tsx)";
|
||||
|
||||
expect(actual).to.include(expected);
|
||||
});
|
||||
|
||||
describe("nonGlobalStepBaseDir is defined", () => {
|
||||
const path = "stepDefinitionPath/test.feature";
|
||||
const config = {
|
||||
nonGlobalStepDefinitions: true,
|
||||
nonGlobalStepBaseDir: "nonGlobalStepBaseDir",
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.spyOn(process, "cwd").mockImplementation(() => "cwd");
|
||||
});
|
||||
|
||||
it("should return the overriden non global step definition pattern and default common folder", () => {
|
||||
getConfig.mockReturnValue(config);
|
||||
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
const actual = getStepDefinitionsPaths(path);
|
||||
|
||||
const expectedNonGlobalDefinitionPattern =
|
||||
"cwd/nonGlobalStepBaseDir/test/**/*.+(js|ts|tsx)";
|
||||
const expectedCommonPath =
|
||||
"cwd/nonGlobalStepBaseDir/common/**/*.+(js|ts|tsx)";
|
||||
|
||||
expect(actual).to.include(expectedNonGlobalDefinitionPattern);
|
||||
expect(actual).to.include(expectedCommonPath);
|
||||
expect(actual).to.not.include(
|
||||
"stepDefinitionPath/test/**/*.+(js|ts|tsx)"
|
||||
);
|
||||
});
|
||||
|
||||
it("should return common folder defined by the dev and based on nonGlobalStepBaseDir", () => {
|
||||
getConfig.mockReturnValue({ ...config, commonPath: "commonPath/" });
|
||||
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
const actual = getStepDefinitionsPaths(path);
|
||||
|
||||
const expectedCommonPath =
|
||||
"cwd/nonGlobalStepBaseDir/commonPath/**/*.+(js|ts|tsx)";
|
||||
|
||||
expect(actual).to.include(expectedCommonPath);
|
||||
});
|
||||
});
|
||||
});
|
27
node_modules/cypress-cucumber-preprocessor/lib/hookRegistry.js
generated
vendored
Normal file
27
node_modules/cypress-cucumber-preprocessor/lib/hookRegistry.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
const { shouldProceedCurrentStep } = require("./tagsHelper");
|
||||
|
||||
class HookRegistry {
|
||||
constructor() {
|
||||
this.definitions = [];
|
||||
this.runtime = {};
|
||||
|
||||
this.runtime = (tags, implementation) => {
|
||||
this.definitions.push({
|
||||
tags,
|
||||
implementation,
|
||||
featureName: window.currentFeatureName || "___GLOBAL_EXECUTION___",
|
||||
});
|
||||
};
|
||||
|
||||
this.resolve = (scenarioTags, runningFeatureName) =>
|
||||
this.definitions.filter(
|
||||
({ tags, featureName }) =>
|
||||
(!tags ||
|
||||
tags.length === 0 ||
|
||||
shouldProceedCurrentStep(scenarioTags, tags)) &&
|
||||
(runningFeatureName === featureName ||
|
||||
featureName === "___GLOBAL_EXECUTION___")
|
||||
);
|
||||
}
|
||||
}
|
||||
exports.HookRegistry = HookRegistry;
|
97
node_modules/cypress-cucumber-preprocessor/lib/index.js
generated
vendored
Normal file
97
node_modules/cypress-cucumber-preprocessor/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
/* eslint-disable no-eval */
|
||||
const fs = require("fs");
|
||||
const through = require("through");
|
||||
const browserify = require("@cypress/browserify-preprocessor");
|
||||
const log = require("debug")("cypress:cucumber");
|
||||
const chokidar = require("chokidar");
|
||||
const compile = require("./loader.js");
|
||||
const compileFeatures = require("./featuresLoader.js");
|
||||
const stepDefinitionPath = require("./stepDefinitionPath.js");
|
||||
|
||||
const transform = (file) => {
|
||||
let data = "";
|
||||
|
||||
function write(buf) {
|
||||
data += buf;
|
||||
}
|
||||
|
||||
function end() {
|
||||
if (file.match(".features$")) {
|
||||
log("compiling features ", file);
|
||||
this.queue(compileFeatures(data, file));
|
||||
} else if (file.match(".feature$")) {
|
||||
log("compiling feature ", file);
|
||||
this.queue(compile(data, file));
|
||||
} else {
|
||||
this.queue(data);
|
||||
}
|
||||
this.queue(null);
|
||||
}
|
||||
|
||||
return through(write, end);
|
||||
};
|
||||
|
||||
const touch = (filename) => {
|
||||
fs.utimesSync(filename, new Date(), new Date());
|
||||
};
|
||||
|
||||
let watcher;
|
||||
|
||||
// Include our transform in Browserify options
|
||||
const wrapOptions = (options) => {
|
||||
let wrappedTransform;
|
||||
if (
|
||||
!options.browserifyOptions ||
|
||||
!Array.isArray(options.browserifyOptions.transform)
|
||||
) {
|
||||
wrappedTransform = [transform];
|
||||
} else if (!options.browserifyOptions.transform.includes(transform)) {
|
||||
wrappedTransform = [transform, ...options.browserifyOptions.transform];
|
||||
} else {
|
||||
wrappedTransform = options.browserifyOptions.transform;
|
||||
}
|
||||
|
||||
return {
|
||||
...options,
|
||||
browserifyOptions: {
|
||||
...(options.browserifyOptions || {}),
|
||||
transform: wrappedTransform,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const preprocessor = (options = browserify.defaultOptions) => {
|
||||
if (typeof options !== "object") {
|
||||
throw new Error("Preprocessor options must be an object");
|
||||
}
|
||||
|
||||
const wrappedOptions = wrapOptions(options);
|
||||
|
||||
return async (file) => {
|
||||
if (file.shouldWatch) {
|
||||
if (watcher) {
|
||||
watcher.close();
|
||||
}
|
||||
watcher = chokidar
|
||||
.watch(
|
||||
[
|
||||
`${stepDefinitionPath()}*.js`,
|
||||
`${stepDefinitionPath()}*.ts`,
|
||||
`${stepDefinitionPath()}*.tsx`,
|
||||
],
|
||||
{
|
||||
ignoreInitial: true,
|
||||
}
|
||||
)
|
||||
.on("all", () => {
|
||||
touch(file.filePath);
|
||||
});
|
||||
}
|
||||
return browserify(wrappedOptions)(file);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
default: preprocessor,
|
||||
transform,
|
||||
};
|
98
node_modules/cypress-cucumber-preprocessor/lib/index.test.js
generated
vendored
Normal file
98
node_modules/cypress-cucumber-preprocessor/lib/index.test.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
const browserify = require("@cypress/browserify-preprocessor");
|
||||
const { default: preprocessor, transform } = require(".");
|
||||
|
||||
jest.mock("@cypress/browserify-preprocessor");
|
||||
const { defaultOptions } = jest.requireActual(
|
||||
"@cypress/browserify-preprocessor"
|
||||
);
|
||||
|
||||
describe("Preprocessor", () => {
|
||||
beforeEach(() => {
|
||||
browserify.defaultOptions = defaultOptions;
|
||||
browserify.mockReturnValue(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
browserify.mockClear();
|
||||
});
|
||||
|
||||
it("should use Cypress browserify options by default", async () => {
|
||||
await preprocessor()({ shouldWatch: false });
|
||||
|
||||
global.jestExpect(browserify).toHaveBeenCalledWith({
|
||||
...defaultOptions,
|
||||
browserifyOptions: {
|
||||
...defaultOptions.browserifyOptions,
|
||||
transform: [transform, ...defaultOptions.browserifyOptions.transform],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should add transform when other transforms are defined in options", async () => {
|
||||
await preprocessor({
|
||||
browserifyOptions: {
|
||||
transform: ["babelify"],
|
||||
},
|
||||
})({ shouldWatch: false });
|
||||
|
||||
global.jestExpect(browserify).toHaveBeenCalledWith({
|
||||
browserifyOptions: {
|
||||
transform: [transform, "babelify"],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should preserve transforms in options when our transform is already included", async () => {
|
||||
const options = {
|
||||
browserifyOptions: {
|
||||
extensions: ["js", "ts"],
|
||||
plugins: [["tsify"]],
|
||||
transform: ["aliasify", transform, "babelify"],
|
||||
},
|
||||
};
|
||||
|
||||
await preprocessor(options)({ shouldWatch: false });
|
||||
|
||||
global.jestExpect(browserify).toHaveBeenCalledWith(options);
|
||||
});
|
||||
|
||||
it("should add our transform when no other transforms are defined in options", async () => {
|
||||
const options = {
|
||||
browserifyOptions: {
|
||||
extensions: ["js", "ts"],
|
||||
plugins: [["tsify"]],
|
||||
},
|
||||
};
|
||||
|
||||
await preprocessor(options)({ shouldWatch: false });
|
||||
|
||||
global.jestExpect(browserify).toHaveBeenCalledWith({
|
||||
...options,
|
||||
browserifyOptions: {
|
||||
...options.browserifyOptions,
|
||||
transform: [transform],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should add our transform when browserifyOptions property is not passed to options", async () => {
|
||||
const options = { unsupported: true };
|
||||
|
||||
await preprocessor(options)({ shouldWatch: false });
|
||||
|
||||
global.jestExpect(browserify).toHaveBeenCalledWith({
|
||||
...options,
|
||||
browserifyOptions: {
|
||||
transform: [transform],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail gracefully when options is not an object", () => {
|
||||
const err = new Error("Preprocessor options must be an object");
|
||||
|
||||
global.jestExpect(() => preprocessor("options")).toThrow(err);
|
||||
global.jestExpect(() => preprocessor(1)).toThrow(err);
|
||||
global.jestExpect(() => preprocessor(false)).toThrow(err);
|
||||
});
|
||||
});
|
6
node_modules/cypress-cucumber-preprocessor/lib/isNonGlobalStepDefinitionsMode.js
generated
vendored
Normal file
6
node_modules/cypress-cucumber-preprocessor/lib/isNonGlobalStepDefinitionsMode.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const { getConfig } = require("./getConfig");
|
||||
|
||||
exports.isNonGlobalStepDefinitionsMode = () => {
|
||||
const config = getConfig();
|
||||
return config && config.nonGlobalStepDefinitions;
|
||||
};
|
37
node_modules/cypress-cucumber-preprocessor/lib/loader.js
generated
vendored
Normal file
37
node_modules/cypress-cucumber-preprocessor/lib/loader.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
const log = require("debug")("cypress:cucumber");
|
||||
const path = require("path");
|
||||
const { Parser } = require("gherkin");
|
||||
const jsStringEscape = require("js-string-escape");
|
||||
const { getStepDefinitionsPaths } = require("./getStepDefinitionsPaths");
|
||||
const { cucumberTemplate } = require("./cucumberTemplate");
|
||||
const { getCucumberJsonConfig } = require("./getCucumberJsonConfig");
|
||||
|
||||
// This is the template for the file that we will send back to cypress instead of the text of a
|
||||
// feature file
|
||||
const createCucumber = (filePath, cucumberJson, spec, toRequire, name) =>
|
||||
`
|
||||
${cucumberTemplate}
|
||||
|
||||
window.cucumberJson = ${JSON.stringify(cucumberJson)};
|
||||
describe(\`${name}\`, function() {
|
||||
${toRequire.join("\n")}
|
||||
createTestsFromFeature('${filePath}', '${jsStringEscape(spec)}');
|
||||
});
|
||||
`;
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
module.exports = function (spec, filePath = this.resourcePath) {
|
||||
log("compiling", spec);
|
||||
const stepDefinitionsToRequire = getStepDefinitionsPaths(filePath).map(
|
||||
(sdPath) => `require('${sdPath}')`
|
||||
);
|
||||
|
||||
const { name } = new Parser().parse(spec.toString()).feature;
|
||||
return createCucumber(
|
||||
path.basename(filePath),
|
||||
getCucumberJsonConfig(),
|
||||
spec,
|
||||
stepDefinitionsToRequire,
|
||||
name
|
||||
);
|
||||
};
|
228
node_modules/cypress-cucumber-preprocessor/lib/resolveStepDefinition.js
generated
vendored
Normal file
228
node_modules/cypress-cucumber-preprocessor/lib/resolveStepDefinition.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
const DataTable = require("cucumber/lib/models/data_table").default;
|
||||
const {
|
||||
defineParameterType,
|
||||
} = require("cucumber/lib/support_code_library_builder/define_helpers");
|
||||
const {
|
||||
CucumberExpression,
|
||||
RegularExpression,
|
||||
ParameterTypeRegistry,
|
||||
} = require("cucumber-expressions");
|
||||
|
||||
const { HookRegistry } = require("./hookRegistry");
|
||||
|
||||
class StepDefinitionRegistry {
|
||||
constructor() {
|
||||
this.definitions = {};
|
||||
this.runtime = {};
|
||||
this.options = {
|
||||
parameterTypeRegistry: new ParameterTypeRegistry(),
|
||||
};
|
||||
|
||||
this.definitions = [];
|
||||
this.runtime = (...args) => {
|
||||
let matcher;
|
||||
let config;
|
||||
let implementation;
|
||||
if (args.length > 2) {
|
||||
[matcher, config, implementation] = args;
|
||||
} else {
|
||||
[matcher, implementation] = args;
|
||||
}
|
||||
let expression;
|
||||
if (matcher instanceof RegExp) {
|
||||
expression = new RegularExpression(
|
||||
matcher,
|
||||
this.options.parameterTypeRegistry
|
||||
);
|
||||
} else {
|
||||
expression = new CucumberExpression(
|
||||
matcher,
|
||||
this.options.parameterTypeRegistry
|
||||
);
|
||||
}
|
||||
|
||||
this.definitions.push({
|
||||
implementation,
|
||||
expression,
|
||||
config,
|
||||
featureName: window.currentFeatureName || "___GLOBAL_EXECUTION___",
|
||||
});
|
||||
};
|
||||
|
||||
this.resolve = (type, text, runningFeatureName) =>
|
||||
this.definitions.filter(
|
||||
({ expression, featureName }) =>
|
||||
expression.match(text) &&
|
||||
(runningFeatureName === featureName ||
|
||||
featureName === "___GLOBAL_EXECUTION___")
|
||||
)[0];
|
||||
}
|
||||
}
|
||||
|
||||
const stepDefinitionRegistry = new StepDefinitionRegistry();
|
||||
const beforeHookRegistry = new HookRegistry();
|
||||
const afterHookRegistry = new HookRegistry();
|
||||
|
||||
function resolveStepDefinition(step, featureName) {
|
||||
const stepDefinition = stepDefinitionRegistry.resolve(
|
||||
step.keyword.toLowerCase().trim(),
|
||||
step.text,
|
||||
featureName
|
||||
);
|
||||
return stepDefinition || {};
|
||||
}
|
||||
|
||||
function storeTemplateRowsOnArgumentIfNotPresent(argument) {
|
||||
return !argument.templateRows
|
||||
? { ...argument, templateRows: argument.rows }
|
||||
: argument;
|
||||
}
|
||||
|
||||
function applyExampleData(argument, exampleRowData, replaceParameterTags) {
|
||||
const argumentWithTemplateRows = storeTemplateRowsOnArgumentIfNotPresent(
|
||||
argument
|
||||
);
|
||||
|
||||
const scenarioDataTableRows = argumentWithTemplateRows.templateRows.map(
|
||||
(tr) => {
|
||||
if (!(tr && tr.type === "TableRow")) {
|
||||
return tr;
|
||||
}
|
||||
const cells = {
|
||||
cells: tr.cells.map((c) => {
|
||||
const value = {
|
||||
value: replaceParameterTags(exampleRowData, c.value),
|
||||
};
|
||||
return { ...c, ...value };
|
||||
}),
|
||||
};
|
||||
return { ...tr, ...cells };
|
||||
}
|
||||
);
|
||||
return { ...argumentWithTemplateRows, rows: scenarioDataTableRows };
|
||||
}
|
||||
|
||||
function resolveStepArgument(argument, exampleRowData, replaceParameterTags) {
|
||||
if (!argument) {
|
||||
return argument;
|
||||
}
|
||||
if (argument.type === "DataTable") {
|
||||
if (!exampleRowData) {
|
||||
return new DataTable(argument);
|
||||
}
|
||||
const argumentWithAppliedExampleData = applyExampleData(
|
||||
argument,
|
||||
exampleRowData,
|
||||
replaceParameterTags
|
||||
);
|
||||
|
||||
return new DataTable(argumentWithAppliedExampleData);
|
||||
}
|
||||
if (argument.type === "DocString") {
|
||||
if (exampleRowData) {
|
||||
return replaceParameterTags(exampleRowData, argument.content);
|
||||
}
|
||||
return argument.content;
|
||||
}
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
function resolveAndRunHooks(hookRegistry, scenarioTags, featureName) {
|
||||
return window.Cypress.Promise.each(
|
||||
hookRegistry.resolve(scenarioTags, featureName),
|
||||
({ implementation }) => implementation.call(this)
|
||||
);
|
||||
}
|
||||
|
||||
function parseHookArgs(args) {
|
||||
if (args.length === 2) {
|
||||
if (typeof args[0] !== "object" || typeof args[0].tags !== "string") {
|
||||
throw new Error(
|
||||
"Hook definitions with two arguments should have an object containing tags (string) as the first argument."
|
||||
);
|
||||
}
|
||||
if (typeof args[1] !== "function") {
|
||||
throw new Error(
|
||||
"Hook definitions with two arguments must have a function as the second argument."
|
||||
);
|
||||
}
|
||||
return {
|
||||
tags: args[0].tags,
|
||||
implementation: args[1],
|
||||
};
|
||||
}
|
||||
if (typeof args[0] !== "function") {
|
||||
throw new Error(
|
||||
"Hook definitions with one argument must have a function as the first argument."
|
||||
);
|
||||
}
|
||||
return {
|
||||
implementation: args[0],
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
resolveStepDefinition(step, featureName) {
|
||||
return resolveStepDefinition(step, featureName);
|
||||
},
|
||||
resolveAndRunBeforeHooks(scenarioTags, featureName) {
|
||||
return resolveAndRunHooks(beforeHookRegistry, scenarioTags, featureName);
|
||||
},
|
||||
resolveAndRunAfterHooks(scenarioTags, featureName) {
|
||||
return resolveAndRunHooks(afterHookRegistry, scenarioTags, featureName);
|
||||
},
|
||||
// eslint-disable-next-line func-names
|
||||
resolveAndRunStepDefinition(
|
||||
step,
|
||||
replaceParameterTags,
|
||||
exampleRowData,
|
||||
featureName
|
||||
) {
|
||||
const { expression, implementation } = resolveStepDefinition(
|
||||
step,
|
||||
featureName
|
||||
);
|
||||
const stepText = step.text;
|
||||
if (expression && implementation) {
|
||||
const argument = resolveStepArgument(
|
||||
step.argument,
|
||||
exampleRowData,
|
||||
replaceParameterTags
|
||||
);
|
||||
return implementation.call(
|
||||
this,
|
||||
...expression.match(stepText).map((match) => match.getValue()),
|
||||
argument
|
||||
);
|
||||
}
|
||||
throw new Error(`Step implementation missing for: ${stepText}`);
|
||||
},
|
||||
Given: (...args) => {
|
||||
stepDefinitionRegistry.runtime(...args);
|
||||
},
|
||||
When: (...args) => {
|
||||
stepDefinitionRegistry.runtime(...args);
|
||||
},
|
||||
Then: (...args) => {
|
||||
stepDefinitionRegistry.runtime(...args);
|
||||
},
|
||||
And: (...args) => {
|
||||
stepDefinitionRegistry.runtime(...args);
|
||||
},
|
||||
But: (...args) => {
|
||||
stepDefinitionRegistry.runtime(...args);
|
||||
},
|
||||
Before: (...args) => {
|
||||
const { tags, implementation } = parseHookArgs(args);
|
||||
beforeHookRegistry.runtime(tags, implementation);
|
||||
},
|
||||
After: (...args) => {
|
||||
const { tags, implementation } = parseHookArgs(args);
|
||||
afterHookRegistry.runtime(tags, implementation);
|
||||
},
|
||||
defineStep: (expression, implementation) => {
|
||||
stepDefinitionRegistry.runtime(expression, implementation);
|
||||
},
|
||||
defineParameterType: defineParameterType(stepDefinitionRegistry),
|
||||
};
|
87
node_modules/cypress-cucumber-preprocessor/lib/resolveStepDefinition.test.js
generated
vendored
Normal file
87
node_modules/cypress-cucumber-preprocessor/lib/resolveStepDefinition.test.js
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
/* eslint-disable global-require */
|
||||
|
||||
const {
|
||||
resolveFeatureFromFile,
|
||||
} = require("./testHelpers/resolveFeatureFromFile");
|
||||
|
||||
describe("Scenario Outline", () => {
|
||||
require("../cypress/support/step_definitions/scenario_outline_integer");
|
||||
require("../cypress/support/step_definitions/scenario_outline_string");
|
||||
require("../cypress/support/step_definitions/scenario_outline_data_table");
|
||||
require("../cypress/support/step_definitions/scenario_outline_multiple_vars");
|
||||
resolveFeatureFromFile("./cypress/integration/ScenarioOutline.feature");
|
||||
});
|
||||
|
||||
describe("DocString", () => {
|
||||
require("../cypress/support/step_definitions/docString");
|
||||
resolveFeatureFromFile("./cypress/integration/DocString.feature");
|
||||
});
|
||||
|
||||
describe("Data table", () => {
|
||||
require("../cypress/support/step_definitions/dataTable");
|
||||
resolveFeatureFromFile("./cypress/integration/DataTable.feature");
|
||||
});
|
||||
|
||||
describe("Basic example", () => {
|
||||
require("../cypress/support/step_definitions/basic");
|
||||
resolveFeatureFromFile("./cypress/integration/Plugin.feature");
|
||||
});
|
||||
|
||||
describe("Background section", () => {
|
||||
require("../cypress/support/step_definitions/backgroundSection");
|
||||
resolveFeatureFromFile("./cypress/integration/BackgroundSection.feature");
|
||||
});
|
||||
|
||||
describe("Regexp", () => {
|
||||
require("../cypress/support/step_definitions/regexp");
|
||||
resolveFeatureFromFile("./cypress/integration/RegularExpressions.feature");
|
||||
});
|
||||
|
||||
describe("Custom Parameter Types", () => {
|
||||
require("../cypress/support/step_definitions/customParameterTypes");
|
||||
resolveFeatureFromFile("./cypress/integration/CustomParameterTypes.feature");
|
||||
});
|
||||
|
||||
describe("Tags implementation", () => {
|
||||
require("../cypress/support/step_definitions/tags_implementation");
|
||||
resolveFeatureFromFile("./cypress/integration/TagsImplementation.feature");
|
||||
});
|
||||
|
||||
describe("Tags with env TAGS set", () => {
|
||||
window.Cypress = {
|
||||
...window.Cypress,
|
||||
env: () => "@test-tag and not @ignore-tag",
|
||||
};
|
||||
require("../cypress/support/step_definitions/tags_implementation_with_env_set");
|
||||
resolveFeatureFromFile(
|
||||
"./cypress/integration/TagsImplementationWithEnvSet.feature"
|
||||
);
|
||||
|
||||
resolveFeatureFromFile(
|
||||
"./cypress/integration/TagsImplementationWithEnvSetScenarioLevel.feature"
|
||||
);
|
||||
});
|
||||
|
||||
describe("Smart tagging", () => {
|
||||
window.Cypress = {
|
||||
...window.Cypress,
|
||||
env: () => "",
|
||||
};
|
||||
require("../cypress/support/step_definitions/smart_tagging");
|
||||
resolveFeatureFromFile("./cypress/integration/SmartTagging.feature");
|
||||
});
|
||||
|
||||
describe("And and But", () => {
|
||||
require("../cypress/support/step_definitions/and_and_but_steps");
|
||||
resolveFeatureFromFile("./cypress/integration/AndAndButSteps.feature");
|
||||
});
|
||||
|
||||
describe("defineStep", () => {
|
||||
require("../cypress/support/step_definitions/usingDefineSteps");
|
||||
resolveFeatureFromFile("./cypress/integration/DefineStep.feature");
|
||||
});
|
||||
|
||||
describe("Before and After", () => {
|
||||
require("../cypress/support/step_definitions/before_and_after_steps");
|
||||
resolveFeatureFromFile("./cypress/integration/BeforeAndAfterSteps.feature");
|
||||
});
|
32
node_modules/cypress-cucumber-preprocessor/lib/stepDefinitionPath.js
generated
vendored
Normal file
32
node_modules/cypress-cucumber-preprocessor/lib/stepDefinitionPath.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { getConfig } = require("./getConfig");
|
||||
|
||||
module.exports = () => {
|
||||
const appRoot = process.cwd();
|
||||
const config = getConfig();
|
||||
if (config) {
|
||||
// left for backward compability, but we need the consistency with other configuration options
|
||||
const confStepDefinitions = config.step_definitions
|
||||
? config.step_definitions
|
||||
: config.stepDefinitions;
|
||||
|
||||
if (config.nonGlobalStepDefinitions) {
|
||||
const relativePath =
|
||||
confStepDefinitions || `cypress${path.sep}integration`;
|
||||
const stepsPath = path.resolve(appRoot, relativePath);
|
||||
|
||||
if (!fs.existsSync(stepsPath)) {
|
||||
throw new Error(
|
||||
`We've tried to resolve your step definitions at ${relativePath}, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress.`
|
||||
);
|
||||
}
|
||||
return stepsPath;
|
||||
}
|
||||
if (confStepDefinitions) {
|
||||
return path.resolve(appRoot, confStepDefinitions);
|
||||
}
|
||||
}
|
||||
|
||||
return `${appRoot}/cypress/support/step_definitions`;
|
||||
};
|
92
node_modules/cypress-cucumber-preprocessor/lib/stepDefinitionPath.test.js
generated
vendored
Normal file
92
node_modules/cypress-cucumber-preprocessor/lib/stepDefinitionPath.test.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
const fs = require("fs");
|
||||
const { sep } = require("path");
|
||||
const { getConfig } = require("./getConfig");
|
||||
const stepDefinitionPath = require("./stepDefinitionPath");
|
||||
|
||||
jest.mock("./getConfig");
|
||||
jest.mock("fs", () => ({
|
||||
existsSync: jest.fn(),
|
||||
}));
|
||||
|
||||
const defaultNonGlobalStepDefinitionsPath = `cypress${sep}integration`;
|
||||
|
||||
describe("load path from step definitions", () => {
|
||||
beforeEach(() => {
|
||||
getConfig.mockReset();
|
||||
fs.existsSync.mockReset();
|
||||
});
|
||||
|
||||
test("Should throw an error if nonGlobalStepDefinitions and stepDefinitions are not set and the default is wrong", () => {
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
});
|
||||
fs.existsSync.mockReturnValue(false);
|
||||
|
||||
const errorMessage = `We've tried to resolve your step definitions at ${defaultNonGlobalStepDefinitionsPath}, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress.`;
|
||||
expect(stepDefinitionPath).throw(errorMessage);
|
||||
});
|
||||
|
||||
test("Should throw an error if nonGlobalStepDefinitions and stepDefinitions are set but the folder doesn't exist", () => {
|
||||
const stepDefinitions = "cypress/stepDefinitions";
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
stepDefinitions,
|
||||
});
|
||||
fs.existsSync.mockReturnValue(false);
|
||||
|
||||
const errorMessage = `We've tried to resolve your step definitions at ${stepDefinitions}, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress.`;
|
||||
expect(stepDefinitionPath).throw(errorMessage);
|
||||
});
|
||||
|
||||
test("should use the default stepDefinitions path for nonGlobalStepDefinitions", () => {
|
||||
const appRoot = process.cwd();
|
||||
getConfig.mockReturnValue({
|
||||
nonGlobalStepDefinitions: true,
|
||||
});
|
||||
fs.existsSync.mockReturnValue(true);
|
||||
|
||||
expect(stepDefinitionPath()).to.equal(
|
||||
`${appRoot}${sep}${defaultNonGlobalStepDefinitionsPath}`
|
||||
);
|
||||
});
|
||||
|
||||
test("should use the stepDefinitions path for nonGlobalStepDefinitions", () => {
|
||||
const appRoot = process.cwd();
|
||||
getConfig.mockReturnValue({
|
||||
step_definitions: "./e2e/support/step-definitions",
|
||||
});
|
||||
|
||||
expect(stepDefinitionPath()).to.equal(
|
||||
`${appRoot}${sep}e2e${sep}support${sep}step-definitions`
|
||||
);
|
||||
});
|
||||
|
||||
test("should use the stepDefinitions path", () => {
|
||||
const appRoot = process.cwd();
|
||||
getConfig.mockReturnValue({
|
||||
step_definitions: "./e2e/support/step-definitions",
|
||||
});
|
||||
|
||||
expect(stepDefinitionPath()).to.equal(
|
||||
`${appRoot}${sep}e2e${sep}support${sep}step-definitions`
|
||||
);
|
||||
});
|
||||
|
||||
test("should return default path if stepDefinition are not configured and nonGlobalStepDefinitions are not set", () => {
|
||||
const appRoot = process.cwd();
|
||||
expect(stepDefinitionPath()).to.equal(
|
||||
`${appRoot}/cypress/support/step_definitions`
|
||||
);
|
||||
});
|
||||
|
||||
test("should allow the backward compatible use of step_definitions in cosmiconfig", () => {
|
||||
const appRoot = process.cwd();
|
||||
getConfig.mockReturnValue({
|
||||
step_definitions: "./e2e/support/step-definitions",
|
||||
});
|
||||
|
||||
expect(stepDefinitionPath()).to.equal(
|
||||
`${appRoot}${sep}e2e${sep}support${sep}step-definitions`
|
||||
);
|
||||
});
|
||||
});
|
23
node_modules/cypress-cucumber-preprocessor/lib/tagsHelper.js
generated
vendored
Normal file
23
node_modules/cypress-cucumber-preprocessor/lib/tagsHelper.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
const { TagExpressionParser } = require("cucumber-tag-expressions");
|
||||
|
||||
function getEnvTags() {
|
||||
return Cypress.env("TAGS") || "";
|
||||
}
|
||||
|
||||
function shouldProceedCurrentStep(tags = [], envTags = getEnvTags()) {
|
||||
const parser = new TagExpressionParser();
|
||||
try {
|
||||
const expressionNode = parser.parse(envTags);
|
||||
const mappedTags = tags.map((tag) => tag.name);
|
||||
return expressionNode.evaluate(mappedTags);
|
||||
} catch (e) {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log(`Error parsing tags: '${envTags}'. Message: ${e.message}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
shouldProceedCurrentStep,
|
||||
getEnvTags,
|
||||
};
|
14
node_modules/cypress-cucumber-preprocessor/lib/tagsInheritance.test.js
generated
vendored
Normal file
14
node_modules/cypress-cucumber-preprocessor/lib/tagsInheritance.test.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/* eslint-disable global-require */
|
||||
const {
|
||||
resolveFeatureFromFile,
|
||||
} = require("./testHelpers/resolveFeatureFromFile");
|
||||
|
||||
describe("Tags inheritance", () => {
|
||||
window.Cypress = {
|
||||
...window.Cypress,
|
||||
env: () => "@inherited-tag and @own-tag",
|
||||
};
|
||||
|
||||
require("../cypress/support/step_definitions/tags_implementation_with_env_set");
|
||||
resolveFeatureFromFile("./cypress/integration/TagsInheritance.feature");
|
||||
});
|
13
node_modules/cypress-cucumber-preprocessor/lib/testHelpers/resolveFeatureFromFile.js
generated
vendored
Normal file
13
node_modules/cypress-cucumber-preprocessor/lib/testHelpers/resolveFeatureFromFile.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/* eslint-disable global-require */
|
||||
const fs = require("fs");
|
||||
|
||||
const { createTestsFromFeature } = require("../createTestsFromFeature");
|
||||
|
||||
const resolveFeatureFromFile = (featureFile) => {
|
||||
const spec = fs.readFileSync(featureFile);
|
||||
createTestsFromFeature(featureFile, spec);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
resolveFeatureFromFile,
|
||||
};
|
68
node_modules/cypress-cucumber-preprocessor/lib/testHelpers/setupTestFramework.js
generated
vendored
Normal file
68
node_modules/cypress-cucumber-preprocessor/lib/testHelpers/setupTestFramework.js
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
global.jestExpect = global.expect;
|
||||
global.expect = require("chai").expect;
|
||||
|
||||
global.before = jest.fn();
|
||||
global.after = jest.fn();
|
||||
global.skip = jest.fn();
|
||||
|
||||
window.Cypress = {
|
||||
env: jest.fn(),
|
||||
on: jest.fn(),
|
||||
off: jest.fn(),
|
||||
log: jest.fn(),
|
||||
mocha: {
|
||||
getRunner: () => {
|
||||
return {
|
||||
on: jest.fn(),
|
||||
};
|
||||
},
|
||||
},
|
||||
Promise: { each: (iterator, iteree) => iterator.map(iteree) },
|
||||
};
|
||||
|
||||
const {
|
||||
defineParameterType,
|
||||
defineStep,
|
||||
When,
|
||||
Then,
|
||||
Given,
|
||||
And,
|
||||
But,
|
||||
Before,
|
||||
After,
|
||||
} = require("../resolveStepDefinition");
|
||||
|
||||
const mockedThen = (funcOrConfig, func) => {
|
||||
if (typeof funcOrConfig === "object") {
|
||||
func();
|
||||
} else {
|
||||
funcOrConfig();
|
||||
}
|
||||
return { then: mockedThen };
|
||||
};
|
||||
|
||||
const mockedPromise = (func) => {
|
||||
func();
|
||||
return { then: mockedThen };
|
||||
};
|
||||
|
||||
window.defineParameterType = defineParameterType;
|
||||
window.When = When;
|
||||
window.Then = Then;
|
||||
window.Given = Given;
|
||||
window.And = And;
|
||||
window.But = But;
|
||||
window.Before = Before;
|
||||
window.After = After;
|
||||
window.defineStep = defineStep;
|
||||
window.cy = {
|
||||
log: jest.fn(),
|
||||
logStep: mockedPromise,
|
||||
startScenario: mockedPromise,
|
||||
finishScenario: mockedPromise,
|
||||
startStep: mockedPromise,
|
||||
finishStep: mockedPromise,
|
||||
finishTest: mockedPromise,
|
||||
then: mockedThen,
|
||||
end: mockedPromise,
|
||||
};
|
3
node_modules/cypress-cucumber-preprocessor/loader.js
generated
vendored
Normal file
3
node_modules/cypress-cucumber-preprocessor/loader.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const loader = require("./lib/loader");
|
||||
|
||||
module.exports = loader;
|
44
node_modules/cypress-cucumber-preprocessor/manual-releases.md
generated
vendored
Normal file
44
node_modules/cypress-cucumber-preprocessor/manual-releases.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# manual-releases
|
||||
|
||||
This project has an automated release set up. So things are only released when
|
||||
there are useful changes in the code that justify a release. But sometimes
|
||||
things get messed up one way or another and we need to trigger the release
|
||||
ourselves. When this happens, simply bump the number below and commit that with
|
||||
the following commit message based on your needs:
|
||||
|
||||
**Major**
|
||||
|
||||
```
|
||||
fix(release): manually release a major version
|
||||
|
||||
There was an issue with a major release, so this manual-releases.md
|
||||
change is to release a new major version.
|
||||
|
||||
Reference: #<the number of a relevant pull request, issue, or commit>
|
||||
|
||||
BREAKING CHANGE: <mention any relevant breaking changes (this is what triggers the major version change so don't skip this!)>
|
||||
```
|
||||
|
||||
**Minor**
|
||||
|
||||
```
|
||||
feat(release): manually release a minor version
|
||||
|
||||
There was an issue with a minor release, so this manual-releases.md
|
||||
change is to release a new minor version.
|
||||
|
||||
Reference: #<the number of a relevant pull request, issue, or commit>
|
||||
```
|
||||
|
||||
**Patch**
|
||||
|
||||
```
|
||||
fix(release): manually release a patch version
|
||||
|
||||
There was an issue with a patch release, so this manual-releases.md
|
||||
change is to release a new patch version.
|
||||
|
||||
Reference: #<the number of a relevant pull request, issue, or commit>
|
||||
```
|
||||
|
||||
The number of times we've had to do a manual release is: 6
|
395
node_modules/cypress-cucumber-preprocessor/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
395
node_modules/cypress-cucumber-preprocessor/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
|
||||
3.1.0 / 2017-09-26
|
||||
==================
|
||||
|
||||
* Add `DEBUG_HIDE_DATE` env var (#486)
|
||||
* Remove ReDoS regexp in %o formatter (#504)
|
||||
* Remove "component" from package.json
|
||||
* Remove `component.json`
|
||||
* Ignore package-lock.json
|
||||
* Examples: fix colors printout
|
||||
* Fix: browser detection
|
||||
* Fix: spelling mistake (#496, @EdwardBetts)
|
||||
|
||||
3.0.1 / 2017-08-24
|
||||
==================
|
||||
|
||||
* Fix: Disable colors in Edge and Internet Explorer (#489)
|
||||
|
||||
3.0.0 / 2017-08-08
|
||||
==================
|
||||
|
||||
* Breaking: Remove DEBUG_FD (#406)
|
||||
* Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418)
|
||||
* Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408)
|
||||
* Addition: document `enabled` flag (#465)
|
||||
* Addition: add 256 colors mode (#481)
|
||||
* Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440)
|
||||
* Update: component: update "ms" to v2.0.0
|
||||
* Update: separate the Node and Browser tests in Travis-CI
|
||||
* Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots
|
||||
* Update: separate Node.js and web browser examples for organization
|
||||
* Update: update "browserify" to v14.4.0
|
||||
* Fix: fix Readme typo (#473)
|
||||
|
||||
2.6.9 / 2017-09-22
|
||||
==================
|
||||
|
||||
* remove ReDoS regexp in %o formatter (#504)
|
||||
|
||||
2.6.8 / 2017-05-18
|
||||
==================
|
||||
|
||||
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||
|
||||
2.6.7 / 2017-05-16
|
||||
==================
|
||||
|
||||
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||
* Docs: Fix typo (#455, @msasad)
|
||||
|
||||
2.6.5 / 2017-04-27
|
||||
==================
|
||||
|
||||
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||
|
||||
|
||||
2.6.4 / 2017-04-20
|
||||
==================
|
||||
|
||||
* Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeek)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
19
node_modules/cypress-cucumber-preprocessor/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/cypress-cucumber-preprocessor/node_modules/debug/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
437
node_modules/cypress-cucumber-preprocessor/node_modules/debug/README.md
generated
vendored
Normal file
437
node_modules/cypress-cucumber-preprocessor/node_modules/debug/README.md
generated
vendored
Normal file
@ -0,0 +1,437 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||
technique. Works in Node.js and web browsers.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example [_app.js_](./examples/node/app.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %o', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example [_worker.js_](./examples/node/worker.js):
|
||||
|
||||
```js
|
||||
var a = require('debug')('worker:a')
|
||||
, b = require('debug')('worker:b');
|
||||
|
||||
function work() {
|
||||
a('doing lots of uninteresting work');
|
||||
setTimeout(work, Math.random() * 1000);
|
||||
}
|
||||
|
||||
work();
|
||||
|
||||
function workb() {
|
||||
b('doing some work');
|
||||
setTimeout(workb, Math.random() * 2000);
|
||||
}
|
||||
|
||||
workb();
|
||||
```
|
||||
|
||||
The `DEBUG` environment variable is then used to enable these based on space or
|
||||
comma-delimited names.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||
|
||||
#### Windows command prompt notes
|
||||
|
||||
##### CMD
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
set DEBUG=* & node app.js
|
||||
```
|
||||
|
||||
##### PowerShell (VS Code default)
|
||||
|
||||
PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
$env:DEBUG='app';node app.js
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
npm script example:
|
||||
```js
|
||||
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||
```
|
||||
|
||||
## Namespace Colors
|
||||
|
||||
Every debug instance has a color generated for it based on its namespace name.
|
||||
This helps when visually parsing the debug output to identify which debug instance
|
||||
a debug line belongs to.
|
||||
|
||||
#### Node.js
|
||||
|
||||
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||
otherwise debug will only use a small handful of basic colors.
|
||||
|
||||
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||
|
||||
#### Web Browser
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||
|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||
instead of listing all three with
|
||||
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||
starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||
Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object.
|
||||
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||
`%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
|
||||
## Browser Support
|
||||
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example [_stdout.js_](./examples/node/stdout.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
//creates new debug instance with extended namespace
|
||||
const logSign = log.extend('sign');
|
||||
const logLogin = log.extend('login');
|
||||
|
||||
log('hello'); // auth hello
|
||||
logSign('hello'); //auth:sign hello
|
||||
logLogin('hello'); //auth:login hello
|
||||
```
|
||||
|
||||
## Set dynamically
|
||||
|
||||
You can also enable debug dynamically by calling the `enable()` method :
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
|
||||
console.log(1, debug.enabled('test'));
|
||||
|
||||
debug.enable('test');
|
||||
console.log(2, debug.enabled('test'));
|
||||
|
||||
debug.disable();
|
||||
console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
enabled by checking the `enabled` property:
|
||||
|
||||
```javascript
|
||||
const debug = require('debug')('http');
|
||||
|
||||
if (debug.enabled) {
|
||||
// do stuff...
|
||||
}
|
||||
```
|
||||
|
||||
You can also manually toggle this property to force the debug instance to be
|
||||
enabled or disabled.
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
node_modules/cypress-cucumber-preprocessor/node_modules/debug/node.js
generated
vendored
Normal file
1
node_modules/cypress-cucumber-preprocessor/node_modules/debug/node.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./src/node');
|
90
node_modules/cypress-cucumber-preprocessor/node_modules/debug/package.json
generated
vendored
Normal file
90
node_modules/cypress-cucumber-preprocessor/node_modules/debug/package.json
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
"_from": "debug@^3.0.1",
|
||||
"_id": "debug@3.2.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"_location": "/cypress-cucumber-preprocessor/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "debug@^3.0.1",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "^3.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cypress-cucumber-preprocessor"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"_shasum": "72580b7e9145fb39b6676f9c5e5fb100b934179a",
|
||||
"_spec": "debug@^3.0.1",
|
||||
"_where": "/home/simon/Documents/lifen-autotest/node_modules/cypress-cucumber-preprocessor",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"browser": "./src/browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Rhyne",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"browserify": "14.4.0",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^3.0.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"node.js",
|
||||
"dist/debug.js",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./src/index.js",
|
||||
"name": "debug",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"unpkg": "./dist/debug.js",
|
||||
"version": "3.2.7"
|
||||
}
|
180
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/browser.js
generated
vendored
Normal file
180
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/browser.js
generated
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*/
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = localstorage();
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
// eslint-disable-next-line complexity
|
||||
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||
return true;
|
||||
} // Internet Explorer and Edge do not support colors.
|
||||
|
||||
|
||||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||
return false;
|
||||
} // Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
|
||||
|
||||
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
||||
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
||||
}
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function formatArgs(args) {
|
||||
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
||||
|
||||
if (!this.useColors) {
|
||||
return;
|
||||
}
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
||||
if (match === '%%') {
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (match === '%c') {
|
||||
// We only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function log() {
|
||||
var _console;
|
||||
|
||||
// This hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
||||
}
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (namespaces) {
|
||||
exports.storage.setItem('debug', namespaces);
|
||||
} else {
|
||||
exports.storage.removeItem('debug');
|
||||
}
|
||||
} catch (error) {// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
|
||||
try {
|
||||
r = exports.storage.getItem('debug');
|
||||
} catch (error) {} // Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
|
||||
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||
// The Browser also has localStorage in the global context.
|
||||
return localStorage;
|
||||
} catch (error) {// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
var formatters = module.exports.formatters;
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
formatters.j = function (v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (error) {
|
||||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||
}
|
||||
};
|
||||
|
249
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/common.js
generated
vendored
Normal file
249
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/common.js
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*/
|
||||
function setup(env) {
|
||||
createDebug.debug = createDebug;
|
||||
createDebug.default = createDebug;
|
||||
createDebug.coerce = coerce;
|
||||
createDebug.disable = disable;
|
||||
createDebug.enable = enable;
|
||||
createDebug.enabled = enabled;
|
||||
createDebug.humanize = require('ms');
|
||||
Object.keys(env).forEach(function (key) {
|
||||
createDebug[key] = env[key];
|
||||
});
|
||||
/**
|
||||
* Active `debug` instances.
|
||||
*/
|
||||
|
||||
createDebug.instances = [];
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
createDebug.formatters = {};
|
||||
/**
|
||||
* Selects a color for a debug namespace
|
||||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||||
* @return {Number|String} An ANSI color code for the given namespace
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0;
|
||||
|
||||
for (var i = 0; i < namespace.length; i++) {
|
||||
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||
}
|
||||
|
||||
createDebug.selectColor = selectColor;
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
var prevTime;
|
||||
|
||||
function debug() {
|
||||
// Disabled?
|
||||
if (!debug.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var self = debug; // Set `diff` timestamp
|
||||
|
||||
var curr = Number(new Date());
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
args[0] = createDebug.coerce(args[0]);
|
||||
|
||||
if (typeof args[0] !== 'string') {
|
||||
// Anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
} // Apply any `formatters` transformations
|
||||
|
||||
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
||||
// If we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') {
|
||||
return match;
|
||||
}
|
||||
|
||||
index++;
|
||||
var formatter = createDebug.formatters[format];
|
||||
|
||||
if (typeof formatter === 'function') {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
|
||||
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
|
||||
return match;
|
||||
}); // Apply env-specific formatting (colors, etc.)
|
||||
|
||||
createDebug.formatArgs.call(self, args);
|
||||
var logFn = self.log || createDebug.log;
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = createDebug.enabled(namespace);
|
||||
debug.useColors = createDebug.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
debug.destroy = destroy;
|
||||
debug.extend = extend; // Debug.formatArgs = formatArgs;
|
||||
// debug.rawLog = rawLog;
|
||||
// env-specific initialization logic for debug instances
|
||||
|
||||
if (typeof createDebug.init === 'function') {
|
||||
createDebug.init(debug);
|
||||
}
|
||||
|
||||
createDebug.instances.push(debug);
|
||||
return debug;
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
var index = createDebug.instances.indexOf(this);
|
||||
|
||||
if (index !== -1) {
|
||||
createDebug.instances.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
}
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function enable(namespaces) {
|
||||
createDebug.save(namespaces);
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
var i;
|
||||
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < createDebug.instances.length; i++) {
|
||||
var instance = createDebug.instances[i];
|
||||
instance.enabled = createDebug.enabled(instance.namespace);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function disable() {
|
||||
createDebug.enable('');
|
||||
}
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function enabled(name) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var i;
|
||||
var len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) {
|
||||
return val.stack || val.message;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
createDebug.enable(createDebug.load());
|
||||
return createDebug;
|
||||
}
|
||||
|
||||
module.exports = setup;
|
||||
|
12
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/index.js
generated
vendored
Normal file
12
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/index.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
|
177
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/node.js
generated
vendored
Normal file
177
node_modules/cypress-cucumber-preprocessor/node_modules/debug/src/node.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
var tty = require('tty');
|
||||
|
||||
var util = require('util');
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*/
|
||||
|
||||
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
try {
|
||||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
var supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
|
||||
}
|
||||
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// Camel-case
|
||||
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
|
||||
return k.toUpperCase();
|
||||
}); // Coerce string value into JS value
|
||||
|
||||
var val = process.env[key];
|
||||
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||
val = true;
|
||||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||
val = false;
|
||||
} else if (val === 'null') {
|
||||
val = null;
|
||||
} else {
|
||||
val = Number(val);
|
||||
}
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
||||
}
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace,
|
||||
useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
|
||||
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
|
||||
} else {
|
||||
args[0] = getDate() + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
function getDate() {
|
||||
if (exports.inspectOpts.hideDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||||
*/
|
||||
|
||||
|
||||
function log() {
|
||||
return process.stderr.write(util.format.apply(util, arguments) + '\n');
|
||||
}
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function save(namespaces) {
|
||||
if (namespaces) {
|
||||
process.env.DEBUG = namespaces;
|
||||
} else {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
|
||||
function init(debug) {
|
||||
debug.inspectOpts = {};
|
||||
var keys = Object.keys(exports.inspectOpts);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
var formatters = module.exports.formatters;
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
formatters.o = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n')
|
||||
.map(function (str) { return str.trim(); })
|
||||
.join(' ');
|
||||
};
|
||||
/**
|
||||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
|
||||
formatters.O = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
95
node_modules/cypress-cucumber-preprocessor/package.json
generated
vendored
Normal file
95
node_modules/cypress-cucumber-preprocessor/package.json
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "cypress-cucumber-preprocessor",
|
||||
"version": "4.2.0",
|
||||
"description": "Run gherkin-syntaxed specs with cypress.io",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"test": "eslint . && jest && npm run test:all",
|
||||
"test:all": "cypress run --spec \"**/*.features\"",
|
||||
"test:each": "cypress run --spec \"**/*.feature\"",
|
||||
"test:debug": "jest && DEBUG=cypress:* cypress open\n",
|
||||
"fixStyle": "eslint . --fix",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"bin": {
|
||||
"cypress-tags": "cypress-tags.js"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
|
||||
"pre-commit": "lint-staged && jest"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TheBrainFamily/cypress-cucumber-preprocessor.git"
|
||||
},
|
||||
"keywords": [
|
||||
"cucumber",
|
||||
"gherkin",
|
||||
"cypress",
|
||||
"testing"
|
||||
],
|
||||
"author": "Lukasz Gandecki",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TheBrainFamily/cypress-cucumber-preprocessor#readme",
|
||||
"dependencies": {
|
||||
"@cypress/browserify-preprocessor": "^3.0.1",
|
||||
"chai": "^4.2.0",
|
||||
"chokidar": "3.5.2",
|
||||
"cosmiconfig": "^4.0.0",
|
||||
"cucumber": "^4.2.1",
|
||||
"cucumber-expressions": "^6.0.1",
|
||||
"cucumber-tag-expressions": "^1.1.1",
|
||||
"dargs": "^7.0.0",
|
||||
"debug": "^3.0.1",
|
||||
"gherkin": "^5.1.0",
|
||||
"glob": "^7.1.2",
|
||||
"js-string-escape": "^1.0.1",
|
||||
"minimist": "^1.2.5",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"commitizen": "^4.2.1",
|
||||
"cypress": "^5.1.0",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-config-airbnb-base": "^14.2.0",
|
||||
"eslint-config-prettier": "6.12.0",
|
||||
"eslint-plugin-cypress": "^2.11.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"husky": "^4.3.0",
|
||||
"jest": "^26.4.2",
|
||||
"lint-staged": "^10.3.0",
|
||||
"prettier": "2.1.2",
|
||||
"semantic-release": "^17.1.1"
|
||||
},
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/lib/testHelpers/setupTestFramework.js"
|
||||
],
|
||||
"collectCoverage": true,
|
||||
"collectCoverageFrom": [
|
||||
"lib/**/*.js"
|
||||
],
|
||||
"coveragePathIgnorePatterns": [
|
||||
"node_modules",
|
||||
"<rootDir>/lib/*.test.js"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
}
|
||||
}
|
23
node_modules/cypress-cucumber-preprocessor/resolveStepDefinition.js
generated
vendored
Normal file
23
node_modules/cypress-cucumber-preprocessor/resolveStepDefinition.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// reexporting here for backward compability
|
||||
const {
|
||||
Given,
|
||||
When,
|
||||
Then,
|
||||
And,
|
||||
But,
|
||||
defineParameterType,
|
||||
} = require("./lib/resolveStepDefinition");
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
"DEPRECATION WARNING! Please change your imports from cypress-cucumber-preprocessor/resolveStepDefinition to cypress-cucumber-preprocessor/steps"
|
||||
);
|
||||
|
||||
module.exports = {
|
||||
Given,
|
||||
When,
|
||||
Then,
|
||||
And,
|
||||
But,
|
||||
defineParameterType,
|
||||
};
|
26
node_modules/cypress-cucumber-preprocessor/steps.js
generated
vendored
Normal file
26
node_modules/cypress-cucumber-preprocessor/steps.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// We know this is a duplicate of ./resolveStepDefinition.
|
||||
// We will remove that one soon and leave only this one in a future version.
|
||||
|
||||
const {
|
||||
Given,
|
||||
When,
|
||||
Then,
|
||||
And,
|
||||
But,
|
||||
Before,
|
||||
After,
|
||||
defineParameterType,
|
||||
defineStep,
|
||||
} = require("./lib/resolveStepDefinition");
|
||||
|
||||
module.exports = {
|
||||
Then,
|
||||
And,
|
||||
But,
|
||||
Given,
|
||||
When,
|
||||
Before,
|
||||
After,
|
||||
defineParameterType,
|
||||
defineStep,
|
||||
};
|
69
node_modules/cypress-cucumber-preprocessor/steps/index.d.ts
generated
vendored
Normal file
69
node_modules/cypress-cucumber-preprocessor/steps/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
export interface Transform {
|
||||
regexp: RegExp;
|
||||
transformer(...arg: string[]): any;
|
||||
useForSnippets?: boolean;
|
||||
preferForRegexpMatch?: boolean;
|
||||
name?: string;
|
||||
typeName?: string; // deprecated
|
||||
}
|
||||
|
||||
export function defineStep(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function defineParameterType(parameterType: Transform): void;
|
||||
|
||||
// Aliased versions of the above funcs.
|
||||
export function Given(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function Given(
|
||||
expression: RegExp | string,
|
||||
config: { timeout?: number },
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function When(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function When(
|
||||
expression: RegExp | string,
|
||||
config: { timeout?: number },
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function Then(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function Then(
|
||||
expression: RegExp | string,
|
||||
config: { timeout?: number },
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function And(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function And(
|
||||
expression: RegExp | string,
|
||||
config: { timeout?: number },
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function But(
|
||||
expression: RegExp | string,
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function But(
|
||||
expression: RegExp | string,
|
||||
config: { timeout?: number },
|
||||
implementation: (...args: any[]) => void
|
||||
): void;
|
||||
export function Before(
|
||||
optionsOrImplementation: object | ((...args: any[]) => void),
|
||||
implementation?: (...args: any[]) => void
|
||||
): void;
|
||||
export function After(
|
||||
optionsOrImplementation: object | ((...args: any[]) => void),
|
||||
implementation?: (...args: any[]) => void
|
||||
): void;
|
28
node_modules/cypress-cucumber-preprocessor/wallaby.js
generated
vendored
Normal file
28
node_modules/cypress-cucumber-preprocessor/wallaby.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/* eslint-disable */
|
||||
|
||||
module.exports = function (wallaby) {
|
||||
return {
|
||||
files: [
|
||||
{pattern: './lib/*.+(js|jsx|json|snap|css|less|sass|scss|jpg|jpeg|gif|png|svg)', load: false},
|
||||
{pattern: '!./lib/*.test.js?(x)', load: false},
|
||||
'./lib/*.snap',
|
||||
{pattern: '.eslintrc', load: false},
|
||||
'./cypress/support/step_definitions/*.js',
|
||||
'./cypress/integration/*.feature',
|
||||
],
|
||||
|
||||
tests: [
|
||||
{pattern: './lib/*.test.js?(x)', load: true}
|
||||
],
|
||||
|
||||
|
||||
|
||||
env: {
|
||||
type: 'node',
|
||||
runner: 'node'
|
||||
},
|
||||
|
||||
testFramework: 'jest',
|
||||
|
||||
}
|
||||
};
|
68
package-lock.json
generated
68
package-lock.json
generated
@ -12,6 +12,7 @@
|
||||
"cypress": "^8.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress-cucumber-preprocessor": "^4.2.0",
|
||||
"cypress-mailosaur": "^2.3.3"
|
||||
}
|
||||
},
|
||||
@ -2939,6 +2940,40 @@
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cypress-cucumber-preprocessor": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-4.2.0.tgz",
|
||||
"integrity": "sha512-iVm+gUROvg8lDIFStP4/B+0xHAwj6c6HCoUtkZqq8Ee/tcqe2Vlhz1eAq2Q5+tzmCk2/CIh06suvqB+RQpjWBw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@cypress/browserify-preprocessor": "^3.0.1",
|
||||
"chai": "^4.2.0",
|
||||
"chokidar": "3.5.2",
|
||||
"cosmiconfig": "^4.0.0",
|
||||
"cucumber": "^4.2.1",
|
||||
"cucumber-expressions": "^6.0.1",
|
||||
"cucumber-tag-expressions": "^1.1.1",
|
||||
"dargs": "^7.0.0",
|
||||
"debug": "^3.0.1",
|
||||
"gherkin": "^5.1.0",
|
||||
"glob": "^7.1.2",
|
||||
"js-string-escape": "^1.0.1",
|
||||
"minimist": "^1.2.5",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"bin": {
|
||||
"cypress-tags": "cypress-tags.js"
|
||||
}
|
||||
},
|
||||
"node_modules/cypress-cucumber-preprocessor/node_modules/debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/cypress-mailosaur": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/cypress-mailosaur/-/cypress-mailosaur-2.3.3.tgz",
|
||||
@ -9296,6 +9331,39 @@
|
||||
"yauzl": "^2.10.0"
|
||||
}
|
||||
},
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-4.2.0.tgz",
|
||||
"integrity": "sha512-iVm+gUROvg8lDIFStP4/B+0xHAwj6c6HCoUtkZqq8Ee/tcqe2Vlhz1eAq2Q5+tzmCk2/CIh06suvqB+RQpjWBw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@cypress/browserify-preprocessor": "^3.0.1",
|
||||
"chai": "^4.2.0",
|
||||
"chokidar": "3.5.2",
|
||||
"cosmiconfig": "^4.0.0",
|
||||
"cucumber": "^4.2.1",
|
||||
"cucumber-expressions": "^6.0.1",
|
||||
"cucumber-tag-expressions": "^1.1.1",
|
||||
"dargs": "^7.0.0",
|
||||
"debug": "^3.0.1",
|
||||
"gherkin": "^5.1.0",
|
||||
"glob": "^7.1.2",
|
||||
"js-string-escape": "^1.0.1",
|
||||
"minimist": "^1.2.5",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cypress-mailosaur": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/cypress-mailosaur/-/cypress-mailosaur-2.3.3.tgz",
|
||||
|
@ -4,10 +4,11 @@
|
||||
"description": "run cypress end-2-end tests against post-prod.lifen.fr",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"cypress": "^8.3.1"
|
||||
"cypress": "^8.3.1",
|
||||
"cypress-cucumber-preprocessor": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress-mailosaur": "^2.3.3"
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"nonGlobalStepDefinitions": true
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cypress open"
|
||||
|
Loading…
x
Reference in New Issue
Block a user