Commit 758a0f22 authored by Christopher Collin Løkken's avatar Christopher Collin Løkken 🛀
Browse files

Merge branch 'urlrefactor' into 'master'

resolved merge conflict on branch chris

See merge request !6
parents 7b1096cb d41bc047
Pipeline #171226 passed with stages
in 2 minutes and 33 seconds
Cypress.Commands.add('randomUser', () => {
const user = `user${Math.floor(Math.random() * 1000000)}`
cy.get('input[name="username"]').type(user),{force: true}
cy.get('input[name="username"]').type(user), { force: true }
})
Cypress.Commands.add('inputValueToField', (inputName, value)=>{
cy.get(`input[name=${inputName}]`).type(value,{force: true})
Cypress.Commands.add('inputValueToField', (inputName, value) => {
cy.get(`input[name=${inputName}]`).type(value, { force: true })
})
const inputName = [
......@@ -28,9 +28,9 @@ const inputDict = {
"street_address": ["hoyskoleringen", "123456"]
}
Cypress.Commands.add('runTest',(a,b,c,d,e,f,g,h, status)=>{
Cypress.Commands.add('runTest', (a, b, c, d, e, f, g, h, status) => {
cy.visit('/register.html')
if(!a){
if (!a) {
cy.randomUser()
} else {
cy.inputValueToField(inputName[0], " ")
......@@ -42,115 +42,90 @@ Cypress.Commands.add('runTest',(a,b,c,d,e,f,g,h, status)=>{
cy.inputValueToField(inputName[5], inputDict[inputName[5]][f])
cy.inputValueToField(inputName[6], inputDict[inputName[6]][g])
cy.inputValueToField(inputName[7], inputDict[inputName[7]][h])
cy.intercept({method: 'POST', url:'/api/users/'}).as('registerRequest')
cy.intercept({ method: 'POST', url: '/api/users/' }).as('registerRequest')
cy.get('#btn-create-account').click()
cy.wait('@registerRequest').its('response.statusCode').should('eq', status)
cy.visit('/logout.html')
})
describe('Two way domain tests', () => {
<<<<<<< HEAD
before(()=>{
cy.visit('/index.html')
})
it('all valid variables', () => {
cy.runTest(0,0,0,0,0,0,0,0,201)
})
it('valid username, invalid peer variable', () => {
cy.runTest(0,1,0,0,0,0,0,0,400)
cy.runTest(0,0,1,0,0,0,0,0,400)
cy.runTest(0,0,0,1,0,0,0,0,400)
cy.runTest(0,0,0,0,1,0,0,0,201)
cy.runTest(0,0,0,0,0,1,0,0,201)
cy.runTest(0,0,0,0,0,0,1,0,201)
cy.runTest(0,0,0,0,0,0,0,1,201)
})
it('invalid username, invalid peer variable', () => {
cy.runTest(1,1,0,0,0,0,0,0,400)
cy.runTest(1,0,1,0,0,0,0,0,400)
cy.runTest(1,0,0,1,0,0,0,0,400)
cy.runTest(1,0,0,0,1,0,0,0,400)
cy.runTest(1,0,0,0,0,1,0,0,400)
cy.runTest(1,0,0,0,0,0,1,0,400)
cy.runTest(1,0,0,0,0,0,0,1,400)
})
it('valid email, invalid peer variable', () => {
cy.runTest(1,0,0,0,0,0,0,0,400)
// cy.runTest(0,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,201) done allready
// cy.runTest(0,0,0,0,0,1,0,0,201) done allready
// cy.runTest(0,0,0,0,0,0,1,0,201) done allready
// cy.runTest(0,0,0,0,0,0,0,1,201) done allready
})
it('invalid email, invalid peer variable', () => {
//cy.runTest(1,1,0,0,0,0,0,0,400) done allready
cy.runTest(0,1,1,0,0,0,0,0,400)
cy.runTest(0,1,0,1,0,0,0,0,400)
cy.runTest(0,1,0,0,1,0,0,0,400)
cy.runTest(0,1,0,0,0,1,0,0,400)
cy.runTest(0,1,0,0,0,0,1,0,400)
cy.runTest(0,1,0,0,0,0,0,1,400)
})
it('valid password, invalid peer variable', () => {
// cy.runTest(1,0,0,0,0,0,0,0,400) done allready
// cy.runTest(0,1,0,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,400) done allready
// cy.runTest(0,0,0,0,0,1,0,0,400) done allready
// cy.runTest(0,0,0,0,0,0,1,0,400) done allready
// cy.runTest(0,0,0,0,0,0,0,1,400) done allready
})
it('invalid password, invalid peer variable', () => {
// cy.runTest(1,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,1,1,0,0,0,0,0,400) done allready
cy.runTest(0,0,1,1,0,0,0,0,400)
cy.runTest(0,0,1,0,1,0,0,0,400)
cy.runTest(0,0,1,0,0,1,0,0,400)
cy.runTest(0,0,1,0,0,0,1,0,400)
cy.runTest(0,0,1,0,0,0,0,1,400)
})
it('valid password1, invalid peer variable', () => {
// cy.runTest(1,0,0,0,0,0,0,0,400) done allready
// cy.runTest(0,1,0,0,0,0,0,0,400) done allready
// cy.runTest(0,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,400) done allready
// cy.runTest(0,0,0,0,0,1,0,0,400) done allready
// cy.runTest(0,0,0,0,0,0,1,0,400) done allready
// cy.runTest(0,0,0,0,0,0,0,1,400) done allready
})
it('invalid password1, invalid peer variable', () => {
// cy.runTest(1,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,1,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,1,1,0,0,0,0,400) done allready
cy.runTest(0,0,0,1,1,0,0,0,201)
cy.runTest(0,0,0,1,0,1,0,0,201)
cy.runTest(0,0,0,1,0,0,1,0,201)
cy.runTest(0,0,0,1,0,0,0,1,201)
})
=======
before(() => {
cy.visit('/index.html')
})
it('valid username, valid peer variable', () => {
cy.visit('/register.html')
cy.randomUser()
cy.inputValueToField(inputName[1], inputDict[inputName[1]][0])
cy.inputValueToField(inputName[2], inputDict[inputName[2]][0])
cy.inputValueToField(inputName[3], inputDict[inputName[3]][0])
cy.inputValueToField(inputName[4], inputDict[inputName[4]][0])
cy.inputValueToField(inputName[5], inputDict[inputName[5]][0])
cy.inputValueToField(inputName[6], inputDict[inputName[6]][0])
cy.inputValueToField(inputName[7], inputDict[inputName[7]][0])
cy.intercept({ method: 'POST', url: '/api/users/' }).as('registerRequest')
cy.intercept({ method: 'POST', url: '/api/token/' }).as('token')
cy.get('#btn-create-account').click()
cy.wait('@registerRequest').its('response.statusCode').should('eq', 201)
it('all valid variables', () => {
cy.runTest(0, 0, 0, 0, 0, 0, 0, 0, 201)
})
it('valid username, invalid peer variable', () => {
cy.runTest(0, 1, 0, 0, 0, 0, 0, 0, 400)
cy.runTest(0, 0, 1, 0, 0, 0, 0, 0, 400)
cy.runTest(0, 0, 0, 1, 0, 0, 0, 0, 400)
cy.runTest(0, 0, 0, 0, 1, 0, 0, 0, 201)
cy.runTest(0, 0, 0, 0, 0, 1, 0, 0, 201)
cy.runTest(0, 0, 0, 0, 0, 0, 1, 0, 201)
cy.runTest(0, 0, 0, 0, 0, 0, 0, 1, 201)
})
it('invalid username, invalid peer variable', () => {
cy.runTest(1, 1, 0, 0, 0, 0, 0, 0, 400)
cy.runTest(1, 0, 1, 0, 0, 0, 0, 0, 400)
cy.runTest(1, 0, 0, 1, 0, 0, 0, 0, 400)
cy.runTest(1, 0, 0, 0, 1, 0, 0, 0, 400)
cy.runTest(1, 0, 0, 0, 0, 1, 0, 0, 400)
cy.runTest(1, 0, 0, 0, 0, 0, 1, 0, 400)
cy.runTest(1, 0, 0, 0, 0, 0, 0, 1, 400)
})
it('valid email, invalid peer variable', () => {
cy.runTest(1, 0, 0, 0, 0, 0, 0, 0, 400)
// cy.runTest(0,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,201) done allready
// cy.runTest(0,0,0,0,0,1,0,0,201) done allready
// cy.runTest(0,0,0,0,0,0,1,0,201) done allready
// cy.runTest(0,0,0,0,0,0,0,1,201) done allready
})
it('invalid email, invalid peer variable', () => {
//cy.runTest(1,1,0,0,0,0,0,0,400) done allready
cy.runTest(0, 1, 1, 0, 0, 0, 0, 0, 400)
cy.runTest(0, 1, 0, 1, 0, 0, 0, 0, 400)
cy.runTest(0, 1, 0, 0, 1, 0, 0, 0, 400)
cy.runTest(0, 1, 0, 0, 0, 1, 0, 0, 400)
cy.runTest(0, 1, 0, 0, 0, 0, 1, 0, 400)
cy.runTest(0, 1, 0, 0, 0, 0, 0, 1, 400)
})
it('valid password, invalid peer variable', () => {
// cy.runTest(1,0,0,0,0,0,0,0,400) done allready
// cy.runTest(0,1,0,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,400) done allready
// cy.runTest(0,0,0,0,0,1,0,0,400) done allready
// cy.runTest(0,0,0,0,0,0,1,0,400) done allready
// cy.runTest(0,0,0,0,0,0,0,1,400) done allready
})
it('invalid password, invalid peer variable', () => {
// cy.runTest(1,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,1,1,0,0,0,0,0,400) done allready
cy.runTest(0, 0, 1, 1, 0, 0, 0, 0, 400)
cy.runTest(0, 0, 1, 0, 1, 0, 0, 0, 400)
cy.runTest(0, 0, 1, 0, 0, 1, 0, 0, 400)
cy.runTest(0, 0, 1, 0, 0, 0, 1, 0, 400)
cy.runTest(0, 0, 1, 0, 0, 0, 0, 1, 400)
})
it('valid password1, invalid peer variable', () => {
// cy.runTest(1,0,0,0,0,0,0,0,400) done allready
// cy.runTest(0,1,0,0,0,0,0,0,400) done allready
// cy.runTest(0,0,1,0,0,0,0,0,400) done allready
// cy.runTest(0,0,0,0,1,0,0,0,400) done allready
// cy.runTest(0,0,0,0,0,1,0,0,400) done allready
// cy.runTest(0,0,0,0,0,0,1,0,400) done allready
// cy.runTest(0,0,0,0,0,0,0,1,400) done allready
})
it('valid username, valid peer variable', () => {
cy.visit('/logout.html')
it('invalid password1, invalid peer variable', () => {
// cy.runTest(1,0,0,1,0,0,0,0,400) done allready
// cy.runTest(0,1,0,1,0,0,0,0,400) done allready
// cy.runTest(0,0,1,1,0,0,0,0,400) done allready
cy.runTest(0, 0, 0, 1, 1, 0, 0, 0, 201)
cy.runTest(0, 0, 0, 1, 0, 1, 0, 0, 201)
cy.runTest(0, 0, 0, 1, 0, 0, 1, 0, 201)
cy.runTest(0, 0, 0, 1, 0, 0, 0, 1, 201)
})
>>>>>>> d8acf47f0e78635cc266c011e5d29cb1f3776b05
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment