Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobeltrame committed Nov 7, 2023
1 parent dbfbe1f commit b7d2332
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 116 deletions.
50 changes: 25 additions & 25 deletions cypress/e2e/feedbacks.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ describe('feedback editor', () => {
cy.contains('Die Rückmeldung "End-to-end test feedback" wurde erfolgreich erstellt.')
})

it('edits and prints a feedback', function () {
cy.visit(`/course/${this.courseId}/participants`)
cy.get('img.card-img-top').first().click()
cy.get('td[data-label=Titel] a').first().click()
cy.contains('Rückmeldung Details')

cy.get('div.editor.form-control [contenteditable]').first().type("Text from end-to-end test\n")
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')
cy.get('a.btn-link').first().click()

cy.get('[title="Drucken"]').click()
cy.contains('PDF wird generiert...')
cy.contains('PDF wurde heruntergeladen')

cy.task('findFiles', 'cypress/downloads/*').then((foundPdf) => {
expect(foundPdf).to.be.a('string')
cy.log(`found PDF ${foundPdf}`)
cy.task('parsePdf', foundPdf).then((parsedPdf) => {
expect(parsedPdf.text).to.include('Text from end-to-end test')
expect(parsedPdf.text).not.to.include('Some other text which certainly is not present in the pdf')
})
})

cy.task('deleteFiles', 'cypress/downloads/*')
it('edits and prints a feedback', function () {
cy.visit(`/course/${this.courseId}/participants`)
cy.get('img.card-img-top').first().click()
cy.get('td[data-label=Titel] a').first().click()
cy.contains('Rückmeldung Details')

cy.get('div.editor.form-control [contenteditable]').first().type("Text from end-to-end test\n")
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')
cy.get('a.btn-link').first().click()

cy.get('[title="Drucken"]').click()
cy.contains('PDF wird generiert...')
cy.contains('PDF wurde heruntergeladen')

cy.task('findFiles', 'cypress/downloads/*').then((foundPdf) => {
expect(foundPdf).to.be.a('string')
cy.log(`found PDF ${foundPdf}`)
cy.task('parsePdf', foundPdf).then((parsedPdf) => {
expect(parsedPdf.text).to.include('Text from end-to-end test')
expect(parsedPdf.text).not.to.include('Some other text which certainly is not present in the pdf')
})
})

cy.task('deleteFiles', 'cypress/downloads/*')
})
})
187 changes: 96 additions & 91 deletions cypress/e2e/requirements-matrix.cy.js
Original file line number Diff line number Diff line change
@@ -1,109 +1,114 @@
import {useDatabaseResets} from "../support/databaseTransactions"

describe('requirements matrix', () => {
useDatabaseResets()
useDatabaseResets()

beforeEach(() => {
cy.then(() => {
cy.login().then(user => {
cy.artisan('e2e:scenario', {'--user-id': user.id})
})
})
beforeEach(() => {
cy.then(() => {
cy.login().then(user => {
cy.artisan('e2e:scenario', {'--user-id': user.id})
})
})
})

it('can be displayed and edited', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, {
course_id: courseId,
name: 'E2E status',
color: 'green',
icon: 'book'
})

cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains(feedback.name).click()

cy.contains('Anforderungs-Matrix')

cy.contains(`Anforderungs-Matrix ${feedback.name}`)
cy.get('[data-label]').eq(1).as('cell')

cy.get('@cell').click()
cy.get('#requirement-status').click()
cy.get('#requirement-status .multiselect__option').eq(3).click()
cy.get('#comment').type('{selectall}Test E2E Notes which should be truncated because they are way too long to fit into the matrix cell')
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')

cy.get('[aria-label="Close"]').click()
cy.contains('Automatisch gespeichert').should('not.exist')
cy.contains('Test E2E Notes which should be truncated because…')
cy.get('@cell').should('have.class', 'bg-green')
})

it('can be displayed and edited', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, {
course_id: courseId,
name: 'E2E status',
color: 'green',
icon: 'book'
})

cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains(feedback.name).click()

cy.contains('Anforderungs-Matrix')

cy.contains(`Anforderungs-Matrix ${feedback.name}`)
cy.get('[data-label]').eq(1).as('cell')

cy.get('@cell').click()
cy.get('#requirement-status').click()
cy.get('#requirement-status .multiselect__option').eq(3).click()
cy.get('#comment').type('{selectall}Test E2E Notes which should be truncated because they are way too long to fit into the matrix cell')
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')

cy.get('[aria-label="Close"]').click()
cy.contains('Automatisch gespeichert').should('not.exist')
cy.contains('Test E2E Notes which should be truncated because…')
cy.get('@cell').should('have.class', 'bg-green')
})

})
})
})

it('can be displayed and edited if there are multiple feedbacks in course', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, {
course_id: courseId,
name: 'E2E status',
color: 'green',
icon: 'book'
})
cy.create('App\\Models\\FeedbackData', 1, {course_id: courseId, name: 'E2E Feedback'})

cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->offset(1)->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains('Rückmeldungen').click()
cy.contains('E2E Feedback')
cy.contains(feedback.name).click()

cy.contains('Anforderungs-Matrix')

cy.contains(`Anforderungs-Matrix ${feedback.name}`)
cy.get('[data-label]').eq(1).as('cell')

cy.get('@cell').click()
cy.get('#requirement-status').click()
cy.get('#requirement-status .multiselect__option').eq(3).click()
cy.get('#comment').type('{selectall}Test E2E Notes which should be truncated because they are way too long to fit into the matrix cell')
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')

cy.get('[aria-label="Close"]').click()
cy.contains('Automatisch gespeichert').should('not.exist')
cy.contains('Test E2E Notes which should be truncated because…')
cy.get('@cell').should('have.class', 'bg-green')
})

it('can be displayed and edited if there are multiple feedbacks in course', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, {
course_id: courseId,
name: 'E2E status',
color: 'green',
icon: 'book'
})
cy.create('App\\Models\\FeedbackData', 1, {course_id: courseId, name: 'E2E Feedback'})

cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->offset(1)->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains('Rückmeldungen').click()
cy.contains('E2E Feedback')
cy.contains(feedback.name).click()

cy.contains('Anforderungs-Matrix')

cy.contains(`Anforderungs-Matrix ${feedback.name}`)
cy.get('[data-label]').eq(1).as('cell')

cy.get('@cell').click()
cy.get('#requirement-status').click()
cy.get('#requirement-status .multiselect__option').eq(3).click()
cy.get('#comment').type('{selectall}Test E2E Notes which should be truncated because they are way too long to fit into the matrix cell')
cy.contains('Speichern...')
cy.contains('Automatisch gespeichert')

cy.get('[aria-label="Close"]').click()
cy.contains('Automatisch gespeichert').should('not.exist')
cy.contains('Test E2E Notes which should be truncated because…')
cy.get('@cell').should('have.class', 'bg-green')
})

})
})
})

it('edits and prints all feedbacks', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, { course_id: courseId, name: 'E2E status', color: 'green', icon: 'book' })
it('edits and prints all feedbacks', function () {
cy.courseId().then((courseId) => {
cy.create('App\\Models\\RequirementStatus', 1, {
course_id: courseId,
name: 'E2E status',
color: 'green',
icon: 'book'
})

cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains(feedback.name).click()
cy.php(`App\\Models\\FeedbackData::orderBy('id', 'desc')->first();`).then(feedback => {
cy.visit(`/course/${courseId}`)
cy.contains(feedback.name).click()

cy.contains('Anforderungs-Matrix')
cy.contains('Anforderungs-Matrix')

cy.contains(`Anforderungs-Matrix ${feedback.name}`)
cy.contains(`Anforderungs-Matrix ${feedback.name}`)

cy.get('[title="Drucken"]').first().click()
cy.contains('PDF wird generiert...')
cy.contains('PDF wurde heruntergeladen', { timeout: 20000})
cy.get('[title="Drucken"]').first().click()
cy.contains('PDF wird generiert...')
cy.contains('PDF wurde heruntergeladen', {timeout: 20000})

cy.task('findFiles', 'cypress/downloads/*').then((foundZip) => {
expect(foundZip).to.be.a('string')
cy.log(`found PDF ${foundZip}`)
cy.readFile(foundZip)
})
})
cy.task('findFiles', 'cypress/downloads/*').then((foundZip) => {
expect(foundZip).to.be.a('string')
cy.log(`found PDF ${foundZip}`)
cy.readFile(foundZip)
})
})
})
})
})

0 comments on commit b7d2332

Please sign in to comment.