Skip to content

Commit

Permalink
feat:#656 - adding tests back
Browse files Browse the repository at this point in the history
  • Loading branch information
marclupanc committed Feb 4, 2025
1 parent a7f8f41 commit cf1ced8
Show file tree
Hide file tree
Showing 5 changed files with 497 additions and 497 deletions.
226 changes: 113 additions & 113 deletions test/cypress/e2e/entries.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,116 +5,116 @@
// ** This file is an example of how to write Cypress tests, you can safely delete it **

// This test will pass when run against a clean Quasar project
// describe('Home page', () => {
// const name = 'Hello World!'
// context('Roadmap Section', () => {
// // TODO : Remove Not needed again
// it('Testing accordion', () => {
// cy.viewport('macbook-16')
// // cy.visit('/2023/07/lorem-ipsum')
// cy.visit('/month')
// cy.scrollTo('bottom')
// cy.get('[data-test="entries"]')
//
// cy.visit('/month')
// cy.get('[href="/search"]').click()
// cy.get('[href="/month"]').click()
// cy.get('[data-test="main-menu"] > .q-tabs__content > .q-tab--active').click()
// })
// })
//
// it('Should create a prompt', () => {
// cy.login()
// // cy.wait(1000)
// cy.visit('/admin')
// // Get the dropdown button and click it
// cy.get('[data-test="dropdown-menu"]').click()
// // Get the first button (New Prompt) and click it
// cy.get('[data-test="create-prompt"]').should('be.visible').click()
// // Get the date input and choose the last option
// cy.get('[data-test="date-picker"]').should('be.visible').click()
// cy.get('[data-test="close-btn"]').click()
//
// // Get the title input and type 'Hello World!' into it
// cy.get('[data-test="input-title"]').type(name)
//
// // Get the description input and type 'This is a sample prompt' into it
// cy.get('[data-test="input-description"]').type('This is a sample prompt')
//
// // Get the file image input and upload the Cypress logo
// cy.get('[data-test="file-image"]').selectFile('src/assets/cypress.jpg')
//
// // Get the categories select and choose add 'Cypress' and 'Test' categories
// cy.get('[data-test="select-categories"]').type('Cypress{enter}')
//
// cy.get('[data-test="select-categories"]').type('Test{enter}')
// // Get the submit button and click it
// cy.get('[data-test="button-submit"] > .q-btn__content').click()
// // cy.get('[data-test="button-submit"]').click()
//
// //Check the Prompt is submitted successfully
// cy.get('.q-notification__message').contains('Prompt successfully submitted')
// })
//
// it('should open the dialog when clicking the add button, display correct content, and close on hideDialog event', () => {
// cy.login()
// cy.visit('/admin')
//
// cy.get('[data-test="input-search"]').type('Cypress Tester')
//
// const promptSlug = '/hello-world-'
// const promptTitle = 'Hello World!'
//
// // Check if the prompt title link is visible and clickable
// cy.get('[data-test="prompt-title"]').contains(promptTitle).should('have.attr', 'href', promptSlug).click()
//
// // Click the "Create entry" button
// cy.get('[data-test="create-entry"]').click()
//
// // Verify the dialog is visible
// cy.get('.q-dialog[data-test="entry-dialog"]').should('be.visible')
// // Click the "Close Entry Card" button
// cy.get('[data-test="close-button"]').click()
//
// // Verify the dialog is closed
// cy.get('.q-dialog[data-test="entry-dialog"]').should('not.exist')
// })
//
// it('should redirect to login and display a notification when attempting to create an entry without logging in', () => {
// // Clear local storage
// cy.clearLocalStorage()
//
// cy.visit('/hello-world-')
// // Ensure the "Create Entry" button exists and is visible
// cy.get('[data-test="create-entry"]').should('exist').and('be.visible')
//
// // Click the "Create entry" button without login
// cy.get('[data-test="create-entry"]').click()
//
// // Assert that the user is redirected to the login page
// cy.url().should('include', '/profile')
//
// // Assert the notification message
// cy.get('.q-notification').should('be.visible').and('contain.text', 'Please log in to create a new entry')
// })
//
// it('Should delete the prompt', () => {
// cy.login()
// cy.visit('/admin')
// // Get the second button (Delete Prompt) and click it
// cy.get('[data-test="input-search"]').type('Cypress Tester')
// // eslint-disable-next-line cypress/no-unnecessary-waiting
// cy.wait(2000)
//
// // Get the delete button and click it
// cy.get(`[data-test="item-card"] > .text-right > [data-test="button-delete-prompt"]`).click()
//
// // Get the confirm button and click it
// cy.get('[data-test="confirm-delete-prompt"]').click()
// // eslint-disable-next-line cypress/no-unnecessary-waiting
// cy.wait(2000)
//
// // Wait the notification
// cy.get('.q-notification__message').contains('Prompt successfully deleted')
// })
// })
describe('Home page', () => {
const name = 'Hello World!'
context('Roadmap Section', () => {
// TODO : Remove Not needed again
it('Testing accordion', () => {
cy.viewport('macbook-16')
// cy.visit('/2023/07/lorem-ipsum')
cy.visit('/month')
cy.scrollTo('bottom')
cy.get('[data-test="entries"]')

cy.visit('/month')
cy.get('[href="/search"]').click()
cy.get('[href="/month"]').click()
cy.get('[data-test="main-menu"] > .q-tabs__content > .q-tab--active').click()
})
})

it('Should create a prompt', () => {
cy.login()
// cy.wait(1000)
cy.visit('/admin')
// Get the dropdown button and click it
cy.get('[data-test="dropdown-menu"]').click()
// Get the first button (New Prompt) and click it
cy.get('[data-test="create-prompt"]').should('be.visible').click()
// Get the date input and choose the last option
cy.get('[data-test="date-picker"]').should('be.visible').click()
cy.get('[data-test="close-btn"]').click()

// Get the title input and type 'Hello World!' into it
cy.get('[data-test="input-title"]').type(name)

// Get the description input and type 'This is a sample prompt' into it
cy.get('[data-test="input-description"]').type('This is a sample prompt')

// Get the file image input and upload the Cypress logo
cy.get('[data-test="file-image"]').selectFile('src/assets/cypress.jpg')

// Get the categories select and choose add 'Cypress' and 'Test' categories
cy.get('[data-test="select-categories"]').type('Cypress{enter}')

cy.get('[data-test="select-categories"]').type('Test{enter}')
// Get the submit button and click it
cy.get('[data-test="button-submit"] > .q-btn__content').click()
// cy.get('[data-test="button-submit"]').click()

//Check the Prompt is submitted successfully
cy.get('.q-notification__message').contains('Prompt successfully submitted')
})

it('should open the dialog when clicking the add button, display correct content, and close on hideDialog event', () => {
cy.login()
cy.visit('/admin')

cy.get('[data-test="input-search"]').type('Cypress Tester')

const promptSlug = '/hello-world-'
const promptTitle = 'Hello World!'

// Check if the prompt title link is visible and clickable
cy.get('[data-test="prompt-title"]').contains(promptTitle).should('have.attr', 'href', promptSlug).click()

// Click the "Create entry" button
cy.get('[data-test="create-entry"]').click()

// Verify the dialog is visible
cy.get('.q-dialog[data-test="entry-dialog"]').should('be.visible')
// Click the "Close Entry Card" button
cy.get('[data-test="close-button"]').click()

// Verify the dialog is closed
cy.get('.q-dialog[data-test="entry-dialog"]').should('not.exist')
})

it('should redirect to login and display a notification when attempting to create an entry without logging in', () => {
// Clear local storage
cy.clearLocalStorage()

cy.visit('/hello-world-')
// Ensure the "Create Entry" button exists and is visible
cy.get('[data-test="create-entry"]').should('exist').and('be.visible')

// Click the "Create entry" button without login
cy.get('[data-test="create-entry"]').click()

// Assert that the user is redirected to the login page
cy.url().should('include', '/profile')

// Assert the notification message
cy.get('.q-notification').should('be.visible').and('contain.text', 'Please log in to create a new entry')
})

it('Should delete the prompt', () => {
cy.login()
cy.visit('/admin')
// Get the second button (Delete Prompt) and click it
cy.get('[data-test="input-search"]').type('Cypress Tester')
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000)

// Get the delete button and click it
cy.get(`[data-test="item-card"] > .text-right > [data-test="button-delete-prompt"]`).click()

// Get the confirm button and click it
cy.get('[data-test="confirm-delete-prompt"]').click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000)

// Wait the notification
cy.get('.q-notification__message').contains('Prompt successfully deleted')
})
})
118 changes: 59 additions & 59 deletions test/cypress/e2e/feedbacks.cy.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
/* eslint-disable cypress/no-unnecessary-waiting */
/// <reference types="cypress" />

// describe('Feedback page', () => {
// beforeEach(() => {
// cy.viewport('ipad-2')
// cy.login()
// })
//
// it('Should user Give us feedback', () => {
// cy.visit('/profile')
// cy.get('.q-icon').contains('feedback').click()
//
// cy.get('[data-test="subject-input"]').type('Great Experience With Celebrity-Fanalyzer Platform')
//
// cy.get('[data-test="message-input"]').type(
// 'Dear Celebrity-Fanalyzer Team,\n\nI wanted to say that Celebrity-Fanalyzer Platform is fantastic! The design is user-friendly, and the features are very engaging. I enjoy using it every day and look forward to more updates.\n\nThank you for your excellent work!\n\nBest regards,\nCypress Tester'
// )
//
// // Get the submit button and click it
// cy.get('[data-test="submit-button"] > .q-btn__content').click()
//
// //Check the Feedback submitted!
// cy.get('.q-notification__message').contains('Feedback submitted!')
// })
//
// it('should delete feedback with the subject "Great Experience With Celebrity-Fanalyzer Platform"', () => {
// cy.visit('/admin')
//
// cy.get('[data-test="feedbacks-tab"]').click()
// cy.wait(4000)
//
// const feedbackSubject = 'Great Experience With Celebrity-Fanalyzer Platform'
//
// // Ensure feedback with subject is visible in the table
// cy.get('[data-test="feedback-table"]').contains(feedbackSubject).should('be.visible')
//
// // Find the feedback card for the specific subject and click the delete button
// cy.contains(feedbackSubject)
// // Locate the card element that contains the feedback subject
// .closest('[data-test="feedback-card"]')
// // Find the trash button within the card
// .find('[data-test="trash-button"]')
// // Click the delete button
// .click()
//
// // Ensure the delete confirmation dialog is visible
// cy.get('[data-test="delete-dialog"]').should('be.visible')
// // Confirm dialog message contains the expected text
//
// cy.get('[data-test="delete-dialog-message"]').should('contain', `Are you sure you want to delete this feedback from`)
// // Click the delete button in the dialog to confirm deletion
// cy.get('[data-test="delete-button"]').click()
//
// // Ensure the feedback is removed from the table
// // Feedback should no longer be in the table
// cy.get('[data-test="feedback-table"]').contains(feedbackSubject).should('not.exist')
//
// // Verify the success notification appears
// cy.get('.q-notification').should('be.visible').and('contain', 'Feedback deleted successfully')
// })
// })
describe('Feedback page', () => {
beforeEach(() => {
cy.viewport('ipad-2')
cy.login()
})

it('Should user Give us feedback', () => {
cy.visit('/profile')
cy.get('.q-icon').contains('feedback').click()

cy.get('[data-test="subject-input"]').type('Great Experience With Celebrity-Fanalyzer Platform')

cy.get('[data-test="message-input"]').type(
'Dear Celebrity-Fanalyzer Team,\n\nI wanted to say that Celebrity-Fanalyzer Platform is fantastic! The design is user-friendly, and the features are very engaging. I enjoy using it every day and look forward to more updates.\n\nThank you for your excellent work!\n\nBest regards,\nCypress Tester'
)

// Get the submit button and click it
cy.get('[data-test="submit-button"] > .q-btn__content').click()

//Check the Feedback submitted!
cy.get('.q-notification__message').contains('Feedback submitted!')
})

it('should delete feedback with the subject "Great Experience With Celebrity-Fanalyzer Platform"', () => {
cy.visit('/admin')

cy.get('[data-test="feedbacks-tab"]').click()
cy.wait(4000)

const feedbackSubject = 'Great Experience With Celebrity-Fanalyzer Platform'

// Ensure feedback with subject is visible in the table
cy.get('[data-test="feedback-table"]').contains(feedbackSubject).should('be.visible')

// Find the feedback card for the specific subject and click the delete button
cy.contains(feedbackSubject)
// Locate the card element that contains the feedback subject
.closest('[data-test="feedback-card"]')
// Find the trash button within the card
.find('[data-test="trash-button"]')
// Click the delete button
.click()

// Ensure the delete confirmation dialog is visible
cy.get('[data-test="delete-dialog"]').should('be.visible')
// Confirm dialog message contains the expected text

cy.get('[data-test="delete-dialog-message"]').should('contain', `Are you sure you want to delete this feedback from`)
// Click the delete button in the dialog to confirm deletion
cy.get('[data-test="delete-button"]').click()

// Ensure the feedback is removed from the table
// Feedback should no longer be in the table
cy.get('[data-test="feedback-table"]').contains(feedbackSubject).should('not.exist')

// Verify the success notification appears
cy.get('.q-notification').should('be.visible').and('contain', 'Feedback deleted successfully')
})
})
40 changes: 20 additions & 20 deletions test/cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
// ** This file is an example of how to write Cypress tests, you can safely delete it **

