Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Fix Gatsbygram Cypress tests #7607

Merged
merged 5 commits into from
Aug 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion examples/gatsbygram/cypress/integration/home_page_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ describe(`The Home Page`, () => {
cy.fixture(`posts`).then(postsData => {
const post1 = postsData[0]
const post2 = postsData[1]
// wait for page to initialize
cy.wait(200)
// open first post
cy.getTestElement(`post`)
.first()
Expand All @@ -72,6 +74,8 @@ describe(`The Home Page`, () => {
// click right arrow icon to go to 2nd post
cy.getTestElement(`next-post`).click()
cy.url().should("contain", post2.id)
// wait for page to transition
cy.wait(200)
// press left arrow to go back to 1st post
cy.getTestElement(`previous-post`).click()
cy.url().should("contain", post1.id)
Expand All @@ -84,14 +88,22 @@ describe(`The Home Page`, () => {
cy.fixture(`posts`).then(postsData => {
const post1 = postsData[0]
const post2 = postsData[1]
// wait for page to initialize
cy.wait(200)
// open fist post
cy.getTestElement(`post`)
.first()
.click()
// force, because sometimes the children cover
// the outer element causing Cypress to complain
.click({ force: true })
cy.url().should("contain", post1.id)
// wait for page to transition
cy.wait(200)
// press right arrow to go to 2nd post
cy.get(`body`).type(`{rightarrow}`)
cy.url().should("contain", post2.id)
// wait for page to transition
cy.wait(200)
// press left arrow to go back to 1st post
cy.get(`body`).type(`{leftarrow}`)
cy.url().should("contain", post1.id)
Expand Down