Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all webui dependencies and refactor breaking changes #6327

Merged
merged 24 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7f0b153
dev: Upgrade dependencies
kschiffer May 15, 2023
f30f223
console: Refactor application views
kschiffer Jun 6, 2023
705f411
console: Refactor gateway views
kschiffer Jun 13, 2023
c5b4c2e
console: Refactor organization views
kschiffer Jun 13, 2023
6a53937
console: Refactor device views
kschiffer Jun 13, 2023
109652f
console: Refactor remaining views
kschiffer Jun 13, 2023
77934fe
console,account: Refactor libs
kschiffer Jun 13, 2023
d9f9d0c
console: Refactor console containers
kschiffer Jun 13, 2023
92da5d6
console: Refactor global components
kschiffer Jun 13, 2023
d6d796b
console: Refactor console components
kschiffer Jun 13, 2023
4192288
console: Refactor console libs
kschiffer Jun 13, 2023
f596e77
console: Refactor console store
kschiffer Jun 13, 2023
de95973
console: Refactor global containers
kschiffer Jun 13, 2023
3ba9b33
account: Refactor account app
kschiffer Jun 13, 2023
59343ec
console,account: Update locales
kschiffer Jun 14, 2023
751ca38
dev: Remove cypress code coverage
kschiffer Jun 14, 2023
14ba5e9
dev: Fix sdk eslint config
kschiffer Jun 14, 2023
c8fb770
dev: Update cypress after update
kschiffer Jun 18, 2023
a711b5b
dev: Fix cypress specs after update
kschiffer Jun 27, 2023
88da227
console,account: Apply various fixes to make cypress pass
kschiffer Jun 27, 2023
7748aab
dev: Fix jest tests
kschiffer Jun 29, 2023
80288e0
console: Refactor admin panel
kschiffer Jun 29, 2023
3706f7e
console,account: Update locales
kschiffer Jun 30, 2023
3fb25c1
account: Fix login error logic
kschiffer Jul 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ jobs:
id: get-failed-spec
continue-on-error: true
run: |
sed -i 's/\.\.\///g' .failed-specs-*.txt
echo "failed-test=$(paste -d , .failed-specs-*.txt)" >> $GITHUB_OUTPUT
echo "neg-failed-test=!$(paste -d ',!' .failed-specs-*.txt)" >> $GITHUB_OUTPUT
- name: Unzip build artifacts
Expand All @@ -173,7 +174,7 @@ jobs:
uses: cypress-io/github-action@v4
if: steps.get-failed-spec.outputs.failed-test != ''
with:
config-file: config/cypress.json
config-file: config/cypress.config.js
config: baseUrl=https://localhost:8885
record: true
parallel: true
Expand All @@ -183,15 +184,15 @@ jobs:
- name: Run frontend end-to-end tests
uses: cypress-io/github-action@v4
with:
config-file: config/cypress.json
config-file: config/cypress.config.js
config: baseUrl=https://localhost:8885
record: true
parallel: true
browser: chrome
group: main-${{ needs.determine-if-required.outputs.hash }}
spec: |
**/*
!cypress/integration/smoke/smoke.spec.js
!cypress/e2e/smoke/smoke.spec.js
${{ steps.get-failed-spec.outputs.neg-failed-test }}
- name: Upload logs
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -252,11 +253,11 @@ jobs:
- name: Run end-to-end smoke tests (Firefox)
uses: cypress-io/github-action@v4
with:
config-file: config/cypress.json
config-file: config/cypress.config.js
config: baseUrl=https://localhost:8885
browser: firefox
record: true
spec: cypress/integration/smoke/smoke.spec.js
spec: cypress/e2e/smoke/smoke.spec.js
- name: Upload logs
uses: actions/upload-artifact@v3
if: failure()
Expand Down
96 changes: 96 additions & 0 deletions config/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Copyright © 2023 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* eslint-disable import/no-commonjs */

const { defineConfig } = require('cypress')
const { cypressBrowserPermissionsPlugin } = require('cypress-browser-permissions')
const cypressLogToOutput = require('cypress-log-to-output')

const tasks = require('../cypress/plugins/tasks')

