Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neferin12 committed Feb 19, 2021
1 parent d294d8f commit 6399698
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 11 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"baseUrl": "http://localhost:8080",
"video": false,
"reporter": "junit"
"reporter": "junit",
"experimentalStudio": true
}
3 changes: 3 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
1 change: 1 addition & 0 deletions cypress/fixtures/testfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Das ist ein Textfile
94 changes: 84 additions & 10 deletions cypress/integration/form_spec.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,103 @@
const daten = {
title: "Mr.",
name: "Julian Pollinger"
name: "Julian Pollinger",
longText: "Das ist ein langer toller und\n mehrzeiliger Text\n\n Grüßle"
}

//@Todo More Tests
describe('Tests', () => {
it('loads', () => {
describe("Head", () => {
it("Everything's there and fill", () => {
cy.visit("/");
});
it('Everything\'s there ', () => {
cy.contains("Great Switch").click();
cy.get("#title").select(daten.title);
cy.get("#name").type(daten.name);
cy.get("#fancyness").first().click();
cy.get("#fileupload");
});
it('Check results', () => {
cy.get('#result_raw').should((div) => {
const res = JSON.parse(div.text());
const {
"#/properties/name": name,
"#/properties/title": title,
"#/properties/done": done,
"#/properties/fancyness": fancyness
} = res;
expect(name).to.equal(daten.name);
expect(title).to.equal(daten.title);
expect(done).to.be.true;
expect(fancyness).to.equal("fanciest");

});
});
});

describe('Groups', () => {
it('Everything\'s there and fill', () => {
cy.visit("/");
cy.get("#due_date");
//Select four Stars in Rating
cy.get(':nth-child(4) > .b-rating-icon > .bi-star > g > path').click({force: true});
cy.get('[type="date"]').type('2021-12-28');
cy.get('[type="time"]').type('23:24');
cy.get('#description').type(daten.longText);
cy.get("#weekday_BV_option_0").check({force: true});
cy.get("#weekday_BV_option_2").check({force: true});
cy.get("#weekday_BV_option_6").check({force: true});
cy.get('#recurrence_interval').type('12');
cy.get('.bi-plus').click();
cy.get('#items').type('Eintrag 1');
cy.get('#testArray > .btn-outline-primary').click();
cy.get(':nth-child(2) > :nth-child(1) > #formGroup_items > :nth-child(1) > .input-group > #items').type('Eintrag 2');
cy.get('#tags___input__').type('smart{enter}cool{enter}super{enter}');

cy.get('[type="submit"]').first().click();
});
it('Check results', () => {
cy.get('#result_raw').should((div) => {
const res = JSON.parse(div.text());
expect(res["#/properties/name"]).to.equal(daten.name);
expect(res["#/properties/title"]).to.equal(daten.title);
expect(res["#/properties/done"]).to.be.true;
const {
"#/properties/rating": rating,
"#/properties/weekday": weekday,
"#/properties/testArray": testArray,
"#/properties/due_date": due_date,
"#/properties/description": description,
"#/properties/recurrence_interval": recurrence_interval,
"#/properties/tags": tags,
} = res;
expect(due_date).to.equal("2021-12-28T23:24");
expect(rating).to.equal(4);
expect(description).to.equal(daten.longText);
expect(weekday).to.deep.equal(["Monday", "Wednesday", "Sunday"]);
expect(recurrence_interval).to.equal("12");
expect(testArray).to.deep.equal(["Eintrag 1", "Eintrag 2"]);
expect(tags).to.deep.equal(["smart", "cool", "super"]);

});
});
});

describe('Object', () => {
it('Everything\'s there and fill', () => {
cy.visit("/");
//
});
it('Check results', () => {
cy.get('#result_raw').should((div) => {
const res = JSON.parse(div.text());
const {
"#/properties/name": name,
"#/properties/title": title,
"#/properties/done": done,
"#/properties/fancyness": fancyness,
"#/properties/rating": rating,
"#/properties/weekday": weekday,
"#/properties/testArray": testArray,
"#/properties/due_date": due_date,
"#/properties/description": description,
"#/properties/recurrence_interval": recurrence_interval,
"#/properties/tags": tags,
} = res;

});
});
})
});

0 comments on commit 6399698

Please sign in to comment.