forked from Greenstand/treetracker-admin-client
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Greenstand#118 from gwynndp/refactor-redux
refactor: move redux to context
- Loading branch information
Showing
90 changed files
with
6,179 additions
and
5,840 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": ["<node_internals>/**"], | ||
"program": "${workspaceFolder}/src/components/tests/tags.test.js" | ||
}, | ||
{ | ||
"name": "Debug CRA Tests", | ||
"type": "node", | ||
"request": "launch", | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts", | ||
"args": ["test", "--runInBand", "--no-cache", "--watchAll=false"], | ||
"cwd": "${workspaceRoot}", | ||
"protocol": "inspector", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
"env": { | ||
"CI": "true" | ||
}, | ||
"disableOptimisticBPs": true | ||
} | ||
] | ||
} |
4 changes: 2 additions & 2 deletions
4
src/components/Account.spec.py.js → cypress/component/Account.spec.py.js
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/components/Login.spec.py.js → cypress/component/Login.spec.py.js
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
File renamed without changes.
File renamed without changes.
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,24 +1,16 @@ | ||
|
||
|
||
describe("Account", () => { | ||
before(() => { | ||
cy.visit("/"); | ||
cy.contains(/Login/i); | ||
cy.findInputByLabel("username") | ||
.type("amdin"); | ||
cy.findInputByLabel("password") | ||
.type("amdin"); | ||
cy.contains(/login/i) | ||
.click(); | ||
cy.contains(/Welcome/i); | ||
describe('Account', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.contains(/Log in/i); | ||
cy.findInputByLabel(/Username/i).type('username'); | ||
cy.findInputByLabel(/Password/i).type('password'); | ||
cy.contains(/log in/i).click(); | ||
// cy.contains(/admin panel/i); | ||
}); | ||
|
||
it("Account", () => { | ||
cy.contains(/account/i) | ||
.click(); | ||
cy.contains(/log out/i) | ||
.click(); | ||
it('Account', () => { | ||
cy.contains(/account/i).click(); | ||
cy.contains(/log out/i).click(); | ||
cy.contains(/login/i); | ||
}); | ||
|
||
}); |
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,24 +1,22 @@ | ||
|
||
describe("Admin", () => { | ||
describe('Admin', () => { | ||
beforeEach(() => { | ||
cy.visit("/"); | ||
cy.visit('/'); | ||
cy.contains(/Log in/i); | ||
cy.findInputByLabel("Username") | ||
.type("admin"); | ||
cy.findInputByLabel("Password") | ||
.type("admin"); | ||
cy.contains(/log in/i) | ||
.click(); | ||
cy.contains(/Greenstand admin panel/i); | ||
cy.findInputByLabel(/Username/i).type('username'); | ||
cy.findInputByLabel(/Password/i).type('password'); | ||
cy.contains(/log in/i).click(); | ||
}); | ||
|
||
it('verify menu item', () => { | ||
// cy.visit('/verify'); | ||
cy.contains(/verify/i); | ||
}); | ||
|
||
it("verify", () => { | ||
cy.contains(/verify/i) | ||
.click(); | ||
it('verify', () => { | ||
cy.contains(/verify/i).click(); | ||
}); | ||
|
||
it("planter", () => { | ||
cy.contains(/planter/i) | ||
.click(); | ||
it('planter', () => { | ||
cy.contains(/planter/i).click(); | ||
}); | ||
}); |
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,82 +1,83 @@ | ||
describe('Login', () => { | ||
before(() => { | ||
cy.visit('/') | ||
cy.contains(/Login/i) | ||
cy.findInputByLabel('userName').type('admin') | ||
cy.findInputByLabel('password').type('admin') | ||
cy.contains(/login/i).click() | ||
}) | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.contains(/Log in/i); | ||
cy.findInputByLabel(/Username/i).type('testadmin'); | ||
cy.findInputByLabel(/Password/i).type('testpwd'); | ||
cy.contains(/log in/i).click(); | ||
}); | ||
|
||
it('Login successfully', () => { | ||
cy.contains(/Welcome/i) | ||
}) | ||
cy.contains(/Welcome/i); | ||
}); | ||
|
||
describe('User Manager', () => { | ||
beforeEach(() => { | ||
cy.contains(/user manager/i).click() | ||
}) | ||
cy.contains(/user manager/i).click(); | ||
}); | ||
|
||
it.skip('Edit', () => { | ||
// cy.get("button[title=edit]") | ||
// .click(); | ||
cy.findRoleByText('listitem', 'admin').find('button[title=edit]').click() | ||
cy.contains('User Detail') | ||
cy.findInputByLabel('First Name').type('Dadior2') | ||
cy.findRoleByText('list', 'Roles').contains('Admin').should('not.visible') | ||
cy.findRoleByText('list', 'Selected').contains('Admin') | ||
cy.findRoleByText('list', 'Roles').contains('Tree Auditor').click() | ||
cy.contains('>').click() | ||
cy.contains(/save/i).click() | ||
cy.contains('User Detail').should('not.visible') | ||
cy.findRoleByText('listitem', 'Dadior2').contains('Tree Auditor').should('not.visible') | ||
}) | ||
cy.findRoleByText('listitem', 'admin').find('button[title=edit]').click(); | ||
cy.contains('User Detail'); | ||
cy.findInputByLabel('First Name').type('Dadior2'); | ||
cy.findRoleByText('list', 'Roles') | ||
.contains('Admin') | ||
.should('not.visible'); | ||
cy.findRoleByText('list', 'Selected').contains('Admin'); | ||
cy.findRoleByText('list', 'Roles').contains('Tree Auditor').click(); | ||
cy.contains('>').click(); | ||
cy.contains(/save/i).click(); | ||
cy.contains('User Detail').should('not.visible'); | ||
cy.findRoleByText('listitem', 'Dadior2') | ||
.contains('Tree Auditor') | ||
.should('not.visible'); | ||
}); | ||
|
||
it("Password", () => { | ||
cy.findRoleByText('listitem', 'Dadior').find('button[title=\'generate password\']').click() | ||
cy.findInputByLabel(/please input/i) | ||
.type("admin"); | ||
cy.contains("button","Generate") | ||
it('Password', () => { | ||
cy.findRoleByText('listitem', 'Dadior') | ||
.find("button[title='generate password']") | ||
.click(); | ||
}) | ||
cy.findInputByLabel(/please input/i).type('admin'); | ||
cy.contains('button', 'Generate').click(); | ||
}); | ||
|
||
it("Create", () => { | ||
it('Create', () => { | ||
cy.contains(/add user/i).click(); | ||
cy.contains(/user detail/i); | ||
cy.findInputByLabel('Username').type('ezra'); | ||
cy.findInputByLabel('First Name').type('Ezra'); | ||
cy.findInputByLabel('Last Name').type('David'); | ||
cy.findInputByLabel('Email').type('[email protected]'); | ||
cy.findRoleByText('list', 'Roles').contains('Admin') | ||
.click(); | ||
cy.contains('>').click() | ||
cy.contains(/save/i).click() | ||
|
||
}) | ||
}) | ||
}) | ||
cy.findRoleByText('list', 'Roles').contains('Admin').click(); | ||
cy.contains('>').click(); | ||
cy.contains(/save/i).click(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe.skip('Login with bbb', () => { | ||
before(() => { | ||
cy.visit('/') | ||
cy.contains(/Login/i) | ||
cy.findInputByLabel('userName').type('bbb') | ||
cy.findInputByLabel('password').type('123456') | ||
cy.contains(/login/i).click() | ||
}) | ||
cy.visit('/'); | ||
cy.contains(/Login/i); | ||
cy.findInputByLabel('userName').type('bbb'); | ||
cy.findInputByLabel('password').type('123456'); | ||
cy.contains(/login/i).click(); | ||
}); | ||
|
||
it('Login successfully', () => { | ||
cy.contains(/Welcome/i) | ||
}) | ||
|
||
// it.only("Test api, should be 401 or 200 cuz the role", () => { | ||
// cy.request("GET", "http://localhost:3000/api/trees/count") | ||
// .should(res => { | ||
// expect(res.status).to.eq(200); | ||
// }); | ||
// cy.request("GET", "http://localhost:3000/api/planter/count") | ||
// .should(res => { | ||
// expect(res.status).to.eq(401); | ||
// }); | ||
// }); | ||
cy.contains(/Welcome/i); | ||
}); | ||
|
||
}) | ||
// it.only("Test api, should be 401 or 200 cuz the role", () => { | ||
// cy.request("GET", "http://localhost:3000/api/trees/count") | ||
// .should(res => { | ||
// expect(res.status).to.eq(200); | ||
// }); | ||
// cy.request("GET", "http://localhost:3000/api/planter/count") | ||
// .should(res => { | ||
// expect(res.status).to.eq(401); | ||
// }); | ||
// }); | ||
}); |
Oops, something went wrong.