module.exports = defineConfig({
projectId: 'uqdraf',
viewportHeight: 900,
viewportWidth: 1440,
defaultCommandTimeout: 10000,
animationDistanceThreshold: 3,
video: false,
retries: {
runMode: 1,
openMode: 0,
},
env: {
browserPermissions: {
camera: 'allow',
},
},
e2e: {
setupNodeEvents: (on, config) => {
const configWithPermissions = cypressBrowserPermissionsPlugin(on, config)

tasks.stackConfigTask(on, configWithPermissions)
tasks.sqlTask(on, configWithPermissions)
tasks.fileExistsTask(on, configWithPermissions)
tasks.emailTask(on, configWithPermissions)

on('before:browser:launch', (browser = {}, launchOptions) => {
// Log console log to output when debug mode is enabled.
if (process.env.RUNNER_DEBUG) {
launchOptions.args = cypressLogToOutput.browserLaunchHandler(browser, launchOptions.args)
}
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push(
'--use-file-for-fake-video-capture=cypress/fixtures/qr-code-mock-feed.y4m',
)
}

if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--disable-gpu')
}

return launchOptions
})

return configWithPermissions
},
experimentalRunAllSpecs: true,
excludeSpecPattern: '!*.spec.js',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
asBaseUrl: 'http://localhost:1885/api/v3',
asEnabled: true,
nsBaseUrl: 'http://localhost:1885/api/v3',
nsEnabled: true,
jsBaseUrl: 'http://localhost:1885/api/v3',
jsEnabled: true,
isBaseUrl: 'http://localhost:1885/api/v3',
isEnabled: true,
gsBaseUrl: 'http://localhost:1885/api/v3',
gsEnabled: true,
edtcBaseUrl: 'http://localhost:1885/api/v3',
edtcEnabled: true,
qrgBaseUrl: 'http://localhost:1885/api/v3',
qrgEnabled: true,
consoleSiteName: 'The Things Stack for LoRaWAN',
consoleSubTitle: 'Management platform for The Things Stack for LoRaWAN',
consoleTitle: 'Console',
consoleAssetsRootPath: '/assets',
consoleRootPath: '/console',
accountAppSiteName: 'The Things Stack for LoRaWAN',
accountAppSubTitle: '',
accountAppTitle: 'Account',
accountAppRootPath: '/oauth',
accountAppAssetsRootPath: '/assets',
})
18 changes: 0 additions & 18 deletions config/cypress.json

This file was deleted.

116 changes: 58 additions & 58 deletions config/eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends:

Check warning on line 1 in config/eslintrc.yaml

View workflow job for this annotation

GitHub Actions / Check Mergeability

config/eslintrc.yaml has a conflict when merging TheThingsIndustries/lorawan-stack:v3.27.
- ttn
- plugin:jest/recommended
- plugin:jsdoc/recommended
Expand All @@ -6,7 +6,7 @@
- plugin:cypress/recommended
- prettier

parser: babel-eslint
parser: '@babel/eslint-parser'

plugins:
- jsdoc
Expand Down Expand Up @@ -45,65 +45,65 @@
import/order:
- warn
- groups:
- builtin
- external
- internal
- parent
- sibling
- index
- builtin
- external
- internal
- parent
- sibling
- index
newlines-between: always
pathGroups:
- pattern: "\\@{ttn-lw,console,account}/constants"
group: internal
position: after
- pattern: "\\@{console,account}/api"
group: internal
position: after
- pattern: "\\@ttn-lw/components/**"
group: internal
position: after
- pattern: "\\@ttn-lw/containers/**"
group: internal
position: after
- pattern: "\\@ttn-lw/lib/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/containers/**"
group: internal
position: after
- pattern: "\\@{console,account}/lib/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/views/**"
group: internal
position: after
- pattern: "\\@ttn-lw/lib/**"
group: internal
position: after
- pattern: "\\@{console,account}/lib/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/actions/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/reducers/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/selectors/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/middleware/**"
group: internal
position: after
- pattern: "(\\@assets/**|\\@ttn-lw/styles/**)"
group: sibling
position: after
- pattern: "./*.styl"
group: sibling
position: after
- pattern: "\\@{ttn-lw,console,account}/constants"
group: internal
position: after
- pattern: "\\@{console,account}/api"
group: internal
position: after
- pattern: "\\@ttn-lw/components/**"
group: internal
position: after
- pattern: "\\@ttn-lw/containers/**"
group: internal
position: after
- pattern: "\\@ttn-lw/lib/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/containers/**"
group: internal
position: after
- pattern: "\\@{console,account}/lib/components/**"
group: internal
position: after
- pattern: "\\@{console,account}/views/**"
group: internal
position: after
- pattern: "\\@ttn-lw/lib/**"
group: internal
position: after
- pattern: "\\@{console,account}/lib/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/actions/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/reducers/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/selectors/**"
group: internal
position: after
- pattern: "\\@{console,account}/store/middleware/**"
group: internal
position: after
- pattern: "(\\@assets/**|\\@ttn-lw/styles/**)"
group: sibling
position: after
- pattern: './*.styl'
group: sibling
position: after

# Prevent superfluous path traversions in import statements.
import/no-useless-path-segments:
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default {
manifest: path.resolve(context, CACHE_DIR, 'dll.json'),
}),
new AddAssetHtmlPlugin({
filepath: path.resolve(context, PUBLIC_DIR, 'libs*bundle.js'),
glob: path.resolve(context, PUBLIC_DIR, 'libs*bundle.js'),
}),
],
production: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ describe('Account App authorization management', () => {
cy.findByRole('button', { name: /Invalidate all access tokens/ }).click()
cy.findByTestId('error-notification').should('not.exist')

cy.location('pathname').should(
'eq',
`${Cypress.config('accountAppRootPath')}/client-authorizations/console`,
)

cy.visit(`${Cypress.config('accountAppRootPath')}/client-authorizations/console/access-tokens`)
cy.findByRole('rowgroup').should('not.exist')
})
Expand All @@ -93,10 +88,6 @@ describe('Account App authorization management', () => {
cy.visit(`${Cypress.config('accountAppRootPath')}/client-authorizations/console/access-tokens`)
cy.findByRole('button', { name: /Invalidate this access token/ }).click()
cy.findByTestId('error-notification').should('not.exist')

cy.location('pathname').should(
'eq',
`${Cypress.config('accountAppRootPath')}/client-authorizations/console`,
)
cy.findByRole('rowgroup').should('not.exist')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ describe('Account App code view', () => {

it('redirects back if no code is supplied', () => {
cy.visit(`${Cypress.config('accountAppRootPath')}/code`)
cy.location('pathname').should('eq', `${Cypress.config('accountAppRootPath')}/`)
cy.location('pathname').should('eq', Cypress.config('accountAppRootPath'))
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ describe('Account App profile settings', () => {

cy.findByLabelText('Use Gravatar').check()
cy.findByLabelText('Name').type(userUpdate.name)
cy.findByLabelText('Email address').clear().type(userUpdate.primary_email_address)
cy.findByLabelText('Email address').clear()
cy.findByLabelText('Email address').type(userUpdate.primary_email_address)

// Check if the profile picture (preview) was updated properly.
cy.get('form').within(() => {
Expand Down Expand Up @@ -162,7 +163,6 @@ describe('Account App profile settings', () => {
describe('Account App profile settings with disabled upload', () => {
before(() => {
cy.dropAndSeedDatabase()
cy.server()
cy.augmentIsConfig({ profile_picture: { disable_upload: true } })
})
it('displays UI elements in place', () => {
Expand Down Expand Up @@ -200,7 +200,6 @@ describe('Account App profile settings with disabled upload', () => {
describe('Account App profile settings without gravatar', () => {
before(() => {
cy.dropAndSeedDatabase()
cy.server()
cy.augmentIsConfig({ profile_picture: { use_gravatar: false } })
})
it('displays UI elements in place', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ describe('Packet Broker registration', () => {
cy.loginConsole({ user_id: user.ids.user_id, password: user.password })

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)
cy.location('pathname').should('eq', `${Cypress.config('consoleRootPath')}/`)
cy.location('pathname').should('eq', Cypress.config('consoleRootPath'))

cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker/networks/19`)
cy.location('pathname').should('eq', `${Cypress.config('consoleRootPath')}/`)
cy.location('pathname').should('eq', Cypress.config('consoleRootPath'))
})

it('displays a notification when Packet Broker is not set up', () => {
Expand Down Expand Up @@ -89,7 +89,8 @@ describe('Packet Broker registration', () => {
cy.loginConsole({ user_id: 'admin', password: 'admin' })
cy.visit(`${Cypress.config('consoleRootPath')}/admin-panel/packet-broker`)

cy.findByText('Register network').click().next().findByTestId('switch').should('be.checked')
cy.findByText('Register network').click()
cy.findByText('Register network').next().findByTestId('switch').should('be.checked')
cy.findByText('List network publicly')
.should('be.visible')
.next()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Account App login', () => {

cy.get('header').within(() => {
cy.findByRole('link')
.should('have.attr', 'href', `${Cypress.config('accountAppRootPath')}/`)
.should('have.attr', 'href', Cypress.config('accountAppRootPath'))
.findByRole('img')
.should('be.visible')
.should('have.attr', 'src', `${Cypress.config('accountAppAssetsRootPath')}/account.svg`)
Expand Down
Loading
Loading