Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Cypress/E2E: Fix bot accounts disabled section verification #6894

Merged
merged 5 commits into from
Oct 23, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions e2e/cypress/integration/bot_accounts/managing_bot_accounts_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Managing bot accounts', () => {
cy.visit('/login');

// # Enter bot name in the email field
cy.findByPlaceholderText('Email, Username or AD/LDAP Username', {timeout: TIMEOUTS.ONE_MIN}).clear().type(botName);
cy.findByPlaceholderText('Email or Username', {timeout: TIMEOUTS.ONE_MIN}).clear().type(botName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failed on me since LDAP is enabled at partial_default_config.json.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have: cy.apiAdminLogin() at L148 should move to beforeEach so that failed test here will not cause to fail other succeeding tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I removed the extra cy.apiAdminLogin at L148 since it's already present in beforeEach
  2. I ran the tests without license since it's not enterprise. Can you try that locally and see if you still get the LDAP issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see but I suggest to make this spec pass both for EE and TE since we can't make this TE only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved that particular test case to enterprise without having to add additional test case in tm4j

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Now I'm thinking about the conditional test that Rohitesh mentioned before, and something like this might make sense in doing so. But I'm good with the latest change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the thing is that case is about bot account not being able to login. The placeholder having different value for EE and TE is outside that case. There should be a new case just testing the placeholder values

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, my only concern is the test should be able to run both for TE and EE. With the latest change, we'll not be able to run in TE since it's marked as @enterprise only and required license to test.


// # Enter random password in the password field
cy.findByPlaceholderText('Password').clear().type('invalidPassword@#%(^!');
Expand All @@ -159,13 +159,10 @@ describe('Managing bot accounts', () => {
cy.findByText(`Test Bot (@${botName})`, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
// # Click the disable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(3)').should('be.visible').click();

// # Bring 'disabled' section into view
cy.get('.bot-list__disabled').scrollIntoView();

// * Check that the bot is in the 'disabled' section
cy.get('.bot-list__disabled').findByText(`Test Bot (@${botName})`).should('be.visible');
});

// * Check that the bot is in the 'disabled' section
cy.get('.bot-list__disabled').scrollIntoView().findByText(`Test Bot (@${botName})`).should('be.visible');
});

it('MM-T1857 Enable Bot', () => {
Expand All @@ -182,13 +179,14 @@ describe('Managing bot accounts', () => {
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type(`${botName}`);

// # Re-enable the bot
cy.findByText(`Test Bot (@${botName})`, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
cy.get('.bot-list__disabled').scrollIntoView().findByText(`Test Bot (@${botName})`, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
// # Click the enable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(1)').should('be.visible').click();

// * Check that the bot is in the 'enabled' section
cy.get('.bot-list__disabled').siblings(':not([class])').scrollIntoView().findByText(`Test Bot (@${botName})`).scrollIntoView().should('be.visible');
});

// * Check that the bot is in the 'enabled' section
cy.findByText(`Test Bot (@${botName})`).scrollIntoView().should('be.visible');
cy.get('.bot-list__disabled').should('not.be.visible');
});

it('MM-T1858 Search active and disabled Bot accounts', () => {
Expand Down Expand Up @@ -299,8 +297,7 @@ describe('Managing bot accounts', () => {
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type('Bot That Stays Enabled');

// * Validate that the plugin is disabled since it's owner is deactivate
cy.get('.bot-list__disabled').scrollIntoView().should('be.visible');
cy.get('.bot-list__disabled').findByText(`Bot That Stays Enabled (@${botName3})`).scrollIntoView().should('be.visible');
cy.get('.bot-list__disabled').scrollIntoView().findByText(`Bot That Stays Enabled (@${botName3})`).scrollIntoView().should('be.visible');

cy.visit(`/${newTeam.name}/messages/@sysadmin`);

Expand Down