This repository has been archived by the owner on Jun 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Haraka relay tests, reusable workflow fix (#13)
- Loading branch information
Showing
17 changed files
with
175 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
DNS1=10.1.8.128 | ||
DNS2=10.1.8.129 | ||
DNS2=10.1.8.129 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
DNS1=10.1.2.128 | ||
DNS2=10.1.2.129 | ||
DNS2=10.1.2.129 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
nightwatch/assertions/isCloudflareOrPomeriumPermissionRejectedPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const isPomeriumPermissionRejectedPage = require("./isPomeriumPermissionRejectedPage") | ||
const isCloudflarePermissionRejectedPage = require("./isCloudflarePermissionRejectedPage") | ||
|
||
const assertion = function () { | ||
if (this.__nightwatchInstance.settings.globals.isRemote) { | ||
isCloudflarePermissionRejectedPage.reusable(this) | ||
} else { | ||
isPomeriumPermissionRejectedPage.reusable(this) | ||
} | ||
} | ||
|
||
module.exports = { | ||
assertion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const reusable = function (context) { | ||
context.formatMessage = () => { | ||
const message = `Checking if the page ${this.negate ? 'doesn\'t indicate' : 'indicates'} Pomerium permission rejected`; | ||
|
||
return { | ||
message, | ||
args: [] | ||
} | ||
}; | ||
|
||
context.expected = () => { | ||
return "403 Forbidden" | ||
} | ||
|
||
context.value = function (result) { | ||
return result.value; | ||
}; | ||
|
||
context.failure = function (result) { | ||
return !result; | ||
}; | ||
|
||
context.evaluate = function (value) { | ||
return value && value.startsWith(this.expected()) | ||
}; | ||
|
||
context.command = async function (callback) { | ||
this.api.getText("div[role=alert]", callback) | ||
}; | ||
}; | ||
|
||
const assertion = function () { | ||
reusable(this) | ||
}; | ||
|
||
module.exports = { | ||
reusable, | ||
assertion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe('Argo CD when accessed locally should', () => { | ||
this.tags = [ "localonly" ] | ||
|
||
afterEach((browser) => { | ||
browser.end() | ||
}) | ||
|
||
it('Load main screen after signing in as admin', (browser) => { | ||
browser | ||
.subdomain('argocd') | ||
.click('a > button') // Redirects to AAD | ||
.signInAsAdmin() | ||
.assert.textContains("div.sidebar__logo", "Argo CD") | ||
}); | ||
|
||
it('Not allow non-admins to use the app', (browser) => { | ||
browser | ||
.subdomain('argocd') | ||
.click('a > button') // Redirects to AAD | ||
.signInAsNonAdmin() | ||
.assert.isAadPermissionRejectedPage() | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const nodemailer = require("nodemailer"); | ||
|
||
describe('Mailrelay when accessed locally should', async () => { | ||
this.tags = ["localonly"] | ||
|
||
// Note: these tests are not running inside of selenium but directly in the runner | ||
// which is why the tests bypass dns resolution (the runner does not use Homecentr's custom DNS) | ||
|
||
it('Send e-mail', async (browser) => { | ||
const transport = nodemailer.createTransport({ | ||
host: browser.globals.smtp_relay_host, | ||
port: 25, | ||
auth: { | ||
user: browser.globals.smtp_relay_username, | ||
pass: browser.globals.smtp_relay_password | ||
}, | ||
tls: { | ||
// Server has only domain in certificate and we are using a direct ip to skip dns resolution | ||
servername: browser.globals.smtp_relay_servername | ||
} | ||
}); | ||
|
||
const receipt = await transport.sendMail({ | ||
from: browser.globals.smtp_relay_sender, | ||
to: browser.globals.smtp_relay_recipient, | ||
subject: "E2E test ✔", | ||
text: "Hello, world!" | ||
}); | ||
|
||
expect(receipt.accepted.length).to.be.equal(1) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe('Proxmox VE when accessed remotely should', () => { | ||
this.tags = [ "remoteonly" ] | ||
|
||
afterEach((browser) => { | ||
browser.end() | ||
}) | ||
|
||
it('Load main screen after signing in as admin', (browser) => { | ||
browser | ||
.subdomain('pve') | ||
.signInAsAdmin() // Sign into Cloudflare Access | ||
.setValue('#pveloginrealm-inputEl', 'Azure Active Directory') | ||
.waitForElementVisible("a#button-1070") | ||
.click('a#button-1070') // Redirects to AAD | ||
.assert.textContains("#versioninfo-innerCt", "Virtual Environment") | ||
}); | ||
|
||
it('Not allow non-admins to use the app', (browser) => { | ||
browser | ||
.subdomain('pve') | ||
.signInAsNonAdmin() // Sign into Cloudflare Access | ||
.assert.isCloudflarePermissionRejectedPage() | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters