1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-11-14 17:47:34 +01:00

chore(#41): make prettier config global to re-use it for e2e tests

Signed-off-by: Christoph Heiss <e11907069@student.tuwien.ac.at>
This commit is contained in:
Christoph Heiss 2024-05-10 20:48:00 +02:00
parent 84ecd3ddd8
commit dee74f7556
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A
10 changed files with 45 additions and 23 deletions

2
.prettierignore Normal file
View file

@ -0,0 +1,2 @@
frontend/.angular
frontend/src/assets/

View file

@ -1,4 +1,4 @@
const { defineConfig } = require("cypress");
const { defineConfig } = require('cypress');
module.exports = defineConfig({
reporter: 'cypress-multi-reporters',
@ -12,8 +12,8 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
return require('./cypress/plugins/index.js')(on, config);
},
baseUrl: 'http://localhost:4200/',
},
})
});

View file

@ -1,9 +1,9 @@
context('add message', () => {
let msgText = 'msg' + new Date().getTime();
let msgText = 'msg' + new Date().getTime();
it('create message', () => {
cy.createUser();
cy.loginUser();
cy.contains('Add message');
});
it('create message', () => {
cy.createUser();
cy.loginUser();
cy.contains('Add message');
});
});

View file

@ -19,4 +19,4 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
};

View file

@ -10,12 +10,12 @@ Cypress.Commands.add('createUser', () => {
});
});
Cypress.Commands.add("loginUser", () => {
cy.fixture("settings").then((settings) => {
cy.visit(settings.baseUrl);
cy.get('[data-cy="open-login-dialog-button"]').click();
cy.get('input[name="username"]').type(settings.username);
cy.get('input[name="password"]').type(settings.password);
cy.get('[data-cy="login-button"]').click();
});
Cypress.Commands.add('loginUser', () => {
cy.fixture('settings').then(settings => {
cy.visit(settings.baseUrl);
cy.get('[data-cy="open-login-dialog-button"]').click();
cy.get('input[name="username"]').type(settings.username);
cy.get('input[name="password"]').type(settings.password);
cy.get('[data-cy="login-button"]').click();
});
});

View file

@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')

19
e2e/package-lock.json generated
View file

@ -14,7 +14,9 @@
"cypress-multi-reporters": "1.6.4",
"mocha-junit-reporter": "2.2.1"
},
"devDependencies": {}
"devDependencies": {
"prettier": "^3.2.5"
}
},
"node_modules/@colors/colors": {
"version": "1.5.0",
@ -2323,6 +2325,21 @@
"node": ">=0.10.0"
}
},
"node_modules/prettier": {
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
"dev": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pretty-bytes": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",

View file

@ -10,10 +10,14 @@
"cypress-multi-reporters": "1.6.4",
"mocha-junit-reporter": "2.2.1"
},
"devDependencies": {},
"devDependencies": {
"prettier": "^3.2.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cypress": "cypress run"
"cypress": "cypress run",
"prettier:check": "prettier --check '**/*.{json,html,scss,ts,js}'",
"prettier:fix": "prettier --write '**/*.{json,html,scss,ts,js}'"
},
"author": "Heimo Stranner",
"license": "ISC"

View file

@ -1 +0,0 @@
src/assets/