// This test will pass when run against a clean Quasar project
// describe('Home page', () => {
// context('Roadmap Section', () => {
// it('Testing accordion', () => {
// cy.viewport(1280, 800)
// cy.visit('/')
// cy.get('h3').should('have.length', 4)
// cy.get('h3').eq(0).contains('“Celebrity Fanalyzer?”')
// cy.getByData('roadmap').find('h3').contains('Development Roadmap')
//
// cy.getByData('roadmap').get('.q-expansion-item').eq(0).click()
// })
// })
// it('Should display properly', () => {
// cy.visit('/')
// cy.get('h2').contains('Welcome to Celebrity Fanalyzer!')
// // cy.get('h3').should('have.length', 3)
// cy.get('h3').eq(0).contains('“Celebrity Fanalyzer?”')
// cy.get('[data-test="roadmap"]').find('h3').contains('Development Roadmap')
// })
// })
describe('Home page', () => {
context('Roadmap Section', () => {
it('Testing accordion', () => {
cy.viewport(1280, 800)
cy.visit('/')
cy.get('h3').should('have.length', 4)
cy.get('h3').eq(0).contains('“Celebrity Fanalyzer?”')
cy.getByData('roadmap').find('h3').contains('Development Roadmap')

cy.getByData('roadmap').get('.q-expansion-item').eq(0).click()
})
})
it('Should display properly', () => {
cy.visit('/')
cy.get('h2').contains('Welcome to Celebrity Fanalyzer!')
// cy.get('h3').should('have.length', 3)
cy.get('h3').eq(0).contains('“Celebrity Fanalyzer?”')
cy.get('[data-test="roadmap"]').find('h3').contains('Development Roadmap')
})
})
Loading

0 comments on commit cf1ced8

Please sign in to comment.