-
Notifications
You must be signed in to change notification settings - Fork 4
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
dbfbe1f
commit b7d2332
Showing
2 changed files
with
121 additions
and
116 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
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,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) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |