Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ minio 2023-08-09T23-30-22Z
mc 2023-08-08T17-23-59Z
istioctl 1.19.3

nodejs 22.0.0
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ test: # @HELP Run yamllint tests against the repository
test:
yamllint --no-warnings .

.PHONY: cy
cy: # @HELP Open cypress
cy:
npx cypress open

skaffold-mediawiki-139: # @HELP Deploy the local mediawiki 1.39 image using skaffold
skaffold-ui: # @HELP Deploy the local ui image using skaffold
skaffold-api: # @HELP Deploy the api image using skaffold
Expand Down
13 changes: 13 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
env: {
URL_PLATFORM_UI: 'https://wikibase.cloud',
URL_TEST_WIKI: 'https://test-hackathon-2024.wikibase.cloud',
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
22 changes: 22 additions & 0 deletions cypress/e2e/ui.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('Discovery page works', () => {
it('passes', () => {
cy.visit(Cypress.env('URL_PLATFORM_UI') + '/discovery')
cy.get('.details.col').should('not.be.empty')
})
})

describe('User can login', () => {
it('passes', () => {
cy.visit(Cypress.env('URL_PLATFORM_UI'))
cy.get('#nav-login').click()
cy.url().should('include', '/login')

cy.get('#inputEmail').type(Cypress.env('TEST_USER'))
cy.get('#inputPassword').type(Cypress.env('TEST_PASSWORD'))

cy.get('form').submit()

cy.contains(Cypress.env('TEST_USER'))
})
})

15 changes: 15 additions & 0 deletions cypress/e2e/wiki.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Login to wiki works', () => {
it('passes', () => {
cy.visit(Cypress.env('URL_TEST_WIKI'))
cy.get('#pt-login a').click()

cy.get('#wpName1').type(Cypress.env('TEST_WIKI_USERNAME'))
cy.get('#wpPassword1').type(Cypress.env('TEST_WIKI_PASSWORD'))
cy.get('#wpLoginAttempt').click()

cy.get('#pt-userpage').contains(Cypress.env('TEST_WIKI_USERNAME'))
})
})

// TODO create item after login
// cy.visit(Cypress.env('URL_TEST_WIKI') + '/wiki/Special:NewItem')
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading