Skip to content

Commit

Permalink
feat: update e2e tests and dump
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Oct 20, 2023
1 parent b55b17c commit 1ba5443
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
12 changes: 3 additions & 9 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ describe('dashboard', () => {
.then((text) => {
pageOne = text
})
cy.get('gn-ui-pagination-buttons').find('gn-ui-button').last().click()
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.invoke('text')
.then((text) => {
expect(text).not.to.equal(pageOne)
cy.url().should('include', 'page=2')
})
})
it('should display different results on click on specific page and change url', () => {
cy.visit('/records/search?_page=2')
Expand Down Expand Up @@ -46,6 +37,9 @@ describe('dashboard', () => {
.then((list) => {
originalFirstItem = list.trim()
cy.get('.record-table-header').first().click()
// Takes time to refresh results
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500)
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
Expand Down
15 changes: 12 additions & 3 deletions apps/metadata-editor-e2e/src/e2e/my-org.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
describe('my-org', () => {
beforeEach(() => {
cy.loginGN('barbie', 'p4ssworD_', false)
cy.intercept({
method: 'GET',
url: 'http://localhost:4200/geonetwork/srv/api/userselections/0/101',
}).as('dataGetFirst')
cy.visit(`/records/my-org`)
cy.get('md-editor-dashboard-menu').find('a').first().click()
cy.get('main').children('div').first().children('div').eq(1).as('linkGroup')
cy.wait('@dataGetFirst').its('response.statusCode').should('equal', 200)
cy.get('main').children('div').first().as('linkGroup')
})
describe('my-org display', () => {
it('should show my-org name and logo', () => {
Expand All @@ -28,8 +33,12 @@ describe('my-org', () => {
})
describe('routing', () => {
it('should access the datahub with a filter', () => {
cy.get('@linkGroup').find('a').click()
cy.url().should('include', 'search/publisher=')
cy.get('@linkGroup')
.find('a')
.should('have.attr', 'href')
.then((href) => {
expect(href).to.include('search?publisher=Barbie+Inc')
})
})
it('should access the user list page and show my-org users', () => {
cy.visit(`/records/my-org`)
Expand Down
16 changes: 6 additions & 10 deletions apps/metadata-editor-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ declare namespace Cypress {
Cypress.Commands.add(
'loginGN',
(username: string, password: string, redirect = true) => {
cy.visit('http://localhost:8080/geonetwork/srv/eng/catalog.search#/home')
cy.get('.cookie-warning-actions').then(($cookie) => {
if ($cookie.is(':visible')) {
$cookie.find('button').eq(0).click()
cy.scrollTo('top')
}
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('Jsonix')) return false
if (err.message.includes('postMessage')) return false
})

cy.wait(250)
cy.get('li.signin-dropdown').click()
cy.get('#inputUsername').type(username)
cy.get('#inputPassword').type(password)
cy.visit('/geonetwork/srv/eng/catalog.signin?debug') // this will point to a 404
cy.get('#inputUsername').type(username, { force: true })
cy.get('#inputPassword').type(password, { force: true })
cy.get('[name="gnSigninForm"]').submit()
if (redirect) cy.visit('/')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</div>
<div class="flex flex-row gap-3 items-center">
<h1 class="text-[56px] font-title grow">{{ title }}</h1>
np
<h1 *ngIf="users" class="text-[56px] font-title grow" translate>
dashboard.records.users
</h1>
Expand Down
2 changes: 1 addition & 1 deletion conf/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[global]
# This URL (relative or absolute) must point to the API endpoint of a GeoNetwork4 instance
geonetwork4_api_url = "/geonetwork/srv/api"
datahub_url = "/datahub"
datahub_url = "http://myhost/datahub"
# This should point to a proxy to avoid CORS errors on some requests (data preview, OGC capabilities etc.)
# The actual URL will be appended after this path, e.g. : https://my.proxy/?url=http%3A%2F%2Fencoded.url%2Fows`
# This is an optional parameter: leave empty to disable proxy usage
Expand Down
2 changes: 1 addition & 1 deletion libs/feature/catalog/src/lib/my-org/my-org.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MyOrgService {
map(([user, allUsers, orgs]) => {
const orgName = user.organisation
const org = orgs.find((org) => org.name === orgName)
const logoUrl = org?.logoUrl?.href.toString()
const logoUrl = org?.logoUrl?.toString()
const recordCount = org?.recordCount
const userList = allUsers.filter(
(user) => user.organisation === orgName
Expand Down
Binary file modified support-services/docker-entrypoint-initdb.d/dump
Binary file not shown.

0 comments on commit 1ba5443

Please sign in to comment.