Skip to content

Commit

Permalink
fix(vite): linter issues
Browse files Browse the repository at this point in the history
KK-1017
  • Loading branch information
nikomakela committed Sep 28, 2023
1 parent af52e95 commit 34d25fe
Show file tree
Hide file tree
Showing 61 changed files with 2,363 additions and 340 deletions.
11 changes: 2 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
{
"extends": [
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:testcafe/recommended"
],
"rules": {
"@typescript-eslint/brace-style": [
"error",
"1tbs",
{ "allowSingleLine": true }
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/func-call-spacing": ["error"],
"@typescript-eslint/member-ordering": ["warn"],
"@typescript-eslint/no-require-imports": ["error"],
"@typescript-eslint/no-redeclare": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react/no-unused-prop-types": ["warn", { "skipShapeProps": true }],
"array-bracket-spacing": ["warn", "never"],
"import/order": [
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"trailingComma": "es5",
"semi": true,
"singleQuote": true
}
}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.14.1"
}
}
2 changes: 1 addition & 1 deletion .testcaferc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"module": "@testing-library/dom/dist/@testing-library/dom.umd.js"
}
]
}
}
57 changes: 26 additions & 31 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": [
"test",
"--runInBand",
"--no-cache",
"--watchAll=false"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": { "CI": "true" },
"disableOptimisticBPs": true
},
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache", "--watchAll=false"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": { "CI": "true" },
"disableOptimisticBPs": true
},
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
]
}
}
]
}
6 changes: 3 additions & 3 deletions azure-pipelines-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ trigger:
- master
paths:
exclude:
- '*release-please*'
- '**/*.md'
- '.github/'
- '*release-please*'
- '**/*.md'
- '.github/'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand Down
6 changes: 3 additions & 3 deletions browser-tests/api/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const loginPage = {
};

