diff --git a/skills-client-integration/skills-int-e2e-test/cypress/e2e/transcript-export_specs.js b/skills-client-integration/skills-int-e2e-test/cypress/e2e/transcript-export_specs.js index 9646645b..ac6e2a64 100644 --- a/skills-client-integration/skills-int-e2e-test/cypress/e2e/transcript-export_specs.js +++ b/skills-client-integration/skills-int-e2e-test/cypress/e2e/transcript-export_specs.js @@ -23,9 +23,10 @@ context("Transcript Export Tests", () => { return text.replace(/\n/g, '') } + let userName beforeEach(() => { + userName = Cypress.env('oauthMode') ? 'foo bar (foo)' : 'user1' const getFileName = (projName) => { - const userName = Cypress.env('oauthMode') ? 'foo bar (foo)' : 'user1' return `./cypress/downloads/${projName} - ${userName} - Transcript.pdf` } Cypress.Commands.add("readTranscript", (pathToPdf) => { @@ -63,7 +64,7 @@ context("Transcript Export Tests", () => { expect(clean(doc.text)).to.include('Level: 0 / 5 ') expect(clean(doc.text)).to.include('Points: 0 / 100 ') expect(clean(doc.text)).to.include('Skills: 0 / 2 ') - expect(clean(doc.text)).to.include('user1') + expect(clean(doc.text)).to.include(userName) expect(clean(doc.text)).to.not.include('Badges') // should be a title on the 2nd page @@ -100,7 +101,7 @@ context("Transcript Export Tests", () => { expect(clean(doc.text)).to.include('Level: 0 / 5 ') expect(clean(doc.text)).to.include('Points: 0 / 100 ') expect(clean(doc.text)).to.include('Skills: 0 / 2 ') - expect(clean(doc.text)).to.include('user1') + expect(clean(doc.text)).to.include(userName) expect(clean(doc.text)).to.not.include('Badges') // should be a title on the 2nd page @@ -111,7 +112,6 @@ context("Transcript Export Tests", () => { expect(clean(doc.text)).to.not.include('null') }) }); - if (!Cypress.env('oauthMode')) { it('export user transcript - community protected header', () => { cy.intercept('GET', '/public/config', (req) => { @@ -160,7 +160,7 @@ context("Transcript Export Tests", () => { expect(clean(doc.text)).to.include('Level: 0 / 5 ') expect(clean(doc.text)).to.include('Points: 0 / 100 ') expect(clean(doc.text)).to.include('Skills: 0 / 2 ') - expect(clean(doc.text)).to.include('user1') + expect(clean(doc.text)).to.include(userName) expect(clean(doc.text)).to.not.include('Badges') // should be a title on the 2nd page diff --git a/skills-client-integration/skills-int-e2e-test/cypress/support/e2e.js b/skills-client-integration/skills-int-e2e-test/cypress/support/e2e.js index 25eac9ee..fb125646 100644 --- a/skills-client-integration/skills-int-e2e-test/cypress/support/e2e.js +++ b/skills-client-integration/skills-int-e2e-test/cypress/support/e2e.js @@ -44,9 +44,7 @@ beforeEach(() => { cy.request('api/config').then(resp => { cy.backendRegister(vars.rootUser, vars.defaultPass, true); cy.backendRegister(vars.defaultUser, vars.defaultPass); // used by the skills-int-service app - const oauthMode = resp.body.authenticator === 'hydra' || resp.body.authenticator === 'http://localhost:8080/oauth2/authorization/hydra' - Cypress.env('oauthMode', oauthMode) - if (!oauthMode) { + if (!Cypress.env('oauthMode')) { cy.backendLogin(vars.defaultUser, vars.defaultPass); Cypress.env('proxyUser', 'user1') Cypress.env('tokenUrl', '/api/users/user1/token') diff --git a/skills-client-integration/skills-int-e2e-test/package.json b/skills-client-integration/skills-int-e2e-test/package.json index 5a261bae..da66e441 100644 --- a/skills-client-integration/skills-int-e2e-test/package.json +++ b/skills-client-integration/skills-int-e2e-test/package.json @@ -12,8 +12,9 @@ "licenseCheck": "npm run licenseHeaderCheck && npm run licenseDepCheck", "test": "echo \"Error: no test specified\" && exit 1", "cy:open": "cypress open", + "cy:open:oauth": "cypress open --env oauthMode=true", "cy:run": "npm run licenseCheck && cypress run", - "cy:run:oauth": "npm run licenseCheck && cypress run --env authMode=oauth", + "cy:run:oauth": "npm run licenseCheck && cypress run --env oauthMode=true", "cy:run:timeout": "npm run licenseCheck && cypress run --env timeout=true --spec \"cypress/e2e/timeout.specs.js\"", "cy:open:dev:js": "cypress open --config baseUrl=http://localhost:8092", "cy:open:dev:ng": "cypress open --config baseUrl=http://localhost:4200",