mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
add e2e test for gcp service account file input
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'no-unused-expressions': 'off'
|
'no-unused-expressions': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ const gce = createFormSection({
|
|||||||
email: 'Service Account Email Address',
|
email: 'Service Account Email Address',
|
||||||
project: 'Project',
|
project: 'Project',
|
||||||
sshKeyData: 'RSA Private Key',
|
sshKeyData: 'RSA Private Key',
|
||||||
|
serviceAccountFile: 'Service Account JSON File'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const inputContainerElements = {
|
|||||||
popover: '.at-Popover-container',
|
popover: '.at-Popover-container',
|
||||||
yaml: 'input[type="radio", value="yaml"]',
|
yaml: 'input[type="radio", value="yaml"]',
|
||||||
json: 'input[type="radio", value="json"]',
|
json: 'input[type="radio", value="json"]',
|
||||||
revert: 'a[class~="reset"]',
|
reset: 'a[class~="reset"]',
|
||||||
down: 'span[class^="fa-angle-down"]',
|
down: 'span[class^="fa-angle-down"]',
|
||||||
up: 'span[class^="fa-angle-up"]',
|
up: 'span[class^="fa-angle-up"]',
|
||||||
prompt: {
|
prompt: {
|
||||||
@@ -34,6 +34,14 @@ const inputContainerElements = {
|
|||||||
off: {
|
off: {
|
||||||
locateStrategy: 'xpath',
|
locateStrategy: 'xpath',
|
||||||
selector: `.//button[${normalized}='off']`
|
selector: `.//button[${normalized}='off']`
|
||||||
|
},
|
||||||
|
replace: {
|
||||||
|
locateStrategy: 'xpath',
|
||||||
|
selector: `.//button[${normalized}='replace']`
|
||||||
|
},
|
||||||
|
revert: {
|
||||||
|
locateStrategy: 'xpath',
|
||||||
|
selector: `.//button[${normalized}='revert']`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
12
awx/ui/test/e2e/tests/gce.alt.json
Normal file
12
awx/ui/test/e2e/tests/gce.alt.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"type": "service_account",
|
||||||
|
"project_id": "test321",
|
||||||
|
"private_key_id": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||||
|
"private_key": "-----BEGIN PRIVATE KEY-----\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBB\n-----END PRIVATE KEY-----\n",
|
||||||
|
"client_email": "test321.iam.gserviceaccount.com",
|
||||||
|
"client_id": "321987654321987654321",
|
||||||
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"token_uri": "https://accounts.google.com/o/oauth2/token",
|
||||||
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||||
|
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test321%40test.iam.gserviceaccount.com"
|
||||||
|
}
|
||||||
1
awx/ui/test/e2e/tests/gce.invalid.json
Normal file
1
awx/ui/test/e2e/tests/gce.invalid.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
invalid
|
||||||
12
awx/ui/test/e2e/tests/gce.json
Normal file
12
awx/ui/test/e2e/tests/gce.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"type": "service_account",
|
||||||
|
"project_id": "test123",
|
||||||
|
"private_key_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
|
"private_key": "-----BEGIN PRIVATE KEY-----\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAA\n-----END PRIVATE KEY-----\n",
|
||||||
|
"client_email": "test123.iam.gserviceaccount.com",
|
||||||
|
"client_id": "123456789123456789123",
|
||||||
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"token_uri": "https://accounts.google.com/o/oauth2/token",
|
||||||
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||||
|
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test123%40test.iam.gserviceaccount.com"
|
||||||
|
}
|
||||||
11
awx/ui/test/e2e/tests/gce.missing.json
Normal file
11
awx/ui/test/e2e/tests/gce.missing.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"type": "service_account",
|
||||||
|
"project_id": "test654",
|
||||||
|
"private_key_id": "cccccccccccccccccccccccccccccccccccccccc",
|
||||||
|
"private_key": "-----BEGIN PRIVATE KEY-----\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCC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CCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCCCCCC\n-----END PRIVATE KEY-----\n",
|
||||||
|
"client_id": "654321987654321987654",
|
||||||
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"token_uri": "https://accounts.google.com/o/oauth2/token",
|
||||||
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||||
|
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test654%40test.iam.gserviceaccount.com"
|
||||||
|
}
|
||||||
269
awx/ui/test/e2e/tests/test-credentials-add-edit-gce-file.js
Normal file
269
awx/ui/test/e2e/tests/test-credentials-add-edit-gce-file.js
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import uuid from 'uuid';
|
||||||
|
|
||||||
|
const GCE_SERVICE_ACCOUNT_FILE = path.resolve(__dirname, 'gce.json');
|
||||||
|
const GCE_SERVICE_ACCOUNT_FILE_ALT = path.resolve(__dirname, 'gce.alt.json');
|
||||||
|
const GCE_SERVICE_ACCOUNT_FILE_INVALID = path.resolve(__dirname, 'gce.invalid.json');
|
||||||
|
const GCE_SERVICE_ACCOUNT_FILE_MISSING = path.resolve(__dirname, 'gce.missing.json');
|
||||||
|
|
||||||
|
let credentials;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
before: (client, done) => {
|
||||||
|
credentials = client.page.credentials();
|
||||||
|
|
||||||
|
client.login();
|
||||||
|
client.waitForAngular();
|
||||||
|
|
||||||
|
credentials.section.navigation
|
||||||
|
.waitForElementVisible('@credentials')
|
||||||
|
.click('@credentials');
|
||||||
|
|
||||||
|
credentials
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
credentials.section.list
|
||||||
|
.waitForElementVisible('@add')
|
||||||
|
.click('@add');
|
||||||
|
|
||||||
|
credentials.section.add.section.details
|
||||||
|
.waitForElementVisible('@save')
|
||||||
|
.setValue('@name', `credential-${uuid().substr(0, 8)}`)
|
||||||
|
.setValue('@type', 'Google Compute Engine', done);
|
||||||
|
},
|
||||||
|
'expected fields are initially visible and enabled': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
details.expect.element('@name').visible;
|
||||||
|
details.expect.element('@description').visible;
|
||||||
|
details.expect.element('@organization').visible;
|
||||||
|
details.expect.element('@type').visible;
|
||||||
|
|
||||||
|
gce.expect.element('@email').visible;
|
||||||
|
gce.expect.element('@sshKeyData').visible;
|
||||||
|
gce.expect.element('@project').visible;
|
||||||
|
gce.expect.element('@serviceAccountFile').visible;
|
||||||
|
|
||||||
|
details.expect.element('@name').enabled;
|
||||||
|
details.expect.element('@description').enabled;
|
||||||
|
details.expect.element('@organization').enabled;
|
||||||
|
details.expect.element('@type').enabled;
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').not.present;
|
||||||
|
},
|
||||||
|
'select valid credential file': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.setValue('form input[type="file"]', GCE_SERVICE_ACCOUNT_FILE);
|
||||||
|
|
||||||
|
gce.expect.element('@email').not.enabled;
|
||||||
|
gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
gce.expect.element('@project').not.enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').not.present;
|
||||||
|
},
|
||||||
|
'deselect valid credential file': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.click('form i[class*="trash"]');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').not.present;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').visible;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
},
|
||||||
|
'select credential file with missing field': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.setValue('form input[type="file"]', GCE_SERVICE_ACCOUNT_FILE_MISSING);
|
||||||
|
|
||||||
|
gce.expect.element('@email').not.enabled;
|
||||||
|
gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
gce.expect.element('@project').not.enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').not.present;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').not.present;
|
||||||
|
},
|
||||||
|
'deselect credential file with missing field': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.click('form i[class*="trash"]');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').not.present;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').visible;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
},
|
||||||
|
'select invalid credential file': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.setValue('form input[type="file"]', GCE_SERVICE_ACCOUNT_FILE_INVALID);
|
||||||
|
|
||||||
|
gce.expect.element('@email').not.enabled;
|
||||||
|
gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
gce.expect.element('@project').not.enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').not.present;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').visible;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
},
|
||||||
|
'deselect invalid credential file': client => {
|
||||||
|
const { details } = credentials.section.add.section;
|
||||||
|
const { gce } = details.section;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.click('form i[class*="trash"]');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').visible;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').enabled;
|
||||||
|
gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').not.present;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').visible;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
},
|
||||||
|
'save valid credential file': client => {
|
||||||
|
const add = credentials.section.add.section.details;
|
||||||
|
const edit = credentials.section.edit.section.details;
|
||||||
|
|
||||||
|
add.section.gce.section.serviceAccountFile.setValue('form input[type="file"]', GCE_SERVICE_ACCOUNT_FILE);
|
||||||
|
|
||||||
|
add.section.gce.expect.element('@email').not.enabled;
|
||||||
|
add.section.gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
add.section.gce.expect.element('@project').not.enabled;
|
||||||
|
add.section.gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
add.section.gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').visible;
|
||||||
|
add.section.gce.section.serviceAccountFile.expect.element('form i[class*="trash"]').enabled;
|
||||||
|
add.section.gce.section.serviceAccountFile.expect.element('form i[class*="folder"]').not.present;
|
||||||
|
|
||||||
|
add.click('@save');
|
||||||
|
|
||||||
|
credentials
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
edit.section.gce.expect.element('@email').enabled;
|
||||||
|
edit.section.gce.expect.element('@project').enabled;
|
||||||
|
|
||||||
|
edit.section.gce.expect.element('@serviceAccountFile').not.enabled;
|
||||||
|
edit.section.gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
},
|
||||||
|
'select and deselect credential file when replacing private key': client => {
|
||||||
|
const { gce } = credentials.section.edit.section.details.section;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.waitForElementVisible('@replace');
|
||||||
|
gce.section.sshKeyData.click('@replace');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').not.present;
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.setValue('form input[type="file"]', GCE_SERVICE_ACCOUNT_FILE_ALT);
|
||||||
|
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.expect.element('@email').not.enabled;
|
||||||
|
gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
gce.expect.element('@project').not.enabled;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').not.present;
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.sshKeyData.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.expect.element('@replace').not.present;
|
||||||
|
gce.section.sshKeyData.expect.element('@revert').present;
|
||||||
|
gce.section.sshKeyData.expect.element('@revert').not.enabled;
|
||||||
|
|
||||||
|
gce.section.serviceAccountFile.click('form i[class*="trash"]');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@sshKeyData').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
gce.expect.element('@serviceAccountFile').enabled;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.expect.element('@error').visible;
|
||||||
|
|
||||||
|
gce.section.email.expect.element('@error').not.present;
|
||||||
|
gce.section.project.expect.element('@error').not.present;
|
||||||
|
gce.section.serviceAccountFile.expect.element('@error').not.present;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.expect.element('@revert').enabled;
|
||||||
|
|
||||||
|
gce.section.sshKeyData.click('@revert');
|
||||||
|
|
||||||
|
gce.expect.element('@email').enabled;
|
||||||
|
gce.expect.element('@project').enabled;
|
||||||
|
|
||||||
|
gce.expect.element('@serviceAccountFile').not.enabled;
|
||||||
|
gce.expect.element('@sshKeyData').not.enabled;
|
||||||
|
|
||||||
|
client.end();
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user