-
Notifications
You must be signed in to change notification settings - Fork 37
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
Showing
183 changed files
with
5,631 additions
and
4,329 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
name: 🧪E2E test cases | ||
about: Add E2E test cases | ||
title: '[E2E test]' | ||
labels: test, e2e-test | ||
assignees: '' | ||
--- | ||
|
||
# 🧪E2E test cases | ||
|
||
<!--- Provide a scope for the test cases --> | ||
|
||
# Test case 1 | ||
|
||
## 😎 Role | ||
|
||
<!-- Add the role of the user on whose behalf the following tests should be running --> | ||
<!-- [e.g.: admin (default), superadmin, developer, editor ] --> | ||
|
||
## 🧫 Purpose of the test | ||
|
||
<!--- Summarize the test case --> | ||
|
||
## 🐾 Steps | ||
|
||
<!--- Add steps of the test case --> | ||
<!-- [e.g.: | ||
1. Login with devdog | ||
2. Open the usermenu | ||
3. ... | ||
] --> | ||
|
||
# Test case 2 | ||
|
||
## 😎 Role | ||
|
||
<!-- Add the role of the user on whose behalf the following tests should be running --> | ||
<!-- [e.g.: admin (default), superadmin, developer, editor ] --> | ||
|
||
## 🧫 Purpose of the test | ||
|
||
<!--- Summarize the test case --> | ||
|
||
## 🐾 Steps | ||
|
||
<!--- Add steps of the test case --> | ||
<!-- [e.g.: | ||
1. Login with devdog | ||
2. Open the usermenu | ||
3. ... | ||
] --> | ||
|
||
... |
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,13 @@ | ||
name: AdminUI end-to-end tests | ||
on: [workflow_dispatch] | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cypress run | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
command: yarn snapp cypress:all --env secret_superadmin=${{ secrets.AUTH_SECRET_SUPERADMIN }},secret_admin=${{ secrets.AUTH_SECRET_ADMIN }},secret_developer=${{ secrets.AUTH_SECRET_DEVELOPER }},secret_editor=${{ secrets.AUTH_SECRET_EDITOR }} |
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 |
---|---|---|
|
@@ -59,6 +59,3 @@ jspm_packages/ | |
|
||
# Misc | ||
.DS_Store | ||
|
||
# Cypress realted videos | ||
cypress/videos |
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 |
---|---|---|
|
@@ -61,3 +61,7 @@ dist | |
temp | ||
build | ||
stats.json | ||
|
||
# Cypress related videos and screenshots | ||
cypress/videos | ||
cypress/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,31 @@ | ||
{ | ||
"baseUrl": "https://admin.test.sensenet.com", | ||
"chromeWebSecurity": false, | ||
"defaultCommandTimeout": 10000, | ||
"env": { | ||
"repoUrl": "https://e2e-service.test.sensenet.com", | ||
"identityServer": "https://is.test.sensenet.com", | ||
"users": { | ||
"superadmin": { | ||
"clientId": "client", | ||
"clientSecret": "", | ||
"id": "/Root/IMS/BuiltIn/Portal('Admin')" | ||
}, | ||
"admin": { | ||
"clientId": "kitty", | ||
"clientSecret": "", | ||
"id": "/Root/IMS/Public('businesscat')" | ||
}, | ||
"developer": { | ||
"clientId": "devdog", | ||
"clientSecret": "", | ||
"id": "/Root/IMS/Public('devdog')" | ||
}, | ||
"editor": { | ||
"clientId": "eddie", | ||
"clientSecret": "", | ||
"id": "/Root/IMS/Public('editormanatee')" | ||
} | ||
} | ||
} | ||
} |
Empty file.
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,70 @@ | ||
import { PATHS } from '../../../src/application-paths' | ||
import { pathWithQueryParams } from '../../../src/services/query-string-builder' | ||
|
||
describe('Search', () => { | ||
it('should search available', () => { | ||
cy.login() | ||
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } })) | ||
.get('[data-test="search-button"]') | ||
.click() | ||
.get('[data-test="command-box"] input') | ||
.should('be.visible') | ||
}) | ||
|
||
context('suggestion list', () => { | ||
const term = 'busi' | ||
beforeEach(() => { | ||
cy.login() | ||
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } })) | ||
.get('[data-test="search-button"]') | ||
.click() | ||
.get('[data-test="command-box"] input') | ||
.type(term, { delay: 200 }) | ||
.get('[data-test="search-suggestion-list"] ul') | ||
.children() | ||
.as('search') | ||
}) | ||
|
||
it('should have 6 suggestion items', () => { | ||
cy.get('@search').should('have.length', 6) | ||
}) | ||
|
||
it('first item should be a link to the result page', () => { | ||
cy.get('@search') | ||
.first() | ||
.click() | ||
.location() | ||
.should((loc) => { | ||
expect(loc.pathname).to.eq(PATHS.search.appPath) | ||
expect(loc.search).to.eq(`?term=${term}`) | ||
}) | ||
}) | ||
|
||
it('first item should contain the search term', () => { | ||
cy.get('@search').first().contains(term) | ||
}) | ||
|
||
it('second item is the Business Cat user', () => { | ||
cy.get('@search').eq(1).contains('Business Cat') | ||
}) | ||
|
||
it('second item should navigate to edit', () => { | ||
cy.get('@search') | ||
.eq(1) | ||
.click() | ||
.location() | ||
.should((loc) => { | ||
expect(loc.pathname).to.contain('edit') | ||
}) | ||
}) | ||
|
||
it('second item should edit Business Cat', () => { | ||
cy.get('@search') | ||
.eq(1) | ||
.click() | ||
.get('#FullName') | ||
.invoke('val') | ||
.then((fullname) => expect(fullname).to.eq('Business Cat')) | ||
}) | ||
}) | ||
}) |
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,24 @@ | ||
import { pathWithQueryParams } from '../../../src/services/query-string-builder' | ||
|
||
describe('User handling', () => { | ||
before(() => cy.clearCookies({ domain: null } as any)) | ||
|
||
it('should login with test user', () => { | ||
cy.visit('/') | ||
cy.get('input[name="repository"]').type(`${Cypress.env('repoUrl')}{enter}`) | ||
|
||
cy.get('[data-test="demo-button"]').click() | ||
}) | ||
|
||
it('should logout', () => { | ||
cy.login() | ||
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } })) | ||
.get('.MuiToolbar-root .MuiAvatar-root+.MuiButtonBase-root.MuiIconButton-root') | ||
.click() | ||
.get('.MuiList-root li[role="menuitem"]') | ||
.contains('Log out') | ||
.click() | ||
|
||
cy.get('.MuiDialog-container .MuiDialogActions-root .MuiButton-containedPrimary').click() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) | ||
|
||
Cypress.Commands.add('login', (userType = 'admin') => { | ||
const user = Cypress.env('users')[userType] | ||
|
||
const configuration = { | ||
client_id: user.clientId, | ||
client_secret: Cypress.env(`secret_${userType}`) || user.clientSecret, | ||
grant_type: 'client_credentials', | ||
scope: encodeURIComponent('sensenet'), | ||
} | ||
|
||
const requestBody = Object.keys(configuration).reduce((acc, current, idx) => { | ||
return `${acc}${current}=${configuration[current]}${idx === Object.keys(configuration).length - 1 ? '' : '&'}` | ||
}, '') | ||
|
||
cy.request({ | ||
url: `${Cypress.env('identityServer')}/connect/token`, | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
body: requestBody, | ||
}).then((resp) => { | ||
const oidcUser = resp.body | ||
|
||
oidcUser.profile = { | ||
sub: user.id, | ||
} | ||
|
||
window.sessionStorage.setItem(`oidc.user:${Cypress.env('identityServer')}:spa`, JSON.stringify(oidcUser)) | ||
}) | ||
}) |
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 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference types="cypress-xpath/src" /> | ||
|
||
declare namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* Custom command to log in programmatically. | ||
*/ | ||
login(): void | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"baseUrl": "../node_modules", | ||
"target": "es5", | ||
"lib": ["es5", "dom"], | ||
"types": ["cypress"] | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
Oops, something went wrong.