Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M3-2569 fix time-zone test #4705

Merged
Merged
Changes from all commits
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
113 changes: 59 additions & 54 deletions e2e/specs/profile/update-display.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,63 @@ import { updateProfile, getProfile } from '../../utils/common';
import Display from '../../pageobjects/profile/display.page';

describe('Profile - Update Display Settings', () => {
let resetProfileBody;

beforeAll(() => {
browser.url(constants.routes.profile.view);
const startProfile = getProfile();
resetProfileBody = {
email: startProfile.email,
timezone: startProfile.timezone
}
});

afterAll(() => {
updateProfile(resetProfileBody);
});

it('Should display the update display settings view', () => {
Display.baseElementsDisplay();
});

it('Display name should not be editable', () => {
expect(Display.userName.getAttribute('disabled')).toBe('true');
});

it('Email should be an editable field', () => {
expect(Display.userEmail.getAttribute('disabled')).toBe(null);
});

xit('Invalid emails can not be saved', () => {
Display.userEmail.setValue('fakeemail');
Display.submitButton.click();
Display.invalidEmailWarning.waitForVisible(constants.wait.normal);
expect(Display.invalidEmailWarning.getText()).toEqual('email must be a valid email');
Display.cancelButton.click();
});

it('Valid email can be saved', () => {
const validEmail = 'test@gmail.com';
Display.userEmail.setValue(validEmail);
Display.submitButton.click();
Display.waitForNotice('Email address updated.');
expect(getProfile().email).toBe(validEmail);
});

it('Change user timezone', () => {
const gmtOffset = '(GMT -05:00) Eastern Time';
const timeZoneResponse = 'America/New_York';
expect(Display.timeZoneSelect.isVisible()).toBe(true);
Display.timeZoneSelect.$('..').$('input').setValue(gmtOffset);
Display.selectOptions[0].waitForVisible(constants.wait.normal);
Display.selectOptions[0].click(0);
Display.saveTimeZone.click();
Display.waitForNotice('Account timezone updated.');
expect(getProfile().timezone).toBe(timeZoneResponse);
});
let resetProfileBody;

beforeAll(() => {
browser.url(constants.routes.profile.view);
const startProfile = getProfile();
resetProfileBody = {
email: startProfile.email,
timezone: startProfile.timezone
};
});

afterAll(() => {
updateProfile(resetProfileBody);
});

it('Should display the update display settings view', () => {
Display.baseElementsDisplay();
});

it('Display name should not be editable', () => {
expect(Display.userName.getAttribute('disabled')).toBe('true');
});

it('Email should be an editable field', () => {
expect(Display.userEmail.getAttribute('disabled')).toBe(null);
});

it('Invalid emails can not be saved', () => {
Display.userEmail.setValue('fakeemail');
Display.submitButton.click();
Display.invalidEmailWarning.waitForVisible(constants.wait.normal);
expect(Display.invalidEmailWarning.getText()).toEqual(
'email must be a valid email'
);
Display.cancelButton.click();
});

it('Valid email can be saved', () => {
const validEmail = 'test@gmail.com';
Display.userEmail.setValue(validEmail);
Display.submitButton.click();
Display.waitForNotice('Email address updated.');
expect(getProfile().email).toBe(validEmail);
});

it('Change user timezone', () => {
const gmtOffset = '(GMT -5:00) Eastern Time - New York';
const timeZoneResponse = 'America/New_York';
expect(Display.timeZoneSelect.isVisible()).toBe(true);
Display.timeZoneSelect
.$('..')
.$('input')
.setValue(gmtOffset);
Display.selectOptions[0].waitForVisible(constants.wait.normal);
Display.selectOptions[0].click(0);
Display.saveTimeZone.click();
Display.waitForNotice('Account timezone updated.');
expect(getProfile().timezone).toBe(timeZoneResponse);
});
});