refactor(Cypress): Init a version of the test exam with pure cypress (no Gherkin)

This commit is contained in:
Simon Priet
2021-09-08 12:31:56 +02:00
parent 68acc2a949
commit 86a3ea7108
63 changed files with 6 additions and 4946 deletions

View File

@@ -1,14 +0,0 @@
Feature: Send a document that is ready
As a practiciant, I can send mails that i have prepared
Scenario: Send a 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

View File

@@ -26,25 +26,27 @@ context('The login page', () => {
});
/* describe("It send an SMS", function() {
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, {
/*cy.mailosaurGetMessage(serverId, {
sentTo: smsNumber
}).as('sms');
}).as('sms'); */
cy.wait(10000).then(() => {
cy.get('#validateButton').click();
});
cy.visit("/request")
// should be on the inbox
});
});
*/
});
context("The inbox page", function() {

View File

@@ -1,57 +0,0 @@
/* global Given, When, Then */
import { Given, When, Then, And, Before } from "cypress-cucumber-preprocessor/steps";
describe("Send a 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")
});
});
})

View File

@@ -8,7 +8,6 @@
// 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)
@@ -20,5 +19,4 @@ const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on('file:preprocessor', cucumber())
}

View File

@@ -24,15 +24,3 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
import 'cypress-mailosaur';
Cypress.Commands.add('TokenLogin', (token) => {
const autorisation = `bearer ${ token }`;
cy.request({
method:'POST',
url:'/request',
headers: {
autorisation,
}
});
})