Compare commits
2 commits
89c295e6d2
...
7ee4bac3fa
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ee4bac3fa | |||
| 7e674af40a |
5 changed files with 36 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
|||
vendor/
|
||||
node_modules/
|
||||
data/
|
||||
data/*.json
|
||||
.direnv/
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
describe('The admin page', () => {
|
||||
beforeEach(() => {
|
||||
cy.exec('npm run db:seed')
|
||||
cy.visit('/admin')
|
||||
})
|
||||
afterEach(() => {
|
||||
cy.exec('npm run db:wipe')
|
||||
})
|
||||
|
||||
it('navigates to texts page', () => {
|
||||
cy.get('#texts').click()
|
||||
|
|
|
|||
17
data/seedDb.php
Normal file
17
data/seedDb.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$texts = [
|
||||
[
|
||||
'id' => 0,
|
||||
'name' => 'test text'
|
||||
],
|
||||
];
|
||||
|
||||
$fileDataMap = [
|
||||
'texts.json' => $texts,
|
||||
];
|
||||
|
||||
foreach ($fileDataMap as $file => $data) {
|
||||
$path = __DIR__."/$file";
|
||||
file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT));
|
||||
}
|
||||
11
data/wipeDb.php
Normal file
11
data/wipeDb.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
$files = [
|
||||
'texts.json',
|
||||
];
|
||||
|
||||
foreach ($files as $file) {
|
||||
echo __DIR__."/$file";
|
||||
$path = __DIR__."/$file";
|
||||
file_put_contents($path, json_encode([], JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"scripts": {
|
||||
"cypress:dev": "cypress open",
|
||||
"cypress:run": "cypress run"
|
||||
"cypress:run": "cypress run",
|
||||
"db:seed": "php data/seedDb.php",
|
||||
"db:wipe": "php data/wipeDb.php"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress": "^15.12.0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue