Skip to content

Commit

Permalink
fix failing e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir committed Oct 23, 2023
1 parent 409d8ed commit 91dd349
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
14 changes: 11 additions & 3 deletions packages/compass-e2e-tests/tests/connection-form.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('Connection form', function () {
hosts: ['localhost:27017'],
directConnection: false,
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'none',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
Expand All @@ -65,6 +66,7 @@ describe('Connection form', function () {
hosts: ['localhost:27017'],
directConnection: true,
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'none',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
Expand Down Expand Up @@ -97,6 +99,7 @@ describe('Connection form', function () {
scheme: 'MONGODB',
hosts: ['localhost:27017', 'localhost:27091'],
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'none',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
Expand Down Expand Up @@ -129,6 +132,7 @@ describe('Connection form', function () {
scheme: 'MONGODB_SRV',
hosts: ['localhost'],
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'none',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
Expand All @@ -151,7 +155,7 @@ describe('Connection form', function () {

it('parses and formats a URI for username/password authentication', async function () {
const connectionString =
'mongodb://foo:bar@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=source';
'mongodb://foo:bar@localhost:27017/?authSource=source&authMechanism=SCRAM-SHA-1';

await browser.setValueVisible(
Selectors.ConnectionStringInput,
Expand Down Expand Up @@ -383,6 +387,7 @@ describe('Connection form', function () {
hosts: ['localhost:27017'],
directConnection: false,
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'socks',
socksHost: 'hostname',
socksPort: '1234',
Expand Down Expand Up @@ -421,6 +426,7 @@ describe('Connection form', function () {
hosts: ['localhost:27017'],
directConnection: false,
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'none',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
Expand Down Expand Up @@ -459,6 +465,7 @@ describe('Connection form', function () {
expect(await browser.getConnectFormState()).to.deep.equal({
authMethod: 'DEFAULT',
connectionString: 'mongodb://localhost:27017/',
defaultAuthMechanism: 'DEFAULT',
directConnection: false,
hosts: ['localhost:27017'],
proxyMethod: 'password',
Expand Down Expand Up @@ -495,6 +502,7 @@ describe('Connection form', function () {
expect(await browser.getConnectFormState()).to.deep.equal({
authMethod: 'DEFAULT',
connectionString: 'mongodb://localhost:27017/',
defaultAuthMechanism: 'DEFAULT',
directConnection: false,
hosts: ['localhost:27017'],
proxyMethod: 'identity',
Expand All @@ -517,7 +525,7 @@ describe('Connection form', function () {

it('redacts passwords when input is not focused', async function () {
const connectionString =
'mongodb://foo:user_password@localhost:27017/?authMechanism=DEFAULT&proxyHost=hostname&proxyPort=1234&proxyUsername=username&proxyPassword=proxy_password';
'mongodb://foo:user_password@localhost:27017/?proxyHost=hostname&proxyPort=1234&proxyUsername=username&proxyPassword=proxy_password';

await browser.setValueVisible(
Selectors.ConnectionStringInput,
Expand All @@ -536,12 +544,12 @@ describe('Connection form', function () {
defaultUsername: 'foo',
defaultPassword: 'user_password',
authMethod: 'DEFAULT',
defaultAuthMechanism: 'DEFAULT',
proxyMethod: 'socks',
socksHost: 'hostname',
socksPort: '1234',
socksUsername: 'username',
socksPassword: 'proxy_password',
defaultAuthMechanism: 'DEFAULT',
sslConnection: 'DEFAULT',
tlsAllowInvalidCertificates: false,
tlsAllowInvalidHostnames: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('protectConnectionStrings', function () {
await browser.selectFavorite(favoriteName);

expect(await browser.getConnectFormConnectionString()).to.equal(
'mongodb://foo:*****@localhost:12345/?authMechanism=DEFAULT'
'mongodb://foo:*****@localhost:12345/'
);

// Enter edit connection string mode
Expand All @@ -69,15 +69,15 @@ describe('protectConnectionStrings', function () {
expect(
await browser.getConnectFormConnectionString(),
'hide password when input is not focused'
).to.equal('mongodb://foo:*****@localhost:12345/?authMechanism=DEFAULT');
).to.equal('mongodb://foo:*****@localhost:12345/');
expect(
await browser.getConnectFormConnectionString(true),
'shows password when input is focused'
).to.equal('mongodb://foo:bar@localhost:12345/?authMechanism=DEFAULT');
).to.equal('mongodb://foo:bar@localhost:12345/');
await expectCopyConnectionStringToClipboard(
browser,
favoriteName,
'mongodb://foo:bar@localhost:12345/?authMechanism=DEFAULT'
'mongodb://foo:bar@localhost:12345/'
);
await browser
.$(Selectors.EditConnectionStringToggle)
Expand All @@ -89,12 +89,12 @@ describe('protectConnectionStrings', function () {
await browser.setFeature('protectConnectionStrings', true);

expect(await browser.getConnectFormConnectionString()).to.equal(
'mongodb://foo:*****@localhost:12345/?authMechanism=DEFAULT'
'mongodb://foo:*****@localhost:12345/'
);
await expectCopyConnectionStringToClipboard(
browser,
favoriteName,
'mongodb://<credentials>@localhost:12345/?authMechanism=DEFAULT'
'mongodb://<credentials>@localhost:12345/'
);
await browser
.$(Selectors.EditConnectionStringToggle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Authentication Handler', function () {
expect(res.errors).to.equal(undefined);
});

it('should return an error if the connection string has no username and the password is being set to not empty', function () {
it.only('should return an error if the connection string has no username and the password is being set to not empty', function () {
const res = handleUpdatePassword({
action: {
type: 'update-password',
Expand Down

0 comments on commit 91dd349

Please sign in to comment.