1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-22 21:20:52 +02: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({ module.exports = defineConfig({
reporter: 'cypress-multi-reporters', reporter: 'cypress-multi-reporters',
@ -12,8 +12,8 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here. // We've imported your old cypress plugins here.
// You may want to clean this up later by importing these. // You may want to clean this up later by importing these.
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config) return require('./cypress/plugins/index.js')(on, config);
}, },
baseUrl: 'http://localhost:4200/', baseUrl: 'http://localhost:4200/',
}, },
}) });

View file

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

View file

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

View file

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

View file

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

19
e2e/package-lock.json generated
View file

@ -14,7 +14,9 @@
"cypress-multi-reporters": "1.6.4", "cypress-multi-reporters": "1.6.4",
"mocha-junit-reporter": "2.2.1" "mocha-junit-reporter": "2.2.1"
}, },
"devDependencies": {} "devDependencies": {
"prettier": "^3.2.5"
}
}, },
"node_modules/@colors/colors": { "node_modules/@colors/colors": {
"version": "1.5.0", "version": "1.5.0",
@ -2323,6 +2325,21 @@
"node": ">=0.10.0" "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": { "node_modules/pretty-bytes": {
"version": "5.6.0", "version": "5.6.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", "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", "cypress-multi-reporters": "1.6.4",
"mocha-junit-reporter": "2.2.1" "mocha-junit-reporter": "2.2.1"
}, },
"devDependencies": {}, "devDependencies": {
"prettier": "^3.2.5"
},
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "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", "author": "Heimo Stranner",
"license": "ISC" "license": "ISC"

View file

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