-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing topics + adding code to add new configuration test-int
- Loading branch information
Showing
10 changed files
with
177 additions
and
15 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 |
---|---|---|
|
@@ -6,3 +6,4 @@ scripts | |
|
||
backend/src/main/resources/static/images/questions/ | ||
data/ | ||
frontend/cypress.env.json |
14 changes: 7 additions & 7 deletions
14
backend/src/main/resources/application-prod.properties.example
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,18 +1,18 @@ | ||
## Datasource | ||
spring.datasource.url=jdbc:postgresql://localhost:<DATABASE PORT>/<DATABASE NAME> | ||
spring.datasource.username= <DATABASE USERNAME> | ||
spring.datasource.password= <DATABASE PASSWORD> | ||
spring.datasource.url=jdbc:postgresql://localhost:5432/tutortestdb | ||
spring.datasource.username= | ||
spring.datasource.password= | ||
|
||
## Jpa | ||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect | ||
|
||
## Resources | ||
figures.dir=<DIRECTORY_WITH_FIGURES> | ||
export.dir=<DIRECTORY_TO_EXPORT> | ||
load.dir=<DIRECTORY_FOR_LOAD> | ||
figures.dir=./folder | ||
export.dir=./folder | ||
load.dir=./folder | ||
|
||
## Fenix oauth | ||
oauth.consumer.key=<FENIX CLIENT KEY> | ||
oauth.consumer.secret=<FENIX SECRET> | ||
callback.url=<URL FENIX REDIRECTS TO> | ||
base.url=https://fenix.tecnico.ulisboa.pt | ||
base.url=https://fenix.tecnico.ulisboa.pt |
18 changes: 18 additions & 0 deletions
18
backend/src/main/resources/application-test-int.properties
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Datasource | ||
spring.datasource.url=jdbc:postgresql://${PSQL_INT_TEST_DB_HOST}:${PSQL_INT_TEST_DB_PORT}/${PSQL_INT_TEST_DB_NAME} | ||
spring.datasource.username= ${PSQL_INT_TEST_DB_USERNAME} | ||
spring.datasource.password = ${PSQL_INT_TEST_DB_PASSWORD} | ||
|
||
## Jpa | ||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect | ||
|
||
## Resources | ||
figures.dir=./folder | ||
export.dir=./folder | ||
load.dir=./folder | ||
|
||
## Fenix oauth | ||
oauth.consumer.key=<FENIX CLIENT KEY> | ||
oauth.consumer.secret=<FENIX SECRET> | ||
callback.url=http://localhost:8081/login | ||
base.url=https://fenix.tecnico.ulisboa.pt |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"psql_db_name": "<DB NAME>", | ||
"psql_db_username": "<USERNAME>", | ||
"psql_db_password": "<PASSWORD>", | ||
"psql_db_host": "<HOST>", | ||
"psql_db_port": "5432" | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
describe('Manage Topics Walk-through', () => { | ||
|
||
function createTopicWithName(topicName){ | ||
cy.get('[data-cy="topicsNewTopicBtn"]', { force: true }).click(); | ||
|
||
cy.get('[data-cy="topicsCreateOrEditDialog"]') | ||
.should('be.visible'); | ||
|
||
cy.get('[data-cy="topicsFormTopicNameInput"]') | ||
.should('be.empty') | ||
.type(topicName); | ||
|
||
cy.route('POST', '/courses/*/topics/').as('postTopic'); | ||
|
||
cy.get('button') | ||
.contains('Save') | ||
.click(); | ||
|
||
cy.wait('@postTopic') | ||
.its('status') | ||
.should('eq', 200); | ||
} | ||
|
||
beforeEach(() => { | ||
cy.cleanTestTopics(); | ||
cy.demoTeacherLogin(); | ||
cy.server(); | ||
cy.route('GET', '/courses/*/topics').as('getTopics'); | ||
cy.get('[data-cy="managementMenuButton"]').click(); | ||
cy.get('[data-cy="manageTopicsMenuButton"]').click(); | ||
|
||
cy.wait('@getTopics') | ||
.its('status') | ||
.should('eq', 200); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.logout(); | ||
}); | ||
|
||
it('Can create a new topic', function() { | ||
let topicName = `CY - Test topic ${new Date().toJSON()}` | ||
|
||
createTopicWithName(topicName); | ||
|
||
cy.get('[data-cy="topicsGrid"]') | ||
.first() | ||
.should('contain', topicName); | ||
}); | ||
|
||
it('Can edit created new topics', function() { | ||
let topicName = `CY - Test topic ${new Date().toJSON()}` | ||
|
||
createTopicWithName(topicName); | ||
|
||
cy.get('[data-cy="topicsGrid"] table > tbody > tr:first') | ||
.should('contain', topicName) | ||
.within(() => { | ||
cy.get('[data-cy="topicsGridEditButton"]').click(); | ||
}) | ||
|
||
cy.get('[data-cy="topicsCreateOrEditDialog"]') | ||
.should('be.visible'); | ||
|
||
cy.get('[data-cy="topicsFormTopicNameInput"]') | ||
.should('contain.value', topicName) | ||
.clear() | ||
.type('CY - EDITED'); | ||
|
||
cy.route('PUT', '/topics/*').as('putTopic'); | ||
|
||
cy.get('button') | ||
.contains('Save') | ||
.click(); | ||
|
||
cy.wait('@putTopic') | ||
.its('status') | ||
.should('eq', 200); | ||
|
||
cy.get('[data-cy="topicsGrid"]') | ||
.first() | ||
.should('contain', 'CY - EDITED'); | ||
}); | ||
|
||
it('Can delete created topics', function() { | ||
let topicName = `CY - Test topic ${new Date().toJSON()}` | ||
|
||
createTopicWithName(topicName); | ||
|
||
cy.route('DELETE', '/topics/*').as('deleteTopic'); | ||
|
||
cy.get('[data-cy="topicsGrid"]').contains(topicName).should('exist'); | ||
|
||
cy.get('[data-cy="topicsGrid"] table > tbody > tr:first') | ||
.should('contain', topicName) | ||
.within(() => { | ||
cy.get('[data-cy="topicsGridDeleteButton"]').click(); | ||
}) | ||
|
||
cy.wait('@deleteTopic') | ||
.its('status') | ||
.should('eq', 200); | ||
|
||
cy.get('[data-cy="topicsGrid"]').contains(topicName).should('not.exist'); | ||
}); | ||
}); | ||
|
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function dbPasswordCommand(password){ | ||
if (Cypress.platform === 'win32'){ | ||
return `set PGPASSWORD=${password}&& ` | ||
} | ||
else{ | ||
return `PGPASSWORD=${password} ` | ||
} | ||
} | ||
|
||
function dbCommand(command){ | ||
return cy.exec( | ||
dbPasswordCommand(Cypress.env('psql_db_password')) + | ||
`psql -d ${Cypress.env('psql_db_name')} ` + | ||
`-U ${Cypress.env('psql_db_username')} ` + | ||
`-h ${Cypress.env('psql_db_host')} ` + | ||
`-p ${Cypress.env('psql_db_port')} ` + | ||
`-c "${command.replace(/\r?\n/g, " ")}"` | ||
); | ||
} | ||
|
||
Cypress.Commands.add('cleanTestTopics', () => { | ||
dbCommand(` | ||
DELETE FROM topics | ||
WHERE name like 'CY%' | ||
`) | ||
}); | ||
|
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 |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
// Import commands.js using ES2015 syntax: | ||
import './login'; | ||
import './commands'; | ||
import './database'; |