-
Notifications
You must be signed in to change notification settings - Fork 3
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
Testing/no auth testing branch #42
base: main
Are you sure you want to change the base?
Changes from all commits
87906ca
8419399
d6fc28f
775e5af
9ff1b4a
bfc2a75
0b6e232
345e4da
a3d0f2c
eb68024
e3db183
ed35ad0
16f23a4
5834496
a133e94
6b614c3
149c8a8
918229a
fefbc0b
7839de7
22454f8
f5cc977
b5fef7e
1ed9efc
ef49717
2722926
c14dfff
8fd634f
2145f60
cc5ce54
3a609fc
b570d71
cfeb5a8
116d5c8
0685c9e
62e2837
063adbf
5891844
9e0aefb
536f74b
b120f45
796610a
7c2cab8
f9f0204
e9d240a
31ae60f
b16be69
208a3a8
386edba
83b7aa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
const { defineConfig } = require("cypress"); | ||
require('dotenv').config() | ||
|
||
module.exports = defineConfig({ | ||
env: { | ||
auth0_username: process.env.AUTH0_USERNAME, | ||
auth0_password: process.env.AUTH0_PASSWORD, | ||
auth0_domain: process.env.REACT_APP_AUTH0_DOMAIN, | ||
auth0_audience: process.env.REACT_APP_AUTH0_AUDIENCE, | ||
auth0_scope: process.env.REACT_APP_AUTH0_SCOPE, | ||
auth0_client_id: process.env.REACT_APP_AUTH0_CLIENT_ID, | ||
auth0_client_secret: process.env.AUTH0_CLIENT_SECRET | ||
}, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
// on('task', { | ||
// async "db:seed"() { | ||
|
||
// } | ||
// }) | ||
}, | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
describe('App spec', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So glad this worked! |
||
cy.intercept('GET', '**/w/api.php?action=parse&format=json**', { fixture: 'controversiesRequest.json' }).as('controversiesRequest'); | ||
cy.visit('http://localhost:3000/'); | ||
cy.wait('@initialSearch'); | ||
cy.wait('@sectionsRequest'); | ||
cy.wait('@controversiesRequest'); | ||
}); | ||
|
||
it('should display all content on page load', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. excellent use of the stubs and the waiting to make it load! |
||
cy.get('.App').should('be.visible'); | ||
cy.get('.App-header').should('be.visible'); | ||
cy.get('.logo-link').should('be.visible'); | ||
cy.get('.button__login').should('be.visible'); | ||
cy.get('.random-headline').should('be.visible'); | ||
cy.get('.result-name').should('contain', '4chan'); | ||
cy.get('.random-headline').should('contain', 'Random Controversy'); | ||
cy.get('.card').should('be.visible'); | ||
cy.get('.card') | ||
.children() | ||
.first() | ||
.within(() => { | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
cy.contains('button', '😡Save Controversy😡'); | ||
cy.contains('button', '🤬Save as favorite controversy🤬'); | ||
}); | ||
cy.get('.card') | ||
.children() | ||
.last() | ||
.within(() => { | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
cy.contains('button', '😡Save Controversy😡'); | ||
cy.contains('button', '🤬Save as favorite controversy🤬'); | ||
}); | ||
}); | ||
}); | ||
|
||
//Login couldn't work because Cypress couldn't session | ||
// describe('Logged in tests', () => { | ||
// beforeEach(() => { | ||
// cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch'); | ||
// cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest'); | ||
// cy.intercept('GET', '**/w/api.php?action=parse&format=json**', { fixture: 'controversiesRequest.json' }).as('controversiesRequest'); | ||
// cy.visit('http://localhost:3000/'); | ||
// cy.wait('@initialSearch'); | ||
// cy.wait('@sectionsRequest'); | ||
// cy.wait('@controversiesRequest'); | ||
// cy.loginToAuth0('[email protected]', 'JZgyS@xJi9ej@V9'); | ||
// }); | ||
// it('should display logged in content', () => { | ||
// cy.get('#profile').should('be.visible'); | ||
// cy.get('#profile').should('contain', 'Profile'); | ||
// }); | ||
// }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe('Card Component', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&format=json**', { fixture: 'controversiesRequest.json' }).as('controversiesRequest'); | ||
cy.visit('http://localhost:3000/'); | ||
cy.wait('@initialSearch'); | ||
cy.wait('@sectionsRequest'); | ||
cy.wait('@controversiesRequest'); | ||
}); | ||
|
||
it('Renders snippet properly', () => { | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
}); | ||
|
||
it('Handles show more/show less functionality', () => { | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h3').first().click(); | ||
cy.get('p').should('contain', 'According to The Washington Post, \"the site\'s users have managed to pull off some of the highest-profile collective actions in the history of the Internet.\"[1]'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good job rembmering uyou can use backslashes to put quotes into strings!!! |
||
cy.get('p').should('have.length', '36'); | ||
cy.get('h3').first().click(); | ||
cy.get('p').should('have.length', '10'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
describe('Can search for a Controversy', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&format=json**', { fixture: 'controversiesRequest.json' }).as('controversiesRequest'); | ||
|
||
cy.visit('http://localhost:3000/'); | ||
cy.wait('@initialSearch'); | ||
cy.wait('@sectionsRequest'); | ||
cy.wait('@controversiesRequest'); | ||
}); | ||
|
||
it('Can login', () => { | ||
cy.get('.button__login').should('be.visible') | ||
cy.get('.button__login').click() | ||
cy.get('#profile').should('be.visible') | ||
cy.get('input').should('be.visible') | ||
|
||
}) | ||
describe('Should be able to search for a controversy', () => { | ||
beforeEach(() => { | ||
cy.get('.button__login').click() | ||
cy.get('.favoriteButton').first().click(); | ||
cy.get('.saveButton').last().click(); | ||
// cy.visit('http://localhost:3000/Profile'); | ||
}); | ||
|
||
it('Searches for a term, then clears input', () => { | ||
cy.get('input[type="text"]').should('be.visible'); | ||
cy.get('input[type="text"]').type('Rush Limbaugh'); | ||
cy.get('input[type="text"]').should('have.value', 'Rush Limbaugh') | ||
cy.get('#search-button').should('be.visible'); | ||
cy.get('#search-button').click() | ||
cy.get('input[type="text"]').should('have.value', '') | ||
}); | ||
|
||
it('Displays controversies for a search result', () => { | ||
cy.get('.card').should('be.visible'); | ||
cy.get('.result-name').should('contain', '4chan'); | ||
cy.get('.results-list') | ||
.children() | ||
.first() | ||
.within(() => { | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible') | ||
cy.get('h3').should('contain', 'Internet raids') | ||
cy.contains('button', '😡Save Controversy😡'); | ||
cy.contains('button', '🤬Save as favorite controversy🤬'); | ||
}); | ||
cy.get('.results-list') | ||
.children() | ||
.last() | ||
.within(() => { | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible') | ||
cy.get('h3').should('contain', 'Internet raids') | ||
cy.contains('button', '😡Save Controversy😡'); | ||
cy.contains('button', '🤬Save as favorite controversy🤬'); | ||
}); | ||
}); | ||
}); | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
describe('Can login and go into profile', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest'); | ||
cy.intercept('GET', '**/w/api.php?action=parse&format=json**', { fixture: 'controversiesRequest.json' }).as('controversiesRequest'); | ||
cy.visit('http://localhost:3000/'); | ||
cy.wait('@initialSearch'); | ||
cy.wait('@sectionsRequest'); | ||
cy.wait('@controversiesRequest'); | ||
}); | ||
|
||
it('Can login', () => { | ||
cy.get('.button__login').should('be.visible'); | ||
cy.get('.button__login').click(); | ||
cy.get('#profile').should('be.visible'); | ||
cy.get('input').should('be.visible'); | ||
}) | ||
|
||
describe('UserView Component', () => { | ||
beforeEach(() => { | ||
cy.get('.button__login').click(); | ||
cy.get('.favoriteButton').first().click(); | ||
cy.get('.saveButton').last().click(); | ||
cy.get('#profile').click(); | ||
}); | ||
|
||
it('Loads page content properly', () => { | ||
cy.get('.filter-buttons').should('be.visible'); | ||
cy.get('.filter-buttons').should('have.descendants', 'button'); | ||
}); | ||
|
||
it('Shows all saved controversies on profile page load', () => { | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
}); | ||
|
||
it('Should show favorited cards', () => { | ||
cy.get('.show-favorites').click(); | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
}); | ||
|
||
it('Should return to show all saved', () => { | ||
cy.get('.show-all').click(); | ||
cy.get('.card-content').should('be.visible'); | ||
cy.get('h2').should('contain', 'Controversies and harassment incidents[edit]'); | ||
cy.get('img').should('be.visible'); | ||
cy.get('h3').should('contain', 'Internet raids'); | ||
}); | ||
|
||
it('Should return to the main page on header click', () => { | ||
cy.get('.header-text').should('be.visible'); | ||
cy.get('.header-text').click(); | ||
cy.get('input').should('be.visible'); | ||
cy.get('h2').should('be.visible'); | ||
}) | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
describe('template spec', () => { | ||
it('passes', () => { | ||
cy.visit('https://example.cypress.io') | ||
}) | ||
}) | ||
//code from a cypress/auth0 tutorial | ||
// describe('Auth0', function () { | ||
// beforeEach(function () { | ||
// cy.task('db:seed'); | ||
// cy.intercept('POST', '/graphql').as('createUserAccount'); | ||
// cy.loginToAuth0( | ||
// Cypress.env('auth0_username'), | ||
// Cypress.env('auth0_password') | ||
// ) | ||
// cy.visit('/'); | ||
// }) | ||
|
||
// it('shows onboarding', function () { | ||
// cy.contains('Get Started').should('be.visible'); | ||
// }) | ||
// }) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"batchcomplete": "", | ||
"continue": { | ||
"sroffset": 10, | ||
"continue": "-||" | ||
}, | ||
"query": { | ||
"searchinfo": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good fixture |
||
"totalhits": 998, | ||
"suggestion": "chan", | ||
"suggestionsnippet": "chan" | ||
}, | ||
"search": [ | ||
{ | ||
"ns": 0, | ||
"title": "4chan", | ||
"pageid": 12561015, | ||
"size": 154562, | ||
"wordcount": 14021, | ||
"snippet": "<span class=\"searchmatch\">4chan</span> is an anonymous English-language imageboard website. Launched by Christopher "moot" Poole in October 2003, the site hosts boards dedicated to a", | ||
"timestamp": "2023-12-26T16:33:14Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "/pol/", | ||
"pageid": 47045163, | ||
"size": 72220, | ||
"wordcount": 6783, | ||
"snippet": ""Politically Incorrect", is an anonymous political discussion imageboard on <span class=\"searchmatch\">4chan</span>. As of 2022, it is the most active board on the site. It has had a substantial", | ||
"timestamp": "2023-12-18T12:01:41Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Christopher Poole", | ||
"pageid": 18395608, | ||
"size": 18449, | ||
"wordcount": 1438, | ||
"snippet": "entrepreneur and developer. He founded the anonymous English-language imageboard <span class=\"searchmatch\">4chan</span> in October 2003, when he was still a teenager; he served as the site's head", | ||
"timestamp": "2024-01-03T18:57:46Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Pepe the Frog", | ||
"pageid": 49002118, | ||
"size": 80165, | ||
"wordcount": 6547, | ||
"snippet": "such as Myspace, Gaia Online, and <span class=\"searchmatch\">4chan</span> in 2008. By 2015, he had become one of the most popular memes used on <span class=\"searchmatch\">4chan</span> and Tumblr. Different types of Pepe", | ||
"timestamp": "2023-12-22T23:28:41Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Imageboard", | ||
"pageid": 18985311, | ||
"size": 24387, | ||
"wordcount": 2366, | ||
"snippet": "from trains to current news. The most popular English language imageboard, <span class=\"searchmatch\">4chan</span>, similarly has a large variety of topics. Imageboards are also different", | ||
"timestamp": "2023-12-20T13:08:44Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Hiroyuki Nishimura", | ||
"pageid": 217798, | ||
"size": 28458, | ||
"wordcount": 2832, | ||
"snippet": "accessed Japanese message board, 2channel, and current administrator of <span class=\"searchmatch\">4chan</span>. He is also a self-help author and TV personality.: PT38 He is often known", | ||
"timestamp": "2023-12-15T05:02:32Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "/b/", | ||
"pageid": 61171989, | ||
"size": 14116, | ||
"wordcount": 1326, | ||
"snippet": "/b/, also called random, is an anonymous imageboard on <span class=\"searchmatch\">4chan</span>. It was the first board created during the establishment of the platform in 2003, and it", | ||
"timestamp": "2023-12-30T02:38:35Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "2chan", | ||
"pageid": 509815, | ||
"size": 2483, | ||
"wordcount": 374, | ||
"snippet": "fork of <span class=\"searchmatch\">4chan</span>, created by American software developer Fredrick Brennan and currently owned by Jim Watkins 420chan, an imageboard based on <span class=\"searchmatch\">4chan</span> and dedicated", | ||
"timestamp": "2023-12-14T18:47:38Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Wojak", | ||
"pageid": 58818336, | ||
"size": 20088, | ||
"wordcount": 1878, | ||
"snippet": "image aggregation website. The meme subsequently grew in popularity on <span class=\"searchmatch\">4chan</span>, where the character became associated with the phrases formerly used by", | ||
"timestamp": "2024-01-05T09:18:03Z" | ||
}, | ||
{ | ||
"ns": 0, | ||
"title": "Kill All Normies", | ||
"pageid": 58996995, | ||
"size": 9714, | ||
"wordcount": 915, | ||
"snippet": "Kill All Normies: Online Culture Wars from <span class=\"searchmatch\">4chan</span> and Tumblr to Trump and the Alt-Right is a 2017 non-fiction book by Angela Nagle published by Zero Books", | ||
"timestamp": "2024-01-03T04:44:09Z" | ||
} | ||
] | ||
} | ||
} |
Large diffs are not rendered by default.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this auth stuff given that we arent testing it anymore?