Skip to content

Commit 6418fb7

Browse files
committed
fix: add imports from cypress
1 parent 67e2cb3 commit 6418fb7

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

cypress.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { defineConfig } from 'cypress'
1+
import { defineConfig } from 'cypress';
22

33
export default defineConfig({
44
e2e: {
55
// We've imported your old cypress plugins here.
66
// You may want to clean this up later by importing these.
7-
setupNodeEvents(on, config) {
8-
return require('./cypress/plugins/index.js')(on, config)
9-
},
107
},
11-
})
8+
});

cypress/e2e/test_form.cy.js

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/// <reference types="Cypress" />
2-
3-
context('Form', () => {
1+
import { describe, beforeEach, cy, it, expect } from 'cypress';
42

3+
describe('Form', () => {
54
beforeEach(() => {
6-
cy.visit('http://localhost:3000/')
7-
})
5+
cy.visit('http://localhost:3000/');
6+
});
87

98
it('should change input values', () => {
109
const nameText = 'John Deer';
@@ -17,24 +16,28 @@ context('Form', () => {
1716
cy.get('[id="#/properties/done-input"]').uncheck();
1817
cy.get('[id="#/properties/recurrence"] > div').click();
1918
cy.get('[data-value="Monthly"]').click();
20-
cy.get('[id="#/properties/recurrence_interval-input"]').clear().type(recurrenceIntervalText);
19+
cy.get('[id="#/properties/recurrence_interval-input"]')
20+
.clear()
21+
.type(recurrenceIntervalText);
2122
cy.get('[id="#/properties/due_date-input"]').clear().type(dateText);
2223
cy.get('[id="#/properties/rating"] span:last').click();
23-
cy.get('[id="boundData"]').invoke('text').then((content => {
24-
const data = JSON.parse(content);
24+
cy.get('[id="boundData"]')
25+
.invoke('text')
26+
.then(content => {
27+
const data = JSON.parse(content);
2528

26-
expect(data.name).to.equal(nameText);
27-
cy.get('[id="#/properties/name"] p').should('be.empty')
29+
expect(data.name).to.equal(nameText);
30+
cy.get('[id="#/properties/name"] p').should('be.empty');
2831

29-
cy.get('[id="#/properties/recurrence_interval"]').should('exist')
32+
cy.get('[id="#/properties/recurrence_interval"]').should('exist');
3033

31-
expect(data.description).to.equal(descText);
32-
expect(data.done).to.equal(false);
33-
expect(data.recurrence).to.equal('Monthly');
34-
expect(data.recurrence_interval).to.equal(recurrenceIntervalText);
35-
expect(data.due_date).to.equal(dateText);
36-
expect(data.rating).to.equal(5);
37-
}));
34+
expect(data.description).to.equal(descText);
35+
expect(data.done).to.equal(false);
36+
expect(data.recurrence).to.equal('Monthly');
37+
expect(data.recurrence_interval).to.equal(recurrenceIntervalText);
38+
expect(data.due_date).to.equal(dateText);
39+
expect(data.rating).to.equal(5);
40+
});
3841
});
3942

4043
it('should show errors', () => {
@@ -49,12 +52,14 @@ context('Form', () => {
4952
cy.get('[id="#/properties/recurrence"] > div').click();
5053
cy.get('[data-value="Never"]').click();
5154

52-
cy.get('[id="#/properties/recurrence_interval"]').should('not.exist')
55+
cy.get('[id="#/properties/recurrence_interval"]').should('not.exist');
5356

54-
cy.get('[id="boundData"]').invoke('text').then((content => {
55-
const data = JSON.parse(content);
57+
cy.get('[id="boundData"]')
58+
.invoke('text')
59+
.then(content => {
60+
const data = JSON.parse(content);
5661

57-
expect(data.due_date).to.equal('Invalid date');
58-
}));
62+
expect(data.due_date).to.equal('Invalid date');
63+
});
5964
});
60-
})
65+
});

0 commit comments

Comments
 (0)