Skip to content

Commit b1fb424

Browse files
committed
fix: add imports from cypress
1 parent edc4c94 commit b1fb424

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

cypress.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineConfig({
77
baseUrl: 'http://localhost:3000/',
88
viewportWidth: 1280,
99
viewportHeight: 768,
10-
specPattern: '**/*.e2e.ts',
10+
specPattern: '**/*.cy.js',
1111
video: false,
1212
screenshotOnRunFailure: false,
1313

cypress/e2e/test_form.cy.js

+29-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/// <reference types="Cypress" />
22

3-
context('Form', () => {
3+
import { context, beforeEach, cy, it, expect } from 'cypress';
44

5+
context('Form', () => {
56
beforeEach(() => {
6-
cy.visit('http://localhost:3000/')
7-
})
7+
cy.visit('http://localhost:3000/');
8+
});
89

910
it('should change input values', () => {
1011
const nameText = 'John Deer';
@@ -17,24 +18,28 @@ context('Form', () => {
1718
cy.get('[id="#/properties/done-input"]').uncheck();
1819
cy.get('[id="#/properties/recurrence"] > div').click();
1920
cy.get('[data-value="Monthly"]').click();
20-
cy.get('[id="#/properties/recurrence_interval-input"]').clear().type(recurrenceIntervalText);
21+
cy.get('[id="#/properties/recurrence_interval-input"]')
22+
.clear()
23+
.type(recurrenceIntervalText);
2124
cy.get('[id="#/properties/due_date-input"]').clear().type(dateText);
2225
cy.get('[id="#/properties/rating"] span:last').click();
23-
cy.get('[id="boundData"]').invoke('text').then((content => {
24-
const data = JSON.parse(content);
26+
cy.get('[id="boundData"]')
27+
.invoke('text')
28+
.then(content => {
29+
const data = JSON.parse(content);
2530

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

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

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-
}));
36+
expect(data.description).to.equal(descText);
37+
expect(data.done).to.equal(false);
38+
expect(data.recurrence).to.equal('Monthly');
39+
expect(data.recurrence_interval).to.equal(recurrenceIntervalText);
40+
expect(data.due_date).to.equal(dateText);
41+
expect(data.rating).to.equal(5);
42+
});
3843
});
3944

4045
it('should show errors', () => {
@@ -49,12 +54,14 @@ context('Form', () => {
4954
cy.get('[id="#/properties/recurrence"] > div').click();
5055
cy.get('[data-value="Never"]').click();
5156

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

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

57-
expect(data.due_date).to.equal('Invalid date');
58-
}));
64+
expect(data.due_date).to.equal('Invalid date');
65+
});
5966
});
60-
})
67+
});

0 commit comments

Comments
 (0)