export const login = async (t: TestController) => {
const username = testUsername(), password = testUserPassword();
const username = testUsername(),
password = testUserPassword();

await t
.click(loginPage.loginButton)
await t.click(loginPage.loginButton);

await t
.typeText(loginPage.username, username)
Expand Down
18 changes: 9 additions & 9 deletions browser-tests/api/userTunnistamo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export const user = {
username: `${testUsername()}`,
password: `${testUserPassword()}`,
selectByUsername: Selector('tr').withText(`${testUsername()}`),
selectByEmail: Selector('.field-email').withText(`${testUsername()}`).sibling('.field-username').child('a'),
selectByEmail: Selector('.field-email')
.withText(`${testUsername()}`)
.sibling('.field-username')
.child('a'),
// user change
staffStatus: screen.getByLabelText(/Ylläpitäjä|Staff status/i),
staffStatusCheckbox: Selector('#id_is_staff'),
Expand All @@ -33,18 +36,15 @@ export const tunnistamoUserAccesses = async (t: TestController) => {

await t.navigateTo(routeUser());


await t.click(user.selectByEmail);

// these needs to be checked
if (! await user.staffStatusCheckbox.checked) {
await t.click(user.staffStatus)
if (!(await user.staffStatusCheckbox.checked)) {
await t.click(user.staffStatus);
}
if (! await user.superUserStatusCheckbox.checked) {
await t.click(user.superUserStatus)
if (!(await user.superUserStatusCheckbox.checked)) {
await t.click(user.superUserStatus);
}

await t
.click(user.chooseAllPermissions)
.click(user.saveButton);
await t.click(user.chooseAllPermissions).click(user.saveButton);
};
13 changes: 4 additions & 9 deletions browser-tests/apiAccessFeature.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { login } from './utils/login';
import { tunnistamoUserAccesses } from './api/userTunnistamo';
import {
route,
} from './pages/godchildrenProfilePage';

fixture`Api access feature`
.page(route())
.beforeEach(async (t) => {
await login(t);
});
import { route } from './pages/godchildrenProfilePage';

fixture`Api access feature`.page(route()).beforeEach(async (t) => {
await login(t);
});

test('Ensure tunnistamo user has accesses', async (t) => {
await tunnistamoUserAccesses(t);
Expand Down
4 changes: 1 addition & 3 deletions browser-tests/eventGroupsFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ test('As a user I can use event groups to find events', async (t) => {
await t.click(eventGroupPage.selectEventButtons.nth(0));

// Expect its name to be a hardcoded value
await t
.expect(eventPage.title.textContent)
.contains('Test event');
await t.expect(eventPage.title.textContent).contains('Test event');
});
3 changes: 1 addition & 2 deletions browser-tests/pages/githubLogin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { screen } from '@testing-library/testcafe';

export const githubLogin =
{
export const githubLogin = {
loginLink: screen.getByText('GitHub'),
username: screen.getByLabelText('Username or email address'),
password: screen.getByLabelText('Password'),
Expand Down
14 changes: 10 additions & 4 deletions browser-tests/pages/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export const registerForm = {
birthDayMonthInput: Selector('#child\\.birthdate\\.month'),
birthDayYearInput: Selector('#child\\.birthdate\\.year'),
cityInput: screen.getByLabelText('Lapsen kotipaikkakunta *'),
verifyInformationCheckbox: screen.getByLabelText('Vakuutan antamani tiedot oikeaksi'),
verifyInformationCheckbox: screen.getByLabelText(
'Vakuutan antamani tiedot oikeaksi'
),
submitButton: Selector('#register').find('button'),
};

Expand All @@ -23,12 +25,16 @@ export const registrationForm = {

// Lähiaikuisen tiedot
guardianPhoneNumberInput: screen.getByLabelText('Puhelinnumero *'),
languagesSpokenAtHomeCombobox: Selector('#languagesSpokenAtHome-toggle-button'),
languagesSpokenAtHomeCombobox: Selector(
'#languagesSpokenAtHome-toggle-button'
),
agreeCheckbox: screen.getByLabelText(/Olen tutustunut/),

submitButton: screen.getByRole('button', { name: 'Ilmoittaudu mukaan' }),
};

export const registrationDone = {
continueButton: screen.getByRole('button', { name: 'Oma kummilapsiprofiili' }),
}
continueButton: screen.getByRole('button', {
name: 'Oma kummilapsiprofiili',
}),
};
6 changes: 3 additions & 3 deletions browser-tests/utils/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const givePermission = async (t: TestController) => {

export const login = async (t: TestController) => {
// @ts-ignore
const developmentMode = t.testRun.opts.developmentMode
const developmentMode = t.testRun.opts.developmentMode;

// development mode, use github login
if (developmentMode) {
console.log("GitHub login")
console.log('GitHub login');
await t
.click(githubLogin.loginLink)
.typeText(githubLogin.username, testUsername())
Expand All @@ -35,7 +35,7 @@ export const login = async (t: TestController) => {
}
// sso login used by ci builds
else {
console.log("Helsinki-tunnus login");
console.log('Helsinki-tunnus login');

await t.click(ssoLogin.loginLink);

Expand Down
19 changes: 13 additions & 6 deletions browser-tests/utils/register.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { registerForm, registrationForm, registrationDone } from '../pages/register';
import {
registerForm,
registrationForm,
registrationDone,
} from '../pages/register';
import getDropdownOption from './getDropdownOption';

// Firstime sign up requires registration
Expand All @@ -14,14 +18,14 @@ export const register = async (t: TestController) => {
firstName: 'Hertta',
lastName: 'Citron',
relationship: 'Vanhempi',
}
};
const guardian = {
phoneNumber: '0000000000',
language: 'suomi',
}
};

if (await registerForm.section.exists) {
console.log("Register user")
console.log('Register user');

await t
.typeText(registerForm.birthDayDayInput, registerChild.birthDate.day)
Expand All @@ -43,7 +47,10 @@ export const register = async (t: TestController) => {
.click(registrationForm.agreeCheckbox)
.click(registrationForm.languagesSpokenAtHomeCombobox)
.click(getDropdownOption(guardian.language))
.typeText(registrationForm.guardianPhoneNumberInput, guardian.phoneNumber)
.typeText(
registrationForm.guardianPhoneNumberInput,
guardian.phoneNumber
)
.click(registrationForm.submitButton);

await t.wait(2500); // 2.5s
Expand All @@ -53,4 +60,4 @@ export const register = async (t: TestController) => {
await t.wait(2500); // 2.5s
}
}
};
};
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ services:
- '/app/node_modules'
ports:
- '3000:3000'

Loading

0 comments on commit 34d25fe

Please sign in to comment.