-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #941 from rwakulszowa/setup-cypress
Setup cypress
- Loading branch information
Showing
19 changed files
with
206 additions
and
20 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
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,3 +1,3 @@ | ||
{ | ||
"baseUrl": "http://web:8000" | ||
"baseUrl": "http://web:8000" | ||
} |
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,3 +1,2 @@ | ||
support/ | ||
videos/ | ||
screenshots/ |
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 @@ | ||
text_file1.txt content |
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 @@ | ||
text_file2.txt content |
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,4 @@ | ||
const fetch = require("node-fetch"); | ||
|
||
const get = (url) => fetch(url).then((res) => res.text()); | ||
module.exports = { get }; |
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 @@ | ||
require("cypress-file-upload"); |
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 @@ | ||
require("./commands"); |
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,6 @@ | ||
const fromId = (id) => ({ | ||
title: `${id}-title`, | ||
content: `${id}-content`, | ||
}); | ||
|
||
module.exports = { fromId }; |
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,31 @@ | ||
// Function filling forms with provided inputs. | ||
// Submits the form in the final step. | ||
// | ||
// Each function expects to be executed from within a `within` call selecting | ||
// the correct form. | ||
|
||
const submitCaseForm = (cy) => (form, { title, content, attachment }) => { | ||
cy.get('input[name="name"]').clear().type(title); | ||
cy.get('textarea[name="text"]').clear().type(content); | ||
if (attachment) { | ||
cy.get('input[type="file"]') | ||
.filter(":visible") | ||
.first() | ||
.attachFile(attachment); | ||
} | ||
cy.contains("input", "Zgłoś").click(); | ||
}; | ||
|
||
const submitLetterForm = (cy) => (form, { title, content, attachment }) => { | ||
cy.get('input[name="name"]').clear().type(title); | ||
cy.get('textarea[name="text"]').clear().type(content); | ||
if (attachment) { | ||
cy.get('input[type="file"]') | ||
.filter(":visible") | ||
.first() | ||
.attachFile(attachment); | ||
} | ||
cy.contains("input", "Odpowiedz wszystkim").click(); | ||
}; | ||
|
||
module.exports = { submitCaseForm, submitLetterForm }; |
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,6 @@ | ||
const fromId = (id) => ({ | ||
title: `${id}-title`, | ||
content: `${id}-content`, | ||
}); | ||
|
||
module.exports = { fromId }; |
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,11 @@ | ||
const addSuperUserPrivileges = (cy) => (user) => { | ||
const { username } = user; | ||
cy.task( | ||
"db:query", | ||
`update users_user | ||
set is_staff=1, is_superuser=1 | ||
where username="${username}"` | ||
); | ||
}; | ||
|
||
module.exports = { addSuperUserPrivileges }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 +1,16 @@ | ||
{ | ||
"description": "Integration tests for watchdogpolska/poradnia", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/watchdogpolska/poradnia.git", | ||
"directory": "tests" | ||
}, | ||
"license": "MIT", | ||
"name": "tests", | ||
"devDependencies": { | ||
"cypress": "^5.5.0", | ||
"cypress-file-upload": "^4.1.1", | ||
"mysql": "^2.18.1", | ||
"cypress": "^5.5.0" | ||
"node-fetch": "^2.6.1" | ||
} | ||
} |