Skip to content

Commit

Permalink
#242: fixing oauth CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed Oct 1, 2024
1 parent 5aeba4f commit ee2f3ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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) => {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion skills-client-integration/skills-int-e2e-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ee2f3ac

Please sign in to comment.