-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e67eb0
commit bbda363
Showing
1 changed file
with
29 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,29 @@ | ||
describe('Add Tweet Content', () => { | ||
it('Carol adds tweet content to graph', () => { | ||
cy.initialSetup('carol', 300) | ||
|
||
cy.intercept({ | ||
method: 'POST', | ||
url: 'http://localhost:8444/api/add_node*', | ||
}).as('addTweet') | ||
|
||
cy.get('[data-testid="add-content-modal"]').click() | ||
|
||
cy.get('#addContent').should('exist') | ||
cy.get('[id="cy-youtube-channel-id"]').type('https://twitter.com/ijbguy/status/1771096005162729663') | ||
cy.get('[data-testid="add-content-btn"]').click() | ||
cy.get('[data-testid="check-icon"]').click() | ||
|
||
cy.wait('@addTweet').then((interception) => { | ||
// check we get a 402 response code, when trying to add content for the first time | ||
expect(interception.response.statusCode).to.eq(402) | ||
}) | ||
|
||
cy.intercept({ | ||
method: 'POST', | ||
url: 'http://localhost:8444/api/add_node*', | ||
}).as('addTweet2') | ||
|
||
cy.wait('@addTweet2').then((intersection) => { | ||
console.log(intersection.response) | ||
cy.log(JSON.stringify(intersection.response)) | ||
}) // This is because add source is currently skipped, | ||
|
||
cy.get('.Toastify__toast-body').should('have.text', 'Content Added') | ||
|
||
cy.get('#addContent').should('not.exist') | ||
}) | ||
}) | ||
describe('Add Tweet Content', () => { | ||
it('Carol adds tweet content to graph', () => { | ||
cy.initialSetup('carol', 300) | ||
|
||
cy.intercept({ | ||
method: 'POST', | ||
url: 'http://localhost:8444/api/add_node*', | ||
}).as('addTweet') | ||
|
||
cy.get('[data-testid="add-content-modal"]').click() | ||
|
||
cy.get('#addContent').should('exist') | ||
cy.get('[id="cy-youtube-channel-id"]').type('https://twitter.com/ijbguy/status/1771096005162729663') | ||
cy.get('[data-testid="add-content-btn"]').click() | ||
cy.get('[data-testid="check-icon"]').click() | ||
|
||
cy.wait('@addTweet').then((interception) => { | ||
// check we get a 402 response code, when trying to add content for the first time | ||
expect(interception.response.statusCode).to.eq(402) | ||
}) | ||
|
||
// Wait for the UI to update and toast to appear | ||
cy.wait(5000) | ||
cy.get('.Toastify__toast-body', { timeout: 15000 }).should('have.text', 'Content Added') | ||
|
||
// Verify the modal is closed | ||
cy.get('#addContent').should('not.exist') | ||
}) | ||
}) |