Skip to content

Commit 388bfd3

Browse files
committed
add e2e tests for showcase
#JSO-22
1 parent b32828b commit 388bfd3

File tree

2 files changed

+136
-5
lines changed

2 files changed

+136
-5
lines changed

vue-json-form/cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'cypress';
22

33
export default defineConfig({
4+
projectId: 'ecbo8x',
45
component: {
56
devServer: {
67
framework: 'vue',

vue-json-form/cypress/e2e/showcase.cy.ts

Lines changed: 135 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ describe('Structure', () => {
1515

1616
beforeEach(() => {
1717
cy.visit('http://localhost:5173/');
18-
cy.injectAxe();
19-
});
20-
21-
it('Check entire page for a11y issues', () => {
22-
cy.checkA11y();
2318
});
2419

2520
it('Switch', () => {
@@ -53,4 +48,139 @@ describe('Structure', () => {
5348
cy.get(id).should('exist');
5449
cy.get(`${id} > label`).should('exist');
5550
});
51+
describe('Group', () => {
52+
it('dueDate', () => {
53+
const id = 'input#vjf_control_for__properties_due_date';
54+
cy.get(id).should('exist');
55+
cy.get(id).should('have.attr', 'type', 'datetime-local');
56+
});
57+
it('Rating', () => {
58+
const id = 'input#vjf_control_for__properties_rating';
59+
cy.get(id).should('exist');
60+
cy.get(id).should('have.attr', 'type', 'range');
61+
cy.get(id).should('have.attr', 'min', '0');
62+
cy.get(id).should('have.attr', 'max', '5');
63+
cy.get(id).should('have.attr', 'step', '1');
64+
cy.get(id).should('have.value', 3);
65+
});
66+
it('Description', () => {
67+
const id = 'textarea#vjf_control_for__properties_description';
68+
cy.get(id).should('exist');
69+
cy.get(id).should(
70+
'have.value',
71+
'This good text was set as default'
72+
);
73+
cy.get(id).should('have.attr', 'rows', '2');
74+
});
75+
it('Teststring', () => {
76+
const id = 'input#vjf_control_for__properties_teststring';
77+
cy.get(id).should('exist');
78+
cy.get(id).should('have.attr', 'type', 'text');
79+
});
80+
it('Weekdays', () => {
81+
const id = 'div#vjf_control_for__properties_weekdays';
82+
cy.get(id).should('exist');
83+
cy.get(id).children().should('have.length', 7);
84+
85+
const weekdays = [
86+
'Monday',
87+
'Tuesday',
88+
'Wednesday',
89+
'Thursday',
90+
'Friday',
91+
'Saturday',
92+
'Sunday',
93+
];
94+
weekdays.forEach((day, index) => {
95+
cy.get(id)
96+
.children()
97+
.eq(index)
98+
.children()
99+
.first()
100+
.should('have.value', day)
101+
.should('have.attr', 'type', 'checkbox');
102+
});
103+
});
104+
it('RecurrenceInterval', () => {
105+
const id = 'input#vjf_control_for__properties_recurrence_interval';
106+
cy.get(id).should('exist');
107+
cy.get(id).should('have.attr', 'type', 'number');
108+
cy.get(id).should('have.attr', 'step', '1');
109+
cy.get(id)
110+
.parent()
111+
.parent()
112+
.siblings()
113+
.eq(0)
114+
.should('have.text', 'Weeks');
115+
});
116+
it('TestArray', () => {
117+
const id = 'div[name="/properties/testArray"]';
118+
cy.get(id).should('exist');
119+
cy.get(`${id} input`).should('exist');
120+
cy.get(`${id} input`).should(
121+
'have.attr',
122+
'placeholder',
123+
'This is a placeholder'
124+
);
125+
cy.get(`${id} button[aria-label='Add Item']`).should('exist');
126+
});
127+
});
128+
describe('Object', () => {
129+
beforeEach(() => {
130+
cy.get('#vjf_control_for__properties_group_selector')
131+
.children()
132+
.eq(3)
133+
.click();
134+
});
135+
136+
it('name', () => {
137+
const id =
138+
'input#vjf_control_for__properties_testObject_properties_petName';
139+
cy.get(id).should('exist');
140+
cy.get(id).should('have.attr', 'type', 'text');
141+
cy.get(id)
142+
.parent()
143+
.parent()
144+
.siblings()
145+
.eq(0)
146+
.should('have.text', 'Give me a name');
147+
});
148+
149+
it('age', () => {
150+
const id =
151+
'input#vjf_control_for__properties_testObject_properties_age';
152+
cy.get(id).should('exist');
153+
cy.get(id).should('have.attr', 'type', 'number');
154+
cy.get(id).should('have.attr', 'step', '1');
155+
cy.get(id).should('have.attr', 'min', '0');
156+
cy.get(id).should('have.attr', 'max', '100');
157+
cy.get(id).should('have.value', 10);
158+
});
159+
160+
it('flauschig', () => {
161+
const id =
162+
'input#vjf_control_for__properties_testObject_properties_flauschig';
163+
cy.get(id).should('exist');
164+
cy.get(id).should('have.attr', 'type', 'checkbox');
165+
});
166+
});
167+
168+
it('HTML text', () => {
169+
const id = 'span.vjf_htmlRenderer > p ';
170+
cy.get(id).should('exist');
171+
cy.get(id).should(
172+
'have.html',
173+
'Ich bin ein <strong class="text-primary">HTML</strong> Text'
174+
);
175+
});
176+
177+
it('Tags', () => {
178+
const id = 'div#vjf_control_for__properties_tags';
179+
cy.get(id).should('exist');
180+
});
181+
182+
it('Form Buttons', () => {
183+
cy.get('button[type="submit"]').should('exist');
184+
cy.get('button[type="reset"]').should('exist');
185+
});
56186
});

0 commit comments

Comments
 (0)