-
Notifications
You must be signed in to change notification settings - Fork 16
Cypress upgrade #803
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
Cypress upgrade #803
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| const { defineConfig } = require('cypress') | ||
|
|
||
| module.exports = defineConfig({ | ||
| reporter: 'junit', | ||
| reporterOptions: { | ||
| mochaFile: 'cypress/results/output.xml', | ||
| }, | ||
| videoCompression: false, | ||
| e2e: { | ||
| // We've imported your old cypress plugins here. | ||
| // You may want to clean this up later by importing these. | ||
| setupNodeEvents(on, config) { | ||
| return require('./cypress/plugins/index.js')(on, config) | ||
| }, | ||
| baseUrl: 'http://ckan:5000', | ||
| specPattern: 'cypress/integration/*.cy.js', | ||
| }, | ||
| retries: { | ||
| runMode: 2, | ||
| openMode: 0, | ||
| }, | ||
| }) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| describe('CKAN Token', () => { | ||
|
|
||
| before(() => { | ||
| cy.create_token(); | ||
| }); | ||
|
|
||
| after(() => { | ||
| cy.revoke_token(); | ||
| }); | ||
|
|
||
| it('Can get CKAN token', () => { | ||
| const token_data = Cypress.env('token_data'); | ||
| expect(token_data.api_token).to.have.length(175); | ||
| expect(token_data.jti).to.have.length(43); | ||
| }); | ||
|
|
||
| it('Can authorize with token', () => { | ||
| const token_data = Cypress.env('token_data'); | ||
| cy.logout(); | ||
|
|
||
| // 403 without token | ||
| cy.request({ | ||
| method: 'GET', | ||
| url: '/api/action/package_search', | ||
| failOnStatusCode: false, | ||
| }).then((response) => { | ||
| expect(response.status).to.eq(403); | ||
| }); | ||
|
|
||
| // 200 with token | ||
| cy.request({ | ||
| method: 'GET', | ||
| url: '/api/action/package_search', | ||
| headers: { | ||
| 'Authorization': token_data.api_token | ||
| } | ||
| }).then((response) => { | ||
| expect(response.status).to.eq(200); | ||
| }); | ||
| }); | ||
|
|
||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,12 @@ import 'cypress-file-upload'; | |
| describe('DCAT-US Export', () => { | ||
| const dataset_title = 'test-dataset-2'; | ||
|
|
||
| before(() => { | ||
| cy.create_token(); | ||
| }); | ||
|
|
||
| beforeEach(() => { | ||
| cy.logout(); | ||
| cy.login(); | ||
| cy.delete_dataset('test-dataset-1'); | ||
| cy.delete_dataset('test-dataset-2'); | ||
| cy.delete_dataset('test-sub-dataset-1'); | ||
|
|
@@ -44,9 +47,14 @@ describe('DCAT-US Export', () => { | |
| }); | ||
| }); | ||
| cy.exec('rm cypress/downloads/draft*', { failOnNonZeroExit: false }); | ||
| cy.exec('rm cypress/downloads/redacted.zip', { failOnNonZeroExit: false }); | ||
| cy.exec('rm cypress/downloads/data.json', { failOnNonZeroExit: false }); | ||
|
|
||
| cy.login(); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| after(() => { | ||
| cy.logout(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you want logout
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should, but since we have cy.login() in beforeEach, and it does a cy.logout() implicitly, so no need to add the extra code.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
aha. yeah that makes sense. |
||
| cy.delete_dataset('test-dataset-1'); | ||
| cy.delete_dataset('test-dataset-2'); | ||
| cy.delete_dataset('test-sub-dataset-1'); | ||
|
|
@@ -55,6 +63,9 @@ describe('DCAT-US Export', () => { | |
| cy.delete_organization('test-organization'); | ||
| cy.delete_organization('test-sub-organization'); | ||
| cy.exec('rm cypress/downloads/draft*', { failOnNonZeroExit: false }); | ||
| cy.exec('rm cypress/downloads/redacted.zip', { failOnNonZeroExit: false }); | ||
| cy.exec('rm cypress/downloads/data.json', { failOnNonZeroExit: false }); | ||
| cy.revoke_token(); | ||
| }); | ||
|
|
||
| it('Can create a zip export of the organization drafts', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| describe('Main Page', () => { | ||
|
|
||
| beforeEach(() => { | ||
| cy.login(); | ||
| }); | ||
|
|
||
| it('Load main page with configuration', () => { | ||
| cy.visit('/dataset'); | ||
| cy.contains('Inventory'); | ||
| }); | ||
|
|
||
| }) |
Uh oh!
There was an error while loading. Please reload this page.