Skip to content
This repository was archived by the owner on Sep 29, 2020. It is now read-only.

Commit ff110b1

Browse files
author
Michael Johansen
committed
La til basic cypress oppsett til FPSAK
1 parent 5a27ef4 commit ff110b1

File tree

20 files changed

+931
-27
lines changed

20 files changed

+931
-27
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./eslint/eslintrc.dev');

.gitignore

+67-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,73 @@ packages/*/node_modules/
1111
*.log*
1212
/target/
1313
/node_modules
14-
.idea/
1514
npm-debug.log
1615
lib/
1716
lerna-debug.log
17+
18+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
19+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
20+
21+
# User-specific stuff
22+
.idea/**/workspace.xml
23+
.idea/**/tasks.xml
24+
.idea/**/usage.statistics.xml
25+
.idea/**/dictionaries
26+
.idea/**/shelf
27+
28+
# Generated files
29+
.idea/**/contentModel.xml
30+
31+
# Sensitive or high-churn files
32+
.idea/**/dataSources/
33+
.idea/**/dataSources.ids
34+
.idea/**/dataSources.local.xml
35+
.idea/**/sqlDataSources.xml
36+
.idea/**/dynamic.xml
37+
.idea/**/uiDesigner.xml
38+
.idea/**/dbnavigator.xml
39+
40+
# Gradle
41+
.idea/**/gradle.xml
42+
.idea/**/libraries
43+
44+
# Gradle and Maven with auto-import
45+
# When using Gradle or Maven with auto-import, you should exclude module files,
46+
# since they will be recreated, and may cause churn. Uncomment if using
47+
# auto-import.
48+
# .idea/modules.xml
49+
# .idea/*.iml
50+
# .idea/modules
51+
52+
# CMake
53+
cmake-build-*/
54+
55+
# Mongo Explorer plugin
56+
.idea/**/mongoSettings.xml
57+
58+
# File-based project format
59+
*.iws
60+
61+
# IntelliJ
62+
out/
63+
64+
# mpeltonen/sbt-idea plugin
65+
.idea_modules/
66+
67+
# JIRA plugin
68+
atlassian-ide-plugin.xml
69+
70+
# Cursive Clojure plugin
71+
.idea/replstate.xml
72+
73+
# Crashlytics plugin (for Android Studio and IntelliJ)
74+
com_crashlytics_export_strings.xml
75+
crashlytics.properties
76+
crashlytics-build.properties
77+
fabric.properties
78+
79+
# Editor-based Rest Client
80+
.idea/httpRequests
81+
82+
# Android studio 3.1+ serialized cache file
83+
.idea/caches/build_file_checksums.ser

.idea/codeStyles/Project.xml

+60
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint/eslintrc.dev.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const merge = require('webpack-merge');
2-
const common = require('./eslintrc.common.js');
32
const path = require('path');
4-
var OFF = 0;
3+
const common = require('./eslintrc.common.js');
4+
5+
const OFF = 0;
56

67
const config = {
78
settings: {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"chai": "^4.1.2",
7171
"cross-env": "^5.2.0",
7272
"css-loader": "^1.0.0",
73+
"cypress": "^3.1.0",
7374
"enzyme": "^3.4.1",
7475
"enzyme-adapter-react-16": "^1.2.0",
7576
"eslint": "^5.3.0",

packages/fpsak/cypress.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"_baseUrl": "https://app-t10.adeo.no/fpsak/",
3+
"baseUrl": "http://localhost:9000"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
let environment;
2+
if (Cypress.env('baseUrl') === 'http://localhost:9000') {
3+
environment = 'Lokal utvikling-Utbyggeren';
4+
} else {
5+
environment = 't10';
6+
}
7+
const testHubBase = 'http://e34apvl00250.devillo.no:8051';
8+
const cookieUrl = testHubBase + '/envconfig/getconfig/' + environment;
9+
const sokPersonUrl = testHubBase + '/person/sokperson';
10+
const foreldrepengesoknadUrl = testHubBase + '/foreldrepengesoknad/sendviafordeling/' + environment;
11+
const enkelKvinneSok = require('../test-data/person-sok/enkel-kvinne');
12+
const enkelForeldrepengeSoknad = require('../test-data/foreldrepengesoknad-sendviafordeling/enkel-soknad');
13+
14+
const pollFagsakReady = function (fnr) {
15+
cy.request({
16+
url: 'http://localhost:8080/fpsak/api/fagsak/sok',
17+
method: 'POST',
18+
body: {
19+
searchString: fnr,
20+
},
21+
})
22+
.then(function (resp) {
23+
if (resp.body.length > 0) {
24+
console.log(resp);
25+
} else {
26+
console.log('Not ready, polling...');
27+
cy.wait(1000);
28+
pollFagsakReady(fnr);
29+
}
30+
});
31+
};
32+
33+
describe('My First Cypress Test', function () {
34+
before(function () {
35+
// logger inn
36+
Cypress.Cookies.debug(false);
37+
cy.request(cookieUrl)
38+
.then(function (resp) {
39+
cy.setCookie('ID_token', resp.body.token);
40+
cy.setCookie('refresh_token', resp.body.refreshToken);
41+
});
42+
// henter ut en person
43+
cy.request({
44+
url: sokPersonUrl,
45+
method: 'POST',
46+
body: enkelKvinneSok,
47+
})
48+
.then(function (sokPersonResp) {
49+
enkelForeldrepengeSoknad.fnr = sokPersonResp.body.fnr;
50+
cy.request({
51+
url: foreldrepengesoknadUrl,
52+
method: 'POST',
53+
body: enkelForeldrepengeSoknad,
54+
})
55+
.then(function (result) {
56+
console.log(result);
57+
//pollFagsakReady(enkelForeldrepengeSoknad.fnr)
58+
});
59+
});
60+
});
61+
62+
beforeEach(function () {
63+
Cypress.Cookies.preserveOnce('ID_token', 'refresh_token');
64+
});
65+
66+
it('Besøker FPSAK og gjør et søk etter en sak', function () {
67+
cy.visit('/');
68+
cy.get('input#searchString')
69+
.type(enkelForeldrepengeSoknad.fnr + '{enter}');
70+
});
71+
});
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example plugins/index.js can be used to load plugins
3+
//
4+
// You can change the location of this file or turn off loading
5+
// the plugins file with the 'pluginsFile' configuration option.
6+
//
7+
// You can read more here:
8+
// https://on.cypress.io/plugins-guide
9+
// ***********************************************************
10+
11+
// This function is called when a project is opened or re-opened (e.g. due to
12+
// the project's config changing)
13+
14+
module.exports = (on, config) => {
15+
// `on` is used to hook into various events Cypress emits
16+
// `config` is the resolved Cypress config
17+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add("login", (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This is will overwrite an existing command --
25+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)