Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit 081861a

Browse files
authored
Merge pull request #325 from openforge/cypress-int
Feat(Cypress): Install Cypress + Contact Page Tests
2 parents 62ac9e4 + 3945e3c commit 081861a

25 files changed

+450
-357
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
describe('About page', function() {
2+
var env = 'http://localhost:3333'
3+
beforeEach(() => {
4+
cy.visit(env + '/about')
5+
})
6+
})
7+
8+
// Moving this here for now -- from the old home page, but some of this will be relevant here
9+
10+
// describe('Perspectives Section', function () {
11+
// it('Should scroll to the perspectives section', function() {
12+
// cy.get('#perspectives').scrollIntoView()
13+
// })
14+
// })
15+
// describe('About Section - App-Members Component', function() {
16+
// it('Should be able to click links within app-members', function() {
17+
// cy.get('#about').scrollIntoView()
18+
19+
// cy.get('#about > div > app-members > div > div').as('members')
20+
// .its('length').should('be.gt', 13)
21+
22+
// cy.get('@members').contains('Software Engineer')
23+
// cy.get('@members').contains('Designer')
24+
// cy.get('@members').contains('Front End')
25+
26+
// cy.get('@members').find('div:nth-child(1)').find('div.col.text-center').within(function() {
27+
// cy.get('a').should('have.attr', 'href')
28+
// cy.get('a').should('have.attr', 'title')
29+
// cy.get('a').should('have.attr', 'style')
30+
31+
// cy.get('a').eq(0).should('have.attr', 'href', 'mailto:jedi@openforge.io').click()
32+
// cy.get('a').eq(1).should('have.attr', 'href', 'https://twitter.com/jedihacks').click()
33+
// cy.get('a').eq(2).should('have.attr', 'href', 'https://github.com/jedihacks').click()
34+
// })
35+
// })
36+
// })
Lines changed: 176 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,212 @@
11
describe('Contact Page', function () {
2+
var env = 'http://localhost:3333';
23
beforeEach(() => {
3-
cy.visit('localhost:3333/contact')
4+
cy.visit(env + '/contact')
45
cy.get('button[type=submit]').as('submitBtn')
56
})
67

7-
describe('Header', function() {
8-
it('Header should display with appropriate text content within it', function() {
9-
const h2Content = 'Let\'s Work Together'
10-
const pContent = 'Request'
8+
describe('Nav Bar Navigation (Desktop)', function () {
9+
// TODO -> Test suite for the blog link in nav bar.
10+
it('Home on nav bar should redirect to home page', function () {
11+
cy.get('.navbar').contains('Home').click()
12+
cy.url().should('include', '/')
13+
})
14+
describe('Services', function () {
15+
beforeEach(() => {
16+
// Gets Services text
17+
cy.get('.container > #navbarSupportedContent').contains('Services');
18+
// Clicks services dropdown arrow
19+
cy.get('.container > #navbarSupportedContent > .navbar-nav > .nav-item > #navbarDropdown').click();
20+
})
21+
it('Services should drop down to display Development and navigate to developer page', function () {
22+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(1) > .nav-link').contains('Development').click()
23+
cy.url().should('include', '/app-developer')
24+
})
25+
it('Services should drop down to display Design and navigate to design page', function () {
26+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(2) > .nav-link').contains('Design').click();
27+
cy.url().should('include', '/app-designer');
28+
})
29+
it('Services should drop down to display Consulting and navigate to consulting page', function () {
30+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(3) > .nav-link').contains('Consulting').click()
31+
cy.url().should('include', '/startup-consulting')
32+
});
33+
});
1134

12-
cy.get('header')
13-
.should('exist')
14-
.and('be.visible')
15-
cy.get('.hero')
16-
.contains(h2Content)
17-
.and('be.visible')
18-
cy.get('.hero')
19-
.contains(pContent)
20-
.and('be.visible')
35+
describe('About', function () {
36+
it('About should drop down to display Meet the team and navigate to about page', function () {
37+
cy.get('.navbar').contains('About').click()
38+
cy.get('.navbar').contains('Meet the team').click()
39+
cy.url().should('include', '/about')
40+
cy.contains('We Are Passionate About Technology and Design')
41+
})
42+
it('About should drop down to display Juntoscope Case Study and navigate to juntoscope page', function () {
43+
cy.get('.navbar').contains('About').click()
44+
cy.get('.navbar').contains('Juntoscope Case Study').click()
45+
cy.url().should('include', '/juntoscope')
46+
cy.contains('Case Study')
47+
})
48+
it('About should drop down to display Toolbox and navigate to Toolbox page', function () {
49+
cy.get('.navbar').contains('About').click()
50+
cy.get('.navbar').contains('Toolbox').click()
51+
cy.url().should('include', '/toolbox')
52+
cy.contains('Here are some of the tools we use')
53+
})
54+
it('About should drop down to display PWA White Paper and navigate to PWA White Paper page', function () {
55+
cy.get('.navbar').contains('About').click()
56+
cy.get('.navbar').contains('PWA White Paper').click()
57+
cy.url().should('include', '/resources/pwa-white-paper')
58+
cy.contains('What is a PWA and is it right for you?')
59+
})
60+
});
61+
})
62+
63+
describe('Nav Bar Navigation (Mobile)', function () {
64+
beforeEach(() => {
65+
cy.viewport(960, 600) // Sets view to large to enable nav menu
66+
cy.get('.navbar-toggler').click() // expands nav menu before each test
67+
})
68+
it('Nav menu should collapse', function () {
69+
cy.wait(2000)
70+
cy.get('.navbar-toggler').click()
71+
})
72+
it('Home on nav Bar should redirect to home page', function () {
73+
cy.get('.navbar').contains('Home').click()
74+
cy.url().should('include', '/')
75+
})
76+
77+
describe('Services', function () {
78+
beforeEach(() => {
79+
cy.get('.container > #navbarSupportedContent').contains('Services');
80+
cy.get('.container > #navbarSupportedContent > .navbar-nav > .nav-item > #navbarDropdown').click();
81+
})
82+
it('Services should drop down to display Development and navigate to developer page', function () {
83+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(1) > .nav-link').contains('Development').click()
84+
cy.url().should('include', '/app-developer')
85+
})
86+
it('Services should drop down to display Design and navigate to design page', function () {
87+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(2) > .nav-link').contains('Design').click()
88+
cy.url().should('include', '/app-designer')
89+
})
90+
it('Services should drop down to display Consulting and navigate to consulting page', function () {
91+
cy.get('.navbar-nav > .nav-item:nth-child(2) > .dropdown-menu > .hydrated:nth-child(3) > .nav-link').contains('Consulting').click();
92+
cy.url().should('include', '/startup-consulting');
93+
})
94+
});
95+
96+
describe('About', function () {
97+
it('About should drop down to display Meet the team and navigate to about page', function () {
98+
cy.get('.navbar').contains('About').click()
99+
cy.get('.navbar').contains('Meet the team').click()
100+
cy.url().should('include', '/about')
101+
cy.contains('We Are Passionate About Technology and Design')
102+
})
103+
it('About should drop down to display Juntoscope Case Study and navigate to juntoscope page', function () {
104+
cy.get('.navbar').contains('About').click()
105+
cy.get('.navbar').contains('Juntoscope Case Study').click()
106+
cy.url().should('include', '/juntoscope')
107+
cy.contains('Case Study')
108+
})
109+
it('About should drop down to display Toolbox and navigate to Toolbox page', function () {
110+
cy.get('.navbar').contains('About').click()
111+
cy.get('.navbar').contains('Toolbox').click()
112+
cy.url().should('include', '/toolbox')
113+
cy.contains('Here are some of the tools we use')
114+
})
115+
it('About should drop down to display PWA White Paper and navigate to PWA White Paper page', function () {
116+
cy.get('.navbar').contains('About').click()
117+
cy.get('.navbar').contains('PWA White Paper').click()
118+
cy.url().should('include', '/resources/pwa-white-paper')
119+
cy.contains('What is a PWA and is it right for you?')
120+
})
121+
});
122+
});
123+
124+
describe('Header', function () {
125+
it('Header should display with appropriate text content within it', function () {
126+
const h2Content = 'Let\'s Work Together'
127+
const pContent = 'Request Free Quote'
128+
129+
cy.get('header').should('exist').and('be.visible')
130+
cy.get('.hero').contains(h2Content).and('be.visible')
131+
cy.get('.hero').contains(pContent).and('be.visible')
21132
})
22133

23-
it('Should contain a Request Now button that scrolls to the form on click', function() {
134+
it('Should contain a Request Now button that scrolls to the form on click', function () {
24135
cy.get('header')
25136
.find('.btn')
26137
.should('exist')
27138
.and('be.visible')
28-
.and('contain', 'Request Now')
139+
.and('contain', 'Request Free Quote')
29140
.click()
30141
cy.get('#second-content').click()
31142
})
32143
})
33144

34-
describe('Contact Form', function() {
145+
describe('Contact Form', function () {
35146
let nameField;
36147
let emailField;
37-
let companyField;
38148
let phoneField;
39149
let messageField;
40-
let radioField1;
41-
let radioField2;
42150

43151
describe('Successful form submission', function () {
44152
beforeEach(() => {
45-
nameField = cy.get('input[name=name]')
46-
.type('Test Name')
47-
emailField = cy.get('input[name=email]')
48-
.type('testEmail@gmail.com')
49-
companyField = cy.get('input[name=company]')
50-
.type('Test Company Name')
51-
phoneField = cy.get('input[name=phone]')
52-
.type('1459341234')
53-
messageField = cy.get('input[name=message]')
54-
.type('This is a test message')
55-
radioField1 = cy.get('[type="radio"]')
56-
.check('Web Development')
57-
radioField2 = cy.get('[type="radio"]')
58-
.check('200K')
153+
nameField = cy.get('input[name=name]').type('Testing')
154+
emailField = cy.get('input[name=email]').type('testEmail@gmail.com')
155+
phoneField = cy.get('input[name=phone]').type('1459341234')
156+
messageField = cy.get('input[name=message]').type('This is a test message')
59157
cy.get('@submitBtn').click()
60158
})
61159

62-
it('Should show a success message on submit when all form values have been filled out', function() {
63-
cy.get('div.alert')
64-
.should('exist')
65-
.contains('Thank you')
160+
it('Should show a success message on submit when all form values have been filled out', function () {
161+
cy.wait(2000)
162+
cy.contains('Thank you')
66163
})
67164

68-
it('All fields should be clear after successful form submission', function() {
69-
nameField.should('have.value', '')
70-
emailField.should('have.value', '')
71-
companyField.should('have.value', '')
72-
phoneField.should('have.value', '')
73-
messageField.should('have.value', '')
165+
it('All fields should be clear after successful form submission', function () {
166+
cy.get('input[name=name]').should('have.value', 'Testing')
167+
cy.get('input[name=email]').should('have.value', 'testEmail@gmail.com')
168+
cy.get('input[name=phone]').should('have.value', '1459341234')
169+
cy.get('input[name=message]').should('have.value', 'This is a test message')
74170
})
75171
})
76-
describe('Unsucessful form submission', function() {
172+
describe('Unsucessful form submission', function () {
77173
it('DOM should not show success message when all fields of the form are not filled out', function () {
78-
nameField = cy.get('input[name=name]')
79-
.type('Test Name')
80-
cy.get('@submitBtn').click()
81-
cy.get('div.alert').should('not.exist')
174+
nameField = cy.get('input[name=name]').type('Test Name')
175+
cy.get('@submitBtn').should('be.disabled')
82176
})
83177
})
84178
})
179+
180+
describe('Footer Navigation', function () {
181+
it('Navigate to SLA page', function () {
182+
cy.contains('Read our SLA').click()
183+
cy.url().should('include', '/service-level-agreement')
184+
})
185+
it('Navigate to Developer page', function () {
186+
// cy.contains('I\'m a developer').click()
187+
// cy.url().should('include', '/opportunities/develop')
188+
})
189+
it('Navigate to Design page', function () {
190+
// cy.contains('I\'m a designer').click()
191+
// cy.url().should('include', '/opportunities/design')
192+
})
193+
it('Navigates to StartupJunto Registration Page', function () {
194+
// cy.contains('Register Today!').click()
195+
})
196+
it('Navigates to OpenForge Twitter', function () {
197+
cy.contains('@OpenForge_US').click()
198+
})
199+
it('Navigates to OpenForge Facebook', function () {
200+
cy.contains('OpenForge_US').click()
201+
})
202+
it('Navigates to OpenForge Linkedin', function () {
203+
cy.contains('OpenForge_US').click()
204+
})
205+
it('Navigates to OpenForge Instagram', function () {
206+
cy.contains('@OpenForgeTeam').click()
207+
})
208+
//it('Open native mail to contact Hello@openforge.io', function () {
209+
//cy.contains('hello@openforge.io').click()
210+
//})
211+
})
85212
})

0 commit comments

Comments
 